Skip to content

MoE grouped GEMM: no lock on cached autotuner launches; read the SM count once per card - #14605

Merged
danielhanchen merged 2 commits into
mainfrom
moe-autotuner-warm-path
Oct 22, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
moe-autotuner-warm-path

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Follow-up to #14490 from a post-merge review. #14490 wrapped every grouped GEMM autotuner launch on a multi-GPU host in a per-GPU-model lock, so identical cards would tune a new shape once. The lock was also held on cache hits: every launch paid it (about 0.5 us more per call), and a cold shape being tuned on one card blocked already-tuned launches on an identical card until the benchmark finished.

What changes

  • No lock. Per-card tuner copies still share one results cache per GPU model, so a shape tuned on one card is reused by every identical card. A cached launch never waits on another card. Two identical cards hitting the same cold shape at the same instant may both tune it, which is what every multi-GPU host did before MoE grouped GEMM: share autotuners across identical cards; fix the TMA test on one-GPU hosts and macOS #14490.
  • SM count read once per card. The forward, dX and dW launchers called torch.cuda.get_device_properties(...) on every launch (three per MoE layer per step); it is now cached per device index, since it cannot change within a process.

Single-GPU hosts are unchanged (they never used the per-card copies).

Tests

  • tests/test_grouped_gemm_mixed_tma_device.py: test_identical_cards_launch_concurrently (two cached launches on identical cards must be inside run at once; main fails with BrokenBarrierError because the lock serializes them) and test_sm_count_is_read_once_per_card (fails on main). The shared-cache, separate-model and configs-follow tests still pass.
  • MoE CPU suites (11 files): main 225 passed / 48 skipped, this branch 226 / 48 (one new test), 0 failures on both.
  • B200, base and head interleaved: forward, dX and dW with autotune off and on give the identical output hash on every run.

… SM count once per card

Per-card autotuner copies keep sharing one results cache per GPU model, but a
cached launch on one card no longer waits behind another card's run or tuning.
multi_processor_count is read once per device instead of on every launch.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T05:21:01.694212Z eebb2cc 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. More of your lovely PRs please.

Reviewed commit: eebb2cc0f5

ℹ️ 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 b2ba86a into main Oct 22, 2026
@danielhanchen
danielhanchen deleted the moe-autotuner-warm-path branch October 22, 2026 06:40
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