Skip to content

Skip two SDPA fallback tests on ROCm, where a stale AOTInductor kernel cache breaks them - #23383

Merged
shoumikhin merged 1 commit into
pytorch:mainfrom
shoumikhin:rocm-skip-sdpa-regular-lowering
Oct 3, 2026
Merged

shoumikhin merged 1 commit into
pytorch:mainfrom
shoumikhin:rocm-skip-sdpa-regular-lowering

Conversation

@shoumikhin

@shoumikhin shoumikhin commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What is wrong today

unittest-rocm-gfx950-rocm7.2 fails on main since #23349. Two of its new tests fail on ROCm:

  • test_float_mask_is_not_replaced
  • test_dropout_is_not_replaced

Both export an SDPA call the Triton kernel does not accept, so the replacement pass leaves it to the regular AOTInductor lowering. The pass does that correctly, and the log shows "Skipping SDPA replacement" and "Replaced 0 nodes". The export then fails later, inside AOTInductor's C++ wrapper codegen:

torch._inductor.exc.InductorError: AssertionError: ([torch.bfloat16, torch.float32, torch.float32,
  <class 'sympy.core.numbers.Integer'>], ['in_ptr0', 'out_ptr0', 'xnumel'])

The cause is in AOTInductor, not in these exports. AOTInductor saves each compiled Triton kernel's launch data in one cache for the whole process, keyed only by the kernel name. When a later compile reuses a kernel with the same source, it does not save that data again. So if a different kernel with the same name was compiled in between, its launch data stays in the cache. These tests run in one process after other tests that compile a kernel with the same name, so they get the wrong launch data.

On ROCm, Inductor gives that earlier kernel and these tests' kernel the same name. On CUDA the names differ, which is why these tests pass there. When two models do produce the same kernel name, the same error happens on CUDA too: compiling model B, then model A, then model B again gives exactly this assertion with torch 2.14 on a CUDA GPU.

What this change does

Skips just those two tests on ROCm. This matches how the same file already skips its split-K tests on ROCm. The behavior on CUDA does not change.

The root cause is tracked in pytorch/pytorch#199619. The skip carries a TODO to remove it once that is fixed.

What was tested

  • On a CUDA GPU (Linux aarch64), both tests still run and pass, and the whole file passes, 19 tests.
  • With torch.version.hip set, both tests skip.
  • On the ROCm runner, unittest-rocm-gfx950-rocm7.2 passes: 270 passed, 8 skipped, 0 failed, with both tests skipped. On main the same job fails these two tests.

Copilot AI balanced review requested due to automatic review settings October 3, 2026 01:24
@shoumikhin shoumikhin added the release notes: none Do not include this in the release notes label Oct 3, 2026
@pytorch-bot

pytorch-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 2dc206a with merge base 0b3d26d (image):
💚 Looks good so far! There are no failures yet. 💚

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…them

The tests for SDPA calls the Triton kernel does not accept export each call
through the regular AOTInductor lowering. On ROCm, two of those exports fail
inside AOTInductor's C++ wrapper codegen, after the replacement pass has
correctly left the call alone:

  AssertionError: ([torch.bfloat16, torch.float32, torch.float32, Integer],
                   ['in_ptr0', 'out_ptr0', 'xnumel'])

The calls are SDPA with an additive float mask and SDPA with dropout. A
generated kernel's argument types and names differ in length. The same
exports pass on CUDA, and the other regular-lowering cases pass on ROCm.

Skip just those two tests on ROCm, as the file already does for split-K.

The root cause is tracked in pytorch/pytorch#199619, and the skip carries a
TODO to remove it once that is fixed.
@shoumikhin
shoumikhin force-pushed the rocm-skip-sdpa-regular-lowering branch from bc0338b to 2dc206a Compare October 3, 2026 02:09
Copilot AI balanced review requested due to automatic review settings October 3, 2026 02:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@shoumikhin shoumikhin changed the title Skip two SDPA fallback tests on ROCm, where AOTInductor cannot lower them Skip two SDPA fallback tests on ROCm, where a stale AOTInductor kernel cache breaks them Oct 3, 2026
@shoumikhin
shoumikhin merged commit e229c58 into pytorch:main Oct 3, 2026
257 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rocm CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: rocm release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants