Skip to content

Conversation

@vfdev-5
Copy link
Contributor

@vfdev-5 vfdev-5 commented Sep 27, 2023

Description:

  • Added batch rules for _upsample_bi*2d_aa and _upsample_bi*2d_aa_backward
  • Added few more test cases into sample_inputs_upsample_aten

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 27, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/110172

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 1 Pending

As of commit 4f4dc11 with merge base 0511df0 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@vfdev-5 vfdev-5 added the topic: not user facing topic category label Sep 27, 2023
@drisspg drisspg added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Sep 27, 2023
@vfdev-5 vfdev-5 force-pushed the add-batch-rule-upsample-aa branch from 494d2b3 to a4584cc Compare September 27, 2023 20:38
Description:
- Added batch rules for _upsample_bi*2d_aa and _upsample_bi*2d_aa_backward
- Added few more test cases into sample_inputs_upsample_aten
"aten::to.dtype_layout",
"aten::to.other",
"aten::upsample_bicubic2d.vec",
"aten::_upsample_bicubic2d_aa.vec",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this is consistent with batching rule for other upsampling ops but
given that these ops are composite, I think it would make sense to decompose them instead of adding a batching rule (i.e. adding it to BatchRulesDecomposition). I am curious to know if decomposing works.

If it works, we should decompose the existing ones as well.

cc: @zou3519

Thanks!

Ref:

- func: _upsample_bicubic2d_aa.vec(Tensor input, SymInt[]? output_size, bool align_corners, float[]? scale_factors) -> Tensor
python_module: nn
autogen: _upsample_bicubic2d_aa.vec_out

Copy link
Contributor Author

@vfdev-5 vfdev-5 Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kshiteej, if I understand correctly the idea is to do

// in BatchRulesModules.cpp
EXISTING_BDIM(_upsample_bilinear2d_aa);
// and in BatchRulesDecompositions.cpp
OP_DECOMPOSE2(_upsample_bilinear2d_aa, vec);

however this leads to a compilation problem which comes from SymInt vs long types incompatibility: Native functions declares one arg as SymInt[]? but implementation uses OptionalIntArrayRef instead of OptionalSymIntArrayRef. Adapting the signature everywhere would require significant changes in this function and also underlying functions like compute_output_size which is also used in quantized upsampling... I propose to explore that and apply in a follow-up PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for looking into it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vfdev-5, are you planning on doing this follow-up? This PR means that a single vmap on this operator works correctly, but compositions of vmap and grad won't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, let me try to do that.

Copy link
Collaborator

@kshitij12345 kshitij12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @vfdev-5

@vfdev-5
Copy link
Contributor Author

vfdev-5 commented Sep 28, 2023

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 28, 2023
@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Approval needed from one of the following:
aaronenyeshi, jianyuh, bearzx, yipjustin, glaringlee, ...

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but we should really decompose it, otherwise this means that it doesn't support compositions of vmap+grad

@zou3519
Copy link
Contributor

zou3519 commented Sep 28, 2023

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@vfdev-5 vfdev-5 deleted the add-batch-rule-upsample-aa branch September 30, 2023 10:23
pytorchmergebot pushed a commit that referenced this pull request Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants