Repository navigation
Conversation
The dW1 / dW2 grouped GEMMs contract over each expert's padded pool slot range. The fork's seqused_k bounded that contraction to the real rows, because the padding rows of pool and the intranode dL_do_pool are uninitialized and 0 * NaN poisons the expert's gradient. The other operand of each GEMM (dL_dswiglu_in, postact_a_for_dW2) already has exact-zero padding from kernel_y_bwd's padding mask. Instead, the backward now zeroes the padding rows of dL_do_pool and pool right before the dW GEMMs, so padding contributes 0 * 0, and drops seqused_k. zero_padding_rows (a Triton kernel next to the level-2 compress/expand kernels) launches one program per (expert, H-block) and stores zeros over [block_offset[e] * tile_m + frequency[e], block_offset[e + 1] * tile_m), the fewer than tile_m padding rows at the tail of each expert's range. dispatch_grads never writes padding slots, so the zeroing cannot race its tail. With no fork commit left, the test env pins upstream quack-kernels==0.6.5 from PyPI; cutlass-dsl stays at 4.7.0. Evoscale must move to the same quack version when it picks up this StreamEP version. test_dw_gemm runs both dW GEMMs at the default tile configs with NaN / inf padding on the garbage operand against a real-rows-only reference, plus a control showing the NaN reaches dW without the zeroing. Worst per-expert relative error 1.67e-3 over all shapes and layouts, tolerance 4e-3. Measured on H100, quack 0.6.5, torch 2.11: - kernels suite: 188 passed (8 files), 1 GPU. - dist suite: 234 passed (6 files), 8 GPUs. - internode suite: 236 passed, 4 skipped (existing level-2 empty-rank known bug) per node, 2 nodes x 8 GPUs. - profile_pipeline at the default bench shape (H 3072, I 768, 256 experts, top-8, 8192 tokens/rank, 8 GPUs), 3 interleaved runs vs main: zero_padding_rows ~15 us per call (2 per backward); bwd e2e 3982 / 4072 / 3987 us vs 4051 / 3975 / 4079 us; fwd+bwd 6166 / 6249 / 6243 us vs 6195 / 6222 / 6214 us. Parity within noise. A first version that launched one program per slot cost 240 us per call (+5% bwd). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Removes StreamEP's dependency on the evolutionaryscale quack fork, whose only extra commit adds
seqused_k. The backward now zeroes the padding rows of the dW GEMM operands, so the GEMMs can contract over the padded slot ranges. The test env pins upstreamquack-kernels==0.6.5.Changes
stream_moe.py: dropsseqused_kfrom the dW1 / dW2 grouped GEMMs. Right before them,zero_padding_rowszeroes the padding rows ofdL_do_poolandpool.recv_pool_compress.py: newzero_padding_rows(pool, expert_pool_block_offset, expert_frequency, tile_m), a Triton kernel with one program per (expert, H-block). It writes only the <tile_mpadding rows at the tail of each expert's slot range.pixi.toml/pixi.lock: quack moves from the fork git rev to==0.6.5from PyPI. cutlass-dsl stays at 4.7.0.csrc/stream_ep.cpp,AGENTS.md,README.md: comments and docs no longer rely on quack'slens_kOOB fill or mention the fork.kernels/test_dw_gemm.py, andtest_zero_padding_rowsintest_recv_pool_compress.py.Why
The padding rows of
pooland of the intranodedL_do_poolare uninitialized. The other dW operands (dL_dswiglu_in,postact_a_for_dW2) are exactly zero there, but 0 × NaN = NaN, so the garbage side has to be clean too.seqused_kexcluded those rows; zeroing them does the same job with stock quack.Evoscale must pin the same quack (
quack-kernels==0.6.5) when it picks up this StreamEP version. StreamEP runs on whatever quack evoscale has installed. Between the fork base and 0.6.5, upstream's only change is a SwiGLU epilogue fix for the (2, 2) layout.Verification
H100, quack 0.6.5, torch 2.11:
profile_pipelineat the default bench shape, 3 interleaved runs vsmain:zero_padding_rows(2 calls)Performance is at parity within run-to-run noise. Not tested: evoscale itself on quack 0.6.5.
🤖 Generated with Claude Code