Skip to content

Conversation

@aorenste
Copy link
Contributor

@aorenste aorenste commented May 2, 2025

Stack from ghstack (oldest at bottom):

Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they pass.

Perf

Instruction Counter Benchmark:

  • 26% win on add_loop_eager_dynamic
  • 13% win on add_loop_inductor_dynamic_gpu

Perf Dashboard

Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

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

Differential Revision: D75467694

Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented May 2, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit c5661a7 with merge base b394c6e (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

aorenste added a commit that referenced this pull request May 2, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: 870317f
Pull Request resolved: #152662
aorenste added a commit that referenced this pull request May 2, 2025
…key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: 0dc4211
Pull Request resolved: #152662
aorenste added a commit that referenced this pull request May 2, 2025
…ds_tls in cache key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
…key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
…ds_tls in cache key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
…key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: 0dc4211
Pull Request resolved: #152662
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
…ds_tls in cache key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
…key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 2, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: 35ead1d
Pull Request resolved: #152662
@aorenste aorenste added the topic: not user facing topic category label May 5, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 5, 2025
…ds_tls in cache key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 5, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: f9927a5
Pull Request resolved: #152662
aorenste added a commit that referenced this pull request May 5, 2025
…key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 7, 2025
…ds_tls in cache key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv voznesenskym penguinwu Guobing-Chen XiaobingSuper zhuhaozhe blzheng jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 7, 2025
…key"

ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.




cc ezyang SherlockNoMad EikanWang jgong5 wenzhe-nrv voznesenskym penguinwu Guobing-Chen XiaobingSuper zhuhaozhe blzheng jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request May 8, 2025
ShapeEnv.evaluate_expr() behaves differently based on the (tls) global "suppress_guards" - so its cache key needs to include that value.

This came up because #152662 triggered it in the test `test/dynamo/test_exc.py::ExcTests::test_trigger_bisect_on_error` - fixing this caused that test to work again.

Pull Request resolved: #152661
Approved by: https://github.com/laithsakka
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

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

[ghstack-poisoned]
pytorch-bot bot pushed a commit that referenced this pull request May 27, 2025
Summary:
This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Approved by: https://github.com/anijain2305

Test Plan:
contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/7d11c61c26c596076613aa0111892f7cbccae32e

Test plan from GitHub:
Reran the tests listed in T196779132 and they pass.

## Perf
### Instruction Counter Benchmark:
- 26% win on add_loop_eager_dynamic
- 13% win on add_loop_inductor_dynamic_gpu
### Perf Dashboard
Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

Differential Revision: D75413218
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they pass.

## Perf
### Instruction Counter Benchmark:
- 26% win on add_loop_eager_dynamic
- 13% win on add_loop_inductor_dynamic_gpu
### Perf Dashboard
Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 27, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: 632955c
Pull Request resolved: #152662
@aorenste
Copy link
Contributor Author

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

@aorenste
Copy link
Contributor Author

@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: Command git -C /home/runner/work/pytorch/pytorch cherry-pick -x 3607a432aa0f4413b4308fe74bd5b5c88843ec89 returned non-zero exit code 1

Auto-merging benchmarks/dynamo/pr_time_benchmarks/expected_results.csv
CONFLICT (content): Merge conflict in benchmarks/dynamo/pr_time_benchmarks/expected_results.csv
Auto-merging test/dynamo/test_subclasses.py
Auto-merging torch/fx/experimental/symbolic_shapes.py
error: could not apply 3607a432aa0... Re-enable FakeTensor caching for SymInts
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Details for Dev Infra team Raised by workflow job

Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they pass.

## Perf
### Instruction Counter Benchmark:
- 26% win on add_loop_eager_dynamic
- 13% win on add_loop_inductor_dynamic_gpu
### Perf Dashboard
Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

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

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 28, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: e3e9c8a
Pull Request resolved: #152662
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they pass.

## Perf
### Instruction Counter Benchmark:
- 26% win on add_loop_eager_dynamic
- 13% win on add_loop_inductor_dynamic_gpu
### Perf Dashboard
Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

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

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 28, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: 424b672
Pull Request resolved: #152662
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they pass.

## Perf
### Instruction Counter Benchmark:
- 26% win on add_loop_eager_dynamic
- 13% win on add_loop_inductor_dynamic_gpu
### Perf Dashboard
Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

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

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

[ghstack-poisoned]
aorenste added a commit that referenced this pull request May 29, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

Tests seem to pass so I'm assuming some dynamic shape work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they seem to pass.

ghstack-source-id: 992c1d9
Pull Request resolved: #152662
# with self.assertRaisesRegex(
# RuntimeError, escape("Could not guard on data-dependent expression")
# ):
# export(Module(identity), inputs, strict=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to leave line 426 uncommented? i.e. testing that we can export Module(identity) now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really know what the test is trying to test so I didn't want to make the decision to "lock in" behavior that might be wrong - but if you think I should uncomment it I'm happy to do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really know what the test is trying to test so I didn't want to make the decision to "lock in" behavior that might be wrong - but if you think I should uncomment it I'm happy to do that.

commenting out is fine then. Thanks!

@aorenste
Copy link
Contributor Author

@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

@laithsakka
Copy link
Contributor

FYI for some reason this increase the overhead for this benchmark
"mm_loop_inductor_dynamic_gpu": 6.7779857975383,

the benchmark is not enabeled so its ok JUST an FYI
in total it bring good wins

{
  "add_loop_eager_dynamic": -25.218076068856,
  "add_loop_inductor_dynamic_gpu": -12.777764631367,
  "mm_loop_inductor_dynamic_gpu": 6.7779857975383,
  "update_hint_regression": -2.3394665327972
}

but it will be interesting to at least know why is that overhead

@laithsakka
Copy link
Contributor

Screenshot 2025-06-01 at 4 10 55 PM

nWEIdia pushed a commit to nWEIdia/pytorch that referenced this pull request Jun 2, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they pass.

## Perf
### Instruction Counter Benchmark:
- 26% win on add_loop_eager_dynamic
- 13% win on add_loop_inductor_dynamic_gpu
### Perf Dashboard
Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

Differential Revision: [D75467694](https://our.internmc.facebook.com/intern/diff/D75467694)
Pull Request resolved: pytorch#152662
Approved by: https://github.com/anijain2305
iupaikov-amd pushed a commit to ROCm/pytorch that referenced this pull request Jun 4, 2025
Summary:

This backs out D60320595 which itself turned off FakeTensor caching when a SymInt was present.

There has been a lot of dynamic shape fixes done this year and tests pass so I'm assuming some of that work fixed what was breaking previously.

Test Plan: Reran the tests listed in T196779132 and they pass.

## Perf
### Instruction Counter Benchmark:
- 26% win on add_loop_eager_dynamic
- 13% win on add_loop_inductor_dynamic_gpu
### Perf Dashboard
Compilation Latency wins across the board but especially strong on the dynamic tests (like cudagraphs_dynamic) - for example MobileBertForMaskedLM went from 66s -> 50s.

Differential Revision: [D75467694](https://our.internmc.facebook.com/intern/diff/D75467694)
Pull Request resolved: pytorch#152662
Approved by: https://github.com/anijain2305
@github-actions github-actions bot deleted the gh/aorenste/226/head branch July 2, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants