Repository navigation
SM90 grouped 1D2D heuristics, thread-local alignment, MoE precompile, and #455/#478 - #8
Merged
Conversation
A CUDA graph kernel node keeps the same %gridid on every replay. The mega_mhc split barriers tag each execution with %gridid, so after a replay a barrier line still holds encode_state(grid_idx, kNumSplits), which is exactly the state the next replay waits for. A Mix or Norm waiter whose m-block init CTA has not started yet proceeds immediately and reads the previous replay's split partials. Tag executions with an epoch instead. The epoch and an exit count live in the unused tail of the first barrier line, so the host-side buffer is unchanged. Every CTA reads the epoch after cudaGridDependencySynchronize, and the last CTA to retire resets the exit count and advances the epoch. Signed-off-by: lightseek-bot <[email protected]>
The SM90 layout heuristic adds block M candidates of 16 and 32 for small M, but the SM90 FP8 1D1D kernel (FP32-output / k-grouped GEMMs) only supports block M of 64 or 128 (single or double math warpgroups). For M <= 32, the cost model prefers the smaller tile and the JIT compilation then fails on the kernel's static assertion, so e.g. `fp8_gemm_nt` with an FP32 accumulator and `k_grouped_fp8_gemm_nt_contiguous` cannot run for M <= 32 on Hopper. Restrict the 16/32 candidates to the kernels that support them (1D2D and BF16), and add small-M weight-gradient shapes to the test enumeration. Signed-off-by: RunguoLi <[email protected]>
…case - Name the small-M weight-gradient shape next to the other shape tables and reword its comment (the heuristic must not pick block M 16/32). - Add a small-M (m=16) shape to the k-grouped enumeration on SM90, with 8 groups so that TMA multicast stays disabled. Signed-off-by: RunguoLi <[email protected]>
…ecompile - sm90.hpp: use desc.get_expected_m() <= 2048 for 1D2D multicast cluster disable (matching dense Normal behavior while avoiding unpaired 2-CTA clusters on 512-expert grouped GEMMs where per-expert expected_m <= 2048), and use expected_m * expected_num_groups > 64 rather than padded desc.m > 64 for the kShouldOptimize block_n filter. - runtime.hpp: make mk_alignment_for_contiguous_layout thread_local so free-threaded Python 3.14t callers do not race on contiguous grouped layout alignment. - sm90_fp8_gemm_1d2d.hpp / gemm.hpp / ninetyfive-wheels.yml: add precompile_m_grouped_fp8_gemm_nt_contiguous and precompile Qwen4's 512-expert down ([512, 2560, 640]) and LoRA gate/up ([512, 1280, 2560]) shapes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates
ninetyfive-wheelswith fixes for SM90 grouped MoE heuristics, free-threaded Python 3.14t alignment safety, ahead-of-time precompilation of Qwen4's MoEdown/ LoRAgate_upgrouped GEMMs, and two upstream bugfix cherry-picks (#455,#478).Changes
1D2DHeuristics (csrc/jit_kernels/heuristics/sm90.hpp):#6(disable_multicast) fromdesc.gemm_type == GemmType::Normal and desc.m <= 2048todesc.get_expected_m() <= 2048(identical onNormal, and disables 2-CTA clusters onMGroupedContiguousWithPsumLayoutwhen per-expertexpected_m <= 2048wherenum_m_blocks <= 1or odd dynamically disables multicast inscheduler/gemm.cuhwhile still paying 2-CTA cluster barrier waits).#7(kShouldOptimizeblock_nfilter) fromdesc.m > 64(padded buffer capacity) todesc.get_expected_m() * desc.get_expected_num_groups() > 64.csrc/jit_kernels/heuristics/runtime.hpp):mk_alignment_for_contiguous_layoutinline static thread_local intso concurrent Python 3.14t threads callingset_mk_alignment_for_contiguous_layout(align)cannot race (allowing_DG_ALIGN_LOCKinninetyfiveto be dropped once upgraded).sm90_fp8_gemm_1d2d.hpp,gemm.hpp,ninetyfive-wheels.yml):precompile_m_grouped_fp8_gemm_nt_contiguousand precompile Qwen4's[512, 2560, 640](down) and[512, 1280, 2560](LoRAgate_up) acrossblock_m(32, 64, 128)so cold FP8 MoE startup requires zero runtimenvccinvocations.deepseek-ai/DeepGEMM#455: Guardblock_m16, 32candidates againstKernel1D1D(DG_STATIC_ASSERT(kNumMWaves == 2)on small-M FP8wgradbackward).deepseek-ai/DeepGEMM#478(5081f8513a): Tagmega_mhcsplit barriers with an epoch instead of%grididto fix stale split-barrier reads under CUDA graph replay.