[Bugfix][Dynamo] Fix einops 0.6.1 with backwards patch#177165
[Bugfix][Dynamo] Fix einops 0.6.1 with backwards patch#177165Lucaskabela wants to merge 2 commits intomainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/177165
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 6 Pending, 3 Unrelated FailuresAs of commit 5c10795 with merge base f249065 ( NEW FAILURE - The following job has failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following job failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
|
Did you test this on different einops versions? |
|
Yep this is covered with the @parametrize("version", [einops_version_sanitized]) n the unit test |
|
@pytorchbot label "topic: not user facing" |
|
Would like to get @guilhermeleobas's eyes on this too |
|
@Lucaskabela It seems that only einops 0.6.1 is crashing? If so, can you restrict the fix to this version? |
I backtested with einops==0.6.0 - if we restrict to only patching for einops 0.6.1, it fails with the same symint error like: lambda: unimplemented(
File "/data/users/lucaskabela/pytorch/torch/_dynamo/exc.py", line 632, in unimplemented
raise Unsupported(
torch._dynamo.exc.TorchRuntimeError: RuntimeError when making fake tensor call
Explanation: Dynamo failed to run FX node with fake tensors: call_function <function repeat at 0x7f895e60b7f0>(*(FakeTensor(..., size=(s48, s86, s93)), 'a b c -> a b c 4'), **{}): got TypeError('unhashable type: non-nested SymInt')
Hint: Your code may result in an error when running in eager. Please double check that your code doesn't contain a similar error when actually running eager/uncompiled. You can do this by removing the `torch.compile` call, or by using `torch.compiler.set_stance("force_eager")`.
Developer debug context:
For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb4315.html
from user code:
File "/data/users/lucaskabela/pytorch/test/dynamo/test_einops.py", line 59, in forward
x_abcd = repeat(x_abc, suf("a b c -> a b c 4"))So imo the correct thing to do is just backport this for all versions <=0.6.1 |
|
Can you update |
| else: | ||
| einops_version = "none" | ||
| einops_version_sanitized = einops_version.replace(".", "_") | ||
| HAS_EINOPS_PACK = HAS_EINOPS and hasattr(einops, "pack") |
There was a problem hiding this comment.
pack/unpack not defined on 0.5.0 so we have a sanity patch here
|
@guilhermeleobas - updated with 0.5.0 on here so ready for another look! |
|
@pytorchmergebot merge -i |
Merge startedYour change will be merged while ignoring the following 4 checks: pull / linux-jammy-py3.10-gcc11 / test (distributed, 1, 2, lf.linux.2xlarge), inductor / inductor-cpu-test / test (cpu_inductor_torchbench, 1, 2, linux.2xlarge.amx, unstable), inductor / unit-test / inductor-test / test (inductor_cpp_wrapper, 2, 2, linux.g5.4xlarge.nvidia.gpu), torchtitan-test / torchtitan-x-pytorch-test / test (torchtitan_features_integration, 1, 1, linux.g5.48xlarge.nvidia.gpu) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
## Summary Adds a `workflow_dispatch` workflow that the autorevert system can trigger when it detects an early failure pattern. Claude Opus 4.6 analyzes the suspect commit's diff, failed job logs, and PyTorch source code to determine whether the commit actually caused the CI failures. Returns a structured JSON verdict as an artifact: - **revert** — causal chain found, proceed to revert immediately - **unsure** — inconclusive, continue with restart-to-confirm (default behavior unchanged) - **not_related** — failures unrelated to the change, ignore this signal - **garbage** — signal is unreliable (infra flake, driver crash), suppress for ~2 hours Design doc: https://docs.google.com/document/d/1BA9B7cIIKiapI37fSFGDD7D0F-VwMyRKJW0PoS0KkbY/edit ## Evaluation Results (13/13 correct verdicts) Prototyped and tested on [pytorch/ciforge](https://github.com/pytorch/ciforge). Results across diverse failure types: ### Round 1 (2026-03-12) — 4/4 correct | Test Case | PR | Failure | Expected | Actual | Job | |-----------|-----|---------|----------|--------|-----| | Doc-only change | #177288 | pca_lowrank stride mismatch | not_related | **not_related @ 0.99** | [job](https://github.com/pytorch/ciforge/actions/runs/23016718498) | | Dynamo einops fix | #177165 | detectron2 graph_breaks + test_is_nonzero_mps | not_related | **not_related @ 0.93** | [job](https://github.com/pytorch/ciforge/actions/runs/23016730498) | | MPS cdouble guard | #176985 | test_is_nonzero_mps + pca_lowrank | revert | **revert @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23016740133) | | Lint missing import | #176613 | Lint / lintrunner-noclang-all | revert | **revert @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23013529685) | ### Round 2 (2026-03-13, automated hourly loop) — 9/9 correct (1 cancelled) | Timestamp | PR | Signal Key | Expected | Actual | Job | |-----------|-----|-----------|----------|--------|-----| | 03:12Z | #176613 | Lint / lintrunner-noclang-all | revert | **revert @ 0.98** | [job](https://github.com/pytorch/ciforge/actions/runs/23034497618) | | 03:12Z | #176613 | fsdp/test_fully_shard_comm (test exec) | revert | **revert @ 0.98** | [job](https://github.com/pytorch/ciforge/actions/runs/23034499988) | | 09:11Z | #177273 | test-timeout-270min (infra) | — | *cancelled* | [job](https://github.com/pytorch/ciforge/actions/runs/23043982417) | | 10:12Z | #176019 | AllenaiLongformerBase fail_to_run (periodic) | garbage | **garbage @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23046142800) | | 10:12Z | #176019 | detectron2_fcos IMPROVED (periodic) | not_related | **not_related @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23046144261) | | 11:10Z | #176019 | functorch_dp_cifar10 fail_accuracy (periodic) | not_related | **not_related @ 0.93** | [job](https://github.com/pytorch/ciforge/actions/runs/23048173319) | | 11:10Z | #176019 | basic_gnn_edgecnn IMPROVED (periodic) | not_related | **not_related @ 0.92** | [job](https://github.com/pytorch/ciforge/actions/runs/23048174698) | | 15:09Z | #177096 | S3 PutObject IAM denied - ROCm gfx950 (infra) | garbage | **garbage @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23057146500) | | 16:09Z | #176019 | vit_base_patch16_siglip_256 fail_to_run (periodic) | not_related | **not_related @ 0.97** | [job](https://github.com/pytorch/ciforge/actions/runs/23059634364) | | 16:09Z | #176019 | shufflenet_v2_x1_0 fail_accuracy (periodic) | not_related | **not_related @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23059635765) | ### Summary by verdict type | Verdict | Count | Correct | Avg Confidence | |---------|-------|---------|----------------| | revert | 4 | 4/4 | 0.97 | | garbage | 2 | 2/2 | 0.95 | | not_related | 7 | 7/7 | 0.94 | ## Test plan - [x] Prototyped and tested on pytorch/ciforge with 13 real trunk failure cases - [x] Verified structured JSON output matches schema - [x] Verified verdict artifact uploads correctly - [ ] Trigger via GitHub UI with `workflow_dispatch` on pytorch/pytorch to validate bedrock environment works - [ ] Integrate dispatch call into autorevert lambda (follow-up) Pull Request resolved: #177404 Approved by: https://github.com/wdvr
## Summary Adds a `workflow_dispatch` workflow that the autorevert system can trigger when it detects an early failure pattern. Claude Opus 4.6 analyzes the suspect commit's diff, failed job logs, and PyTorch source code to determine whether the commit actually caused the CI failures. Returns a structured JSON verdict as an artifact: - **revert** — causal chain found, proceed to revert immediately - **unsure** — inconclusive, continue with restart-to-confirm (default behavior unchanged) - **not_related** — failures unrelated to the change, ignore this signal - **garbage** — signal is unreliable (infra flake, driver crash), suppress for ~2 hours Design doc: https://docs.google.com/document/d/1BA9B7cIIKiapI37fSFGDD7D0F-VwMyRKJW0PoS0KkbY/edit ## Evaluation Results (13/13 correct verdicts) Prototyped and tested on [pytorch/ciforge](https://github.com/pytorch/ciforge). Results across diverse failure types: ### Round 1 (2026-03-12) — 4/4 correct | Test Case | PR | Failure | Expected | Actual | Job | |-----------|-----|---------|----------|--------|-----| | Doc-only change | pytorch#177288 | pca_lowrank stride mismatch | not_related | **not_related @ 0.99** | [job](https://github.com/pytorch/ciforge/actions/runs/23016718498) | | Dynamo einops fix | pytorch#177165 | detectron2 graph_breaks + test_is_nonzero_mps | not_related | **not_related @ 0.93** | [job](https://github.com/pytorch/ciforge/actions/runs/23016730498) | | MPS cdouble guard | pytorch#176985 | test_is_nonzero_mps + pca_lowrank | revert | **revert @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23016740133) | | Lint missing import | pytorch#176613 | Lint / lintrunner-noclang-all | revert | **revert @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23013529685) | ### Round 2 (2026-03-13, automated hourly loop) — 9/9 correct (1 cancelled) | Timestamp | PR | Signal Key | Expected | Actual | Job | |-----------|-----|-----------|----------|--------|-----| | 03:12Z | pytorch#176613 | Lint / lintrunner-noclang-all | revert | **revert @ 0.98** | [job](https://github.com/pytorch/ciforge/actions/runs/23034497618) | | 03:12Z | pytorch#176613 | fsdp/test_fully_shard_comm (test exec) | revert | **revert @ 0.98** | [job](https://github.com/pytorch/ciforge/actions/runs/23034499988) | | 09:11Z | pytorch#177273 | test-timeout-270min (infra) | — | *cancelled* | [job](https://github.com/pytorch/ciforge/actions/runs/23043982417) | | 10:12Z | pytorch#176019 | AllenaiLongformerBase fail_to_run (periodic) | garbage | **garbage @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23046142800) | | 10:12Z | pytorch#176019 | detectron2_fcos IMPROVED (periodic) | not_related | **not_related @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23046144261) | | 11:10Z | pytorch#176019 | functorch_dp_cifar10 fail_accuracy (periodic) | not_related | **not_related @ 0.93** | [job](https://github.com/pytorch/ciforge/actions/runs/23048173319) | | 11:10Z | pytorch#176019 | basic_gnn_edgecnn IMPROVED (periodic) | not_related | **not_related @ 0.92** | [job](https://github.com/pytorch/ciforge/actions/runs/23048174698) | | 15:09Z | pytorch#177096 | S3 PutObject IAM denied - ROCm gfx950 (infra) | garbage | **garbage @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23057146500) | | 16:09Z | pytorch#176019 | vit_base_patch16_siglip_256 fail_to_run (periodic) | not_related | **not_related @ 0.97** | [job](https://github.com/pytorch/ciforge/actions/runs/23059634364) | | 16:09Z | pytorch#176019 | shufflenet_v2_x1_0 fail_accuracy (periodic) | not_related | **not_related @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23059635765) | ### Summary by verdict type | Verdict | Count | Correct | Avg Confidence | |---------|-------|---------|----------------| | revert | 4 | 4/4 | 0.97 | | garbage | 2 | 2/2 | 0.95 | | not_related | 7 | 7/7 | 0.94 | ## Test plan - [x] Prototyped and tested on pytorch/ciforge with 13 real trunk failure cases - [x] Verified structured JSON output matches schema - [x] Verified verdict artifact uploads correctly - [ ] Trigger via GitHub UI with `workflow_dispatch` on pytorch/pytorch to validate bedrock environment works - [ ] Integrate dispatch call into autorevert lambda (follow-up) Pull Request resolved: pytorch#177404 Approved by: https://github.com/wdvr
## Summary Backports the fix from einops 0.7.0 into einops <=0.6.1 via monkeypatching ## Test ```bash python test/dynamo/test_einops.py ``` Pull Request resolved: pytorch#177165 Approved by: https://github.com/mlazos, https://github.com/guilhermeleobas
## Summary Adds a `workflow_dispatch` workflow that the autorevert system can trigger when it detects an early failure pattern. Claude Opus 4.6 analyzes the suspect commit's diff, failed job logs, and PyTorch source code to determine whether the commit actually caused the CI failures. Returns a structured JSON verdict as an artifact: - **revert** — causal chain found, proceed to revert immediately - **unsure** — inconclusive, continue with restart-to-confirm (default behavior unchanged) - **not_related** — failures unrelated to the change, ignore this signal - **garbage** — signal is unreliable (infra flake, driver crash), suppress for ~2 hours Design doc: https://docs.google.com/document/d/1BA9B7cIIKiapI37fSFGDD7D0F-VwMyRKJW0PoS0KkbY/edit ## Evaluation Results (13/13 correct verdicts) Prototyped and tested on [pytorch/ciforge](https://github.com/pytorch/ciforge). Results across diverse failure types: ### Round 1 (2026-03-12) — 4/4 correct | Test Case | PR | Failure | Expected | Actual | Job | |-----------|-----|---------|----------|--------|-----| | Doc-only change | pytorch#177288 | pca_lowrank stride mismatch | not_related | **not_related @ 0.99** | [job](https://github.com/pytorch/ciforge/actions/runs/23016718498) | | Dynamo einops fix | pytorch#177165 | detectron2 graph_breaks + test_is_nonzero_mps | not_related | **not_related @ 0.93** | [job](https://github.com/pytorch/ciforge/actions/runs/23016730498) | | MPS cdouble guard | pytorch#176985 | test_is_nonzero_mps + pca_lowrank | revert | **revert @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23016740133) | | Lint missing import | pytorch#176613 | Lint / lintrunner-noclang-all | revert | **revert @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23013529685) | ### Round 2 (2026-03-13, automated hourly loop) — 9/9 correct (1 cancelled) | Timestamp | PR | Signal Key | Expected | Actual | Job | |-----------|-----|-----------|----------|--------|-----| | 03:12Z | pytorch#176613 | Lint / lintrunner-noclang-all | revert | **revert @ 0.98** | [job](https://github.com/pytorch/ciforge/actions/runs/23034497618) | | 03:12Z | pytorch#176613 | fsdp/test_fully_shard_comm (test exec) | revert | **revert @ 0.98** | [job](https://github.com/pytorch/ciforge/actions/runs/23034499988) | | 09:11Z | pytorch#177273 | test-timeout-270min (infra) | — | *cancelled* | [job](https://github.com/pytorch/ciforge/actions/runs/23043982417) | | 10:12Z | pytorch#176019 | AllenaiLongformerBase fail_to_run (periodic) | garbage | **garbage @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23046142800) | | 10:12Z | pytorch#176019 | detectron2_fcos IMPROVED (periodic) | not_related | **not_related @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23046144261) | | 11:10Z | pytorch#176019 | functorch_dp_cifar10 fail_accuracy (periodic) | not_related | **not_related @ 0.93** | [job](https://github.com/pytorch/ciforge/actions/runs/23048173319) | | 11:10Z | pytorch#176019 | basic_gnn_edgecnn IMPROVED (periodic) | not_related | **not_related @ 0.92** | [job](https://github.com/pytorch/ciforge/actions/runs/23048174698) | | 15:09Z | pytorch#177096 | S3 PutObject IAM denied - ROCm gfx950 (infra) | garbage | **garbage @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23057146500) | | 16:09Z | pytorch#176019 | vit_base_patch16_siglip_256 fail_to_run (periodic) | not_related | **not_related @ 0.97** | [job](https://github.com/pytorch/ciforge/actions/runs/23059634364) | | 16:09Z | pytorch#176019 | shufflenet_v2_x1_0 fail_accuracy (periodic) | not_related | **not_related @ 0.95** | [job](https://github.com/pytorch/ciforge/actions/runs/23059635765) | ### Summary by verdict type | Verdict | Count | Correct | Avg Confidence | |---------|-------|---------|----------------| | revert | 4 | 4/4 | 0.97 | | garbage | 2 | 2/2 | 0.95 | | not_related | 7 | 7/7 | 0.94 | ## Test plan - [x] Prototyped and tested on pytorch/ciforge with 13 real trunk failure cases - [x] Verified structured JSON output matches schema - [x] Verified verdict artifact uploads correctly - [ ] Trigger via GitHub UI with `workflow_dispatch` on pytorch/pytorch to validate bedrock environment works - [ ] Integrate dispatch call into autorevert lambda (follow-up) Pull Request resolved: pytorch#177404 Approved by: https://github.com/wdvr
Summary
Backports the fix from einops 0.7.0 into einops <=0.6.1 via monkeypatching
Test
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo