Skip to content

Studio INT8 attention: key the strided cuDNN race by the call each card times - #18584

Merged
danielhanchen merged 1 commit into
mainfrom
fix-recheck-strided-race-key
Nov 20, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-recheck-strided-race-key

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

#18140 gave a strided cuDNN incumbent its own INT8 race verdict name, dispatch:_native_cudnn:strided, because the strided call differs from diffusers' contiguous _native_cudnn call. But the name was taken from the marker's class alone. The marker only takes the strided call on the cards it probed and at the dtype it probed; on any other card or dtype plain_qkv declines and the race times diffusers' call. The dispatch install races each module on the load card and on every secondary card (layer split, CFG replica), so a marker for {0} raced on cuda:1 timed the contiguous call and cached that verdict as cuda:1 ... :strided. A marker for {0, 1} then read that verdict on cuda:1, although its real call there is the strided one, and the reverse order had the same mix-up. The INT8 token floor on that card could then come from a different incumbent call than the one the route replaces.

Change

_race_name in diffusion_int8_attention_dispatch.py takes optional card and dtype and keeps the :strided suffix only when the marker's cards contains the card and its probed dtype matches (or is unset). Elsewhere it returns the plain dispatch:_native_cudnn name, so those races share the verdict of the call they actually time. The dispatch install computes the name per raced card with the race dtype. Called without the new arguments, _race_name returns what it did before, and the persisted verdict names are unchanged.

Tests

New tests/test_diffusion_int8_attention_strided_race_key.py, CPU only:

  • test_strided_race_name_follows_the_call_the_card_times: a {0} bf16 marker is :strided on card 0 at bf16, plain on card 1 and plain at fp16; a {0, 1} marker is :strided on card 1. Fails on main, passes here.
  • test_dispatch_race_keys_each_card_by_its_timed_call (3 cases): runs the real dispatch install with a load card and a secondary card, records the verdict name each card races under. {0} bf16 gives strided on 0 and plain on 1; {0, 1} fp16 under a bf16 load gives plain on both. Both fail on main (every card raced as :strided) and pass here. {0, 1} bf16 gives strided on both and passes on main and here.

Differential (test_differential.py, the new file plus test_diffusion_int8_attention_persisted.py and test_diffusion_int8_attention_dispatch.py): DISCRIMINATING, fixed=3, unchanged=68, head_fail=0.

Suite (test_diffusion_qwenimage21_strided_attn.py, test_diffusion_flux3_strided_attn.py, test_diffusion_int8_attention_auto.py, test_diffusion_int8_attention_dispatch.py, test_diffusion_int8_attention_persisted.py, test_diffusion_attention.py, test_diffusion_attention_honest_status.py, test_diffusion_attention_cudnn_head_dim.py): main 272 passed, 1 skipped, 1 failed; this branch 276 passed (the 4 new), 1 skipped, 1 failed. The failing ID is the same on both, test_diffusion_qwenimage21_strided_attn.py::test_attention_hook_installs_on_cudnn_pins, which greps moved source and is fixed separately.

Not proven here

No GPU run. The tests stub the race, so they show which name each card is raced under, not a changed token floor on real hardware. That would take Qwen-Image-2.1 with a cuDNN pin split across two NVIDIA cards, with the strided probe passing on only one of them, comparing the per-card diffusion.int8_attention race log lines on main and here.

…rd times

The dispatch race named a strided cuDNN incumbent dispatch:_native_cudnn:strided
on every card, although the pin only takes the strided call on its probed
cards at its probed dtype. Elsewhere the race times diffusers' contiguous call
and stored that verdict under the strided name, so a pin for cuda:0 and a pin
for cuda:0 and cuda:1 shared one cuda:1 verdict for two different calls.
The name is now chosen per card and dtype.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 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-20T07:01:07.752061Z 8fa6254 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 8fa62545e5

ℹ️ 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 3458770 into main Nov 20, 2026
@danielhanchen
danielhanchen deleted the fix-recheck-strided-race-key branch November 20, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant