Skip to content

Compiled attention test: DoRA downcast under autocast, fp32 model stays fp32 (red since #18099) - #18118

Merged
danielhanchen merged 1 commit into
mainfrom
ci-xformers-reroute-test-autocast
Nov 17, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-xformers-reroute-test-autocast

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

tests/test_attention_dispatch_compiled_block.py::test_rerouted_xformers_keeps_the_fp32_downcast fails on main in the CPU rest shard since #18099 (seen on the staging runs of #18075 and #18076):

E   assert torch.float32 == torch.bfloat16

Cause

#18099 made fp32 Q/K/V with autocast off stay fp32 (rerouted to SDPA) instead of being downcast to bf16 for xformers / flash, because that is a genuine fp32 model. The DoRA downcast still applies under autocast, which is how DoRA reaches this code in training. #18099 moved its own DoRA tests under autocast, but this compiled-path test in another file still called the reroute with plain fp32 inputs and no autocast, so it now sees the intended fp32 result.

The behaviour change is correct; the test predates it.

Fix

  • test_rerouted_xformers_keeps_the_fp32_downcast now takes the autocast decision (_keeps_fp32_attention returns False), so it still checks the DoRA downcast through the compiled reroute. CPU CI cannot enter CUDA autocast, and faking torch.is_autocast_enabled trips dynamo's global autocast guard ("Global autocast state changed while dynamo tracing"), so the decision is patched directly.
  • New test_rerouted_xformers_keeps_an_fp32_model_in_fp32 covers the other half under fullgraph compile: without autocast the reroute returns fp32 and matches the fp32 SDPA reference.

Verification

@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-17T09:31:42.224494Z a139889 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. Chef's kiss.

Reviewed commit: a139889efd

ℹ️ 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 687dccb into main Nov 17, 2026
@danielhanchen
danielhanchen deleted the ci-xformers-reroute-test-autocast branch November 17, 2026 09:32
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