8000 [PT2][memory] add missing dependencies due to mutations by xuanzhang816 · Pull Request #153569 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[PT2][memory] add missing dependencies due to mutations #153569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: gh/xuanzhang816/13/base
Choose a base branch
from

Conversation

xuanzhang816
Copy link
Contributor
@xuanzhang816 xuanzhang816 commented May 14, 2025

Stack from ghstack (oldest at bottom):

This PR adds the missing data dependency due to mutations (illustrated in the figure below).
image

See this doc with testing details [internal only]

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov

[ghstack-poisoned]
Copy link
pytorch-bot bot commented May 14, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

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

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

xuanzhang816 added a commit that referenced this pull request May 14, 2025
ghstack-source-id: 4fe04e0
Pull Request resolved: #153569
@xuanzhang816 xuanzhang816 changed the title add dependencies due to mutations [PT2][memory] add dependencies due to mutations May 14, 2025
@xuanzhang816
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label May 14, 2025
@xuanzhang816 xuanzhang816 requested review from yf225 and eellison May 14, 2025 20:54
@xuanzhang816 xuanzhang816 changed the title [PT2][memory] add dependencies due to mutations [PT2][memory] add missing dependencies due to mutations May 14, 2025
Comment on lines 197 to 201
if dep.name in name_to_buf:
buf = name_to_buf[dep.name]
if buf.get_mutations():
mutated_buf_name = buf.get_mutations()[0]
dep_name_to_succ_nodes[mutated_buf_name].add(node)
Copy link
Contributor

Choose a reason for hiding this comment

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

These should already be modeled via weak deps. can we use those instead ?

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 have a code pointer for get to a node's weak dependency? Seems that by the time of the memory reorder pass, weak dependencies are pruned?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we re-add them generically so that they work for all of the reordering passes, not just memory ? cc @BoyuanFeng who ran into this recently as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add in compute_dependencies()?
Also, what is the unit test to repro the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, I was not aware of this function, thanks for the link and let me check on this.

For repro and unit test, I don't have one yet. I will write one that is related to mutations.

This PR adds the missing data dependency due to mutations (illustrated in the figure below).
![image](https://github.com/user-attachments/assets/38b629fa-56d3-40e3-879f-cd101adce034)


See [this doc](https://docs.google.com/document/d/1lkKulwIb-fYL_p8jn1SD6Lh1PoAKBgpBsU5sAH80leI/edit?tab=t.0#bookmark=id.w3n4k1y4rdz8) with testing details [internal only]

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
xuanzhang816 added a commit that referenced this pull request May 14, 2025
ghstack-source-id: 2402a8e
Pull Request resolved: #153569
This PR adds the missing data dependency due to mutations (illustrated in the figure below).
![image](https://github.com/user-attachments/assets/38b629fa-56d3-40e3-879f-cd101adce034)


See [this doc](https://docs.google.com/document/d/1lkKulwIb-fYL_p8jn1SD6Lh1PoAKBgpBsU5sAH80leI/edit?tab=t.0#bookmark=id.w3n4k1y4rdz8) with testing details [internal only]

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
xuanzhang816 added a commit that referenced this pull request May 17, 2025
ghstack-source-id: ac0b5a7
Pull Request resolved: #153569
This PR adds the missing data dependency due to mutations (illustrated in the figure below).
![image](https://github.com/user-attachments/assets/38b629fa-56d3-40e3-879f-cd101adce034)


See [this doc](https://docs.google.com/document/d/1lkKulwIb-fYL_p8jn1SD6Lh1PoAKBgpBsU5sAH80leI/edit?tab=t.0#bookmark=id.w3n4k1y4rdz8) with testing details [internal only]

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov

[ghstack-poisoned]
xuanzhang816 added a commit that referenced this pull request May 17, 2025
ghstack-source-id: 88b7e8d
Pull Request resolved: #153569
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.

3 participants
0