[AOTI] Fix a small buffer mutation issue#169347
[AOTI] Fix a small buffer mutation issue#169347desertfire wants to merge 4 commits intogh/desertfire/614/basefrom
Conversation
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/169347
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 6c7a272 with merge base c6ae757 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. ghstack-source-id: 9840de9 Pull Request resolved: #169347
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo [ghstack-poisoned]
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. ghstack-source-id: 842e21c Pull Request resolved: #169347
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo [ghstack-poisoned]
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. ghstack-source-id: bedd5e1 Pull Request resolved: #169347
| self.named_buffers: dict[str, torch.Tensor] = ( | ||
| const_module.named_buffers if const_module else {} | ||
| ) | ||
| self.mutated_named_buffers: OrderedSet[torch.Tensor] = gm.meta.get( |
There was a problem hiding this comment.
can or should we re-use self.mutated_buffers?
There was a problem hiding this comment.
self.mutated_buffers is only filled as we iterate through the graph, so by the point we check target in self.mutated_buffers, self.mutated_buffers may not have accurate enough mutation information.
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo [ghstack-poisoned]
|
@pytorchbot merge |
Merge startedYour 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 |
Summary: Fix pytorch#169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. Pull Request resolved: pytorch#169347 Approved by: https://github.com/yushangdi
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. Pull Request resolved: #169347 Approved by: https://github.com/yushangdi
Summary: Fix pytorch/pytorch#169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering. ghstack-source-id: 6eec08b Pull Request resolved: pytorch/pytorch#169347
Stack from ghstack (oldest at bottom):
Summary: Fix #169118. A small named buffer can be optimized as inlined constant, but if that named buffer is mutated later on, AOTI can generate wrong code if not respecting the mutation information. This PR fixes the issue by recording mutated_named_buffers when unlifting the input graph and pass to Inductor graph lowering.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo