Skip to content

Wide-head SDPA compile test: seeded inputs, fp32 assert_close instead of a 1e-6 atol (intermittent m-r failure) - #18153

Merged
danielhanchen merged 1 commit into
mainfrom
ci-wide-head-compile-tolerance
Nov 17, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-wide-head-compile-tolerance

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

studio/backend/tests/test_rocm_windows_wide_head_sdpa.py::test_guarded_wide_head_compiles_fullgraph[inductor] (added in #18122) fails intermittently in the Studio m-r shard on unrelated PRs (seen on the staging run of #18075):

tests/test_rocm_windows_wide_head_sdpa.py:154: in test_guarded_wide_head_compiles_fullgraph
    assert torch.allclose(got, want, atol = 1e-6)
E   assert False

Cause

The test compares the guarded SDPA call in eager (math backend) with the same call compiled fullgraph by Inductor. Inductor lowers the math SDPA to its own CPU kernel, so the two agree to fp32 rounding, not bit for bit. On this host the gap on a 512-wide head is already up to 8.3e-7 (seeds 0 to 3), right at the fixed atol = 1e-6, and the inputs were unseeded, so a draw on a different CPU (CI runners vary) can land just over it. The guard is fine; the bound was too tight for two different kernels.

Fix

  • Seeded inputs (torch.Generator().manual_seed(0)), so a failure is reproducible.
  • torch.testing.assert_close(got, want) with the fp32 defaults (atol 1e-5, rtol 1.3e-6) and a comment saying why it is not bitwise.

Verification

  • tests/test_rocm_windows_wide_head_sdpa.py: 11 passed, twice.
  • Sabotage: comparing against a non-causal eager result makes both compiles_fullgraph cases fail, so the check still catches a wrong answer.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T13:50:47.767609Z 81fc05b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 81fc05b831

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 7915b04 into main Nov 17, 2026
@danielhanchen
danielhanchen deleted the ci-wide-head-compile-tolerance branch November 17, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant