KEMBAR78
[BE] Make maybe_aliasing_or_mutating proper tag by tugsbayasgalan · Pull Request #131990 · pytorch/pytorch · GitHub
Skip to content

Conversation

@tugsbayasgalan
Copy link
Contributor

@tugsbayasgalan tugsbayasgalan commented Jul 28, 2024

Stack from ghstack (oldest at bottom):

For better tracking, we need to make maybe aliasing/mutating ops with proper tag. We need to special case native_batch_norm because it is not a CIA but has a wrong schema. I guess native_batch_norm will be removed at some point, so until then we just keep it around.

D60347117

For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Jul 28, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit bc3ffca with merge base a847790 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D60347117

tugsbayasgalan added a commit that referenced this pull request Jul 28, 2024
For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)

ghstack-source-id: 235522623
Pull Request resolved: #131990
@tugsbayasgalan tugsbayasgalan requested a review from bdhirsh July 28, 2024 03:38
CUDA: batch_norm_cuda
MPS: batch_norm_mps
MkldnnCPU: mkldnn_batch_norm
tags: maybe_aliasing_or_mutating
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this, in these cases the schema is just wrong (as opposed to composites, where schema is not meaningful)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean we don't need this tag at all or we need two seperate tags (one for CIA ops that are maybe mutating and one for primitive ops)?

Copy link
Contributor

Choose a reason for hiding this comment

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

This new tag should probably only apply to CIA ops, since those ops are "allowed" to maybe-alias/mutate.

Non-CIA ops that maybe alias/mutate will just give silently wrong results today when run with PT2 (and autograd), so we should probably just fix them instead of giving them a dedicated tag. And and at this point, native_batch_norm is "fixed" in-so-far as we never see the op in graphs we trace anymore, since we see the _native_batch_norm_legit op instead (although @andrewor14 is working on consolidating batch norm ops here #119496)

For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D60347117

tugsbayasgalan added a commit that referenced this pull request Aug 1, 2024
Pull Request resolved: #131990

For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)
ghstack-source-id: 236160755
@github-actions
Copy link
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)

[ghstack-poisoned]
@tugsbayasgalan
Copy link
Contributor Author

@tugsbayasgalan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

For better tracking, we need to make maybe aliasing/mutating ops with proper tag. We need to special case native_batch_norm because it is not a CIA but has a wrong schema. I guess native_batch_norm will be removed at some point, so until then we just keep it around. 

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Nov 19, 2024
Pull Request resolved: #131990

For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)
ghstack-source-id: f97cf8f
For better tracking, we need to make maybe aliasing/mutating ops with proper tag. We need to special case native_batch_norm because it is not a CIA but has a wrong schema. I guess native_batch_norm will be removed at some point, so until then we just keep it around. 

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Nov 21, 2024
Pull Request resolved: #131990

For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)
ghstack-source-id: d75bae5
@tugsbayasgalan
Copy link
Contributor Author

@tugsbayasgalan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.


# We force create native_batch_norm because the below materialization logic
# only applies to CIA ops.
maybe_aliasing_or_mutating_ops = [torch.ops.aten.native_batch_norm.default]
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like you're hardcoding aten.native_batch_norm in two places: both here, and in your helper _should_decompose_because_unsafe_op(op). Can't you just re-use that _should_decompose_because_unsafe_op() helper in ordre to generate this list?

Copy link
Contributor

@bdhirsh bdhirsh left a comment

Choose a reason for hiding this comment

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

left some comments!

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 21, 2024
@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR has internal changes and must be landed via Phabricator! Please try reimporting/rexporting the PR!

Details for Dev Infra team Raised by workflow job

@izaitsevfb
Copy link
Contributor

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR has internal changes and must be landed via Phabricator! Please try reimporting/rexporting the PR!

Details for Dev Infra team Raised by workflow job

@izaitsevfb
Copy link
Contributor

@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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: Meta Internal-Only Changes Check

Details for Dev Infra team Raised by workflow job

@izaitsevfb
Copy link
Contributor

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: Meta Internal-Only Changes Check

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

pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
For better tracking, we need to make maybe aliasing/mutating ops with proper tag. We need to special case native_batch_norm because it is not a CIA but has a wrong schema. I guess native_batch_norm will be removed at some point, so until then we just keep it around.

D60347117
Pull Request resolved: pytorch#131990
Approved by: https://github.com/bdhirsh
Esquains pushed a commit to Esquains/study1 that referenced this pull request Dec 15, 2024
Pull Request resolved: pytorch/pytorch#131990

For better tracking, we need to make maybe aliasing/mutating ops with proper tag.

Differential Revision: [D60347117](https://our.internmc.facebook.com/intern/diff/D60347117/)
ghstack-source-id: 58f8c2f
@github-actions github-actions bot deleted the gh/tugsbayasgalan/227/head branch December 24, 2024 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants