[inductor] dont reuse buffers if it affects peak (#145883)#159530
[inductor] dont reuse buffers if it affects peak (#145883)#159530v0i0 wants to merge 15 commits intogh/v0i0/4/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/159530
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit daa588c with merge base 6f0f4e0 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "topic: not user facing" |
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
eellison
left a comment
There was a problem hiding this comment.
looks good, a couple questions about the tree. would you mind doing one dashboard run ? I believe we expect to see memory improvmenets in timm benchmark.
|
Dashboard run here: https://github.com/pytorch/pytorch/actions/runs/16895400336 |
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy chenyang78 kadeng muchulee8 amjames chauhang aakhundov coconutruben [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 |
Merge failedReason: HTTP Error 504: Gateway Timeout Details for Dev Infra teamRaised by workflow job |
| inp = torch.randn(100, 100, device=self.device) | ||
| self.assertFalse(CommonTemplate._is_triggering_buffer_reuse(fn, inp)) | ||
|
|
||
| def test_allow_reuse_active_if_under_peak(self): |
There was a problem hiding this comment.
There was a problem hiding this comment.
this does not reproduce for me. could you file an issue with more details?
this is what main looks like for me:
^[[A(/data/users/mhoehnerbach/branches/check-dont-reuse/.venv) [mhoehnerbach@devvm7497.cco0 ~/local/branches/check-dont-reuse (check-dont-reuse)]$ python -m pytest -v -k reuse test/inductor/test_torchinductor_dynamic_shapes.py
============================================================================================================================= test session starts ==============================================================================================================================
platform linux -- Python 3.12.11, pytest-7.3.2, pluggy-1.6.0 -- /data/users/mhoehnerbach/branches/check-dont-reuse/.venv/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/data/users/mhoehnerbach/branches/check-dont-reuse/.hypothesis/examples')
rootdir: /data/users/mhoehnerbach/branches/check-dont-reuse
configfile: pytest.ini
plugins: xdoctest-1.1.0, hypothesis-5.35.1, xdist-3.3.1, subtests-0.13.1, rerunfailures-14.0, flakefinder-1.1.0, cpp-2.3.0
collected 1816 items / 1812 deselected / 4 selected
Running 4 items in this shard
test/inductor/test_torchinductor_dynamic_shapes.py::DynamicShapesCpuTests::test_aliased_buffer_reuse_dynamic_shapes_cpu PASSED [2.0221s] [ 25%]
test/inductor/test_torchinductor_dynamic_shapes.py::DynamicShapesCpuTests::test_reuse_buffers_with_aliasing_dynamic_shapes_cpu PASSED [2.2129s] [ 50%]
test/inductor/test_torchinductor_dynamic_shapes.py::DynamicShapesGPUTests::test_aliased_buffer_reuse_dynamic_shapes_cuda PASSED [1.1616s] [ 75%]
test/inductor/test_torchinductor_dynamic_shapes.py::DynamicShapesGPUTests::test_reuse_buffers_with_aliasing_dynamic_shapes_cuda PASSED [3.4464s] [100%]
===================================================================================================================== 4 passed, 1812 deselected in 14.94s ======================================================================================================================
There was a problem hiding this comment.
Looks like another commit caused the failure. It's gone with latest main.
…torch#159530) Pull Request resolved: pytorch#159530 Approved by: https://github.com/eellison
) (pytorch#159530)" This reverts commit 3be70dc. Reverted pytorch#159530 on behalf of https://github.com/clee2000 due to newly added test fail internally D80316528, probably just a targets change, but also imo the tests should probably go into a testcase class from common or inductor utils. While I'm pretty sure CI can run the globally defined ones, theres some CI related functionality that on the testcase class that CI benefits from ([comment](pytorch#159530 (comment)))
|
is there any way to turn this off @v0i0 ? |
hey @hl475! there is no config for it currently, but you can monkey patch it out, e.g. what sort of issues are you experiencing? the intention is for this to be a good optimization everywhere. |
…62300) As titled, this PR ensures peak memory is estimated only when buffer reuse is enabled. Without this config, some nodes' successor nodes are eliminated from memory estimation after inductor bucketing, which can cause errors. The original codegen peak memory estimation code is from this PR: #159530 Pull Request resolved: #162300 Approved by: https://github.com/eellison, https://github.com/v0i0
…torch#162300) As titled, this PR ensures peak memory is estimated only when buffer reuse is enabled. Without this config, some nodes' successor nodes are eliminated from memory estimation after inductor bucketing, which can cause errors. The original codegen peak memory estimation code is from this PR: pytorch#159530 Pull Request resolved: pytorch#162300 Approved by: https://github.com/eellison, https://github.com/v0i0
…torch#159530) Pull Request resolved: pytorch#159530 Approved by: https://github.com/eellison
) (pytorch#159530)" This reverts commit 3be70dc. Reverted pytorch#159530 on behalf of https://github.com/clee2000 due to newly added test fail internally D80316528, probably just a targets change, but also imo the tests should probably go into a testcase class from common or inductor utils. While I'm pretty sure CI can run the globally defined ones, theres some CI related functionality that on the testcase class that CI benefits from ([comment](pytorch#159530 (comment)))
…torch#159530) Pull Request resolved: pytorch#159530 Approved by: https://github.com/eellison
…torch#162300) As titled, this PR ensures peak memory is estimated only when buffer reuse is enabled. Without this config, some nodes' successor nodes are eliminated from memory estimation after inductor bucketing, which can cause errors. The original codegen peak memory estimation code is from this PR: pytorch#159530 Pull Request resolved: pytorch#162300 Approved by: https://github.com/eellison, https://github.com/v0i0
…torch#162300) As titled, this PR ensures peak memory is estimated only when buffer reuse is enabled. Without this config, some nodes' successor nodes are eliminated from memory estimation after inductor bucketing, which can cause errors. The original codegen peak memory estimation code is from this PR: pytorch#159530 Pull Request resolved: pytorch#162300 Approved by: https://github.com/eellison, https://github.com/v0i0
…torch#162300) As titled, this PR ensures peak memory is estimated only when buffer reuse is enabled. Without this config, some nodes' successor nodes are eliminated from memory estimation after inductor bucketing, which can cause errors. The original codegen peak memory estimation code is from this PR: pytorch#159530 Pull Request resolved: pytorch#162300 Approved by: https://github.com/eellison, https://github.com/v0i0
…torch#162300) As titled, this PR ensures peak memory is estimated only when buffer reuse is enabled. Without this config, some nodes' successor nodes are eliminated from memory estimation after inductor bucketing, which can cause errors. The original codegen peak memory estimation code is from this PR: pytorch#159530 Pull Request resolved: pytorch#162300 Approved by: https://github.com/eellison, https://github.com/v0i0
Stack from ghstack (oldest at bottom):
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben