Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
There was a problem hiding this comment.
🟡 Changes recommended
The new absolute import fails for direct script execution with a wheel install and no repository root on PYTHONPATH, preventing the regression from running.
1 open issue
What changed in this PR
This PR fixes incomplete FlyDSL A8W4 MoE stage1 padding initialization, preventing stale non-finite workspace values from propagating into later stages. It is independent of the tuning changes in #6433.
Changes:
- Correct padding calculations and use actual launch dimensions for XCD remapping.
- Clear eligible padding through existing epilogue stores, avoiding extra GEMM blocks.
- Add 32 poisoned-workspace regression cases with reference, zero-padding, and guard-row checks, plus standard MoE test-entry integration.
| File | Description |
|---|---|
op_tests/test_moe_2stage.py |
Invokes the padding regression sweep from the standard test entry. |
op_tests/flydsl_tests/test_flydsl_moe.py |
Adds configurable test data and padding correctness/performance cases. |
aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage_common.py |
Fixes padding launch bounds and adds optimized epilogue tail clearing. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Shared stage1 grid and XCD remapping changes extend beyond tested cases, while GPU validation is unavailable, the standard-entry run is incomplete, and production-shape performance differences remain unresolved.
1 open issue
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Shared stage1 launch and epilogue changes affect paths beyond the regression coverage, while unavailable GPU validation and an unresolved standard-entry failure leave correctness and latency unconfirmed.
1 open issue
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Human GPU review is needed because shared stage1 grid and epilogue changes lack independent head-matched gfx950 validation, with a blocked standard-entry run and unresolved timing differences.
1 open issue
Review effort: Balanced
…h-grid remap ROCm#7796 was closed without merging; ROCm#7822 handles the stage-1 padding in the dispatch instead. Drop its padding changes and tests, but keep the remap over the launch grid: stage 1 launches tile2_pad more N columns than the count the remap recomputed, so with intermediate_pad (DSv4.1 TP4: 576 + 64) an xcd_swizzle stage 1 left the padded columns unwritten. Co-authored-by: Claude Opus 5.5 <[email protected]> Signed-off-by: Carl Persson <[email protected]>

Summary
Fix incomplete initialization of the FlyDSL A8W4 MoE stage1 intermediate padding. For an intermediate width of 640 (576 real columns + 64 padding columns) and
tile_n=64, the current grid writes only 608 output columns. Stale Inf/NaN in the remaining 32 columns can propagate through MXFP8 quantization into the final MoE output.This is a standalone kernel fix based on main
cb4ac3423f56ef03ddf9d1c329d3ee32ca039270, discovered while reviewing #6433. It does not depend on, or modify, that PR's tuning CSV.Motivation
Changing the grid to calculate all required padding fixes correctness, but doing extra GEMM work on zero weights adds latency. For tile-aligned A8W4 interleaved gate/up outputs, existing epilogue stores can also initialize the padded tail.
Changes
Performance (if applicable)
Hardware: gfx950, 256 CUs (MI355-class GPU). PyTorch
2.10.0+rocm7.2.4.git3d3aa833, HIP7.2.53211, pinned FlyDSL 0.5.0. All variants use the same main tree and runtime; only the shared stage1 kernel source changes.Workload: D=5120, I=640, intermediate_pad=64, FP8 activations, MXFP4 weights, BF16 output, interleaved gate/up, SiLU limit 10. Stage1 uses
t32x64x256,k_wave=4; the three configurations are the affected rows from #6433. Timings exclude compilation and workspace poisoning. HIP events measure 100-call graphs replayed 20 times per interval.Stage1, same process, identical input/output buffers, alternating variant order (median of 12 intervals, microseconds):
Full
fused_moe, separate-process confirmation in reversed variant order (median of 7 intervals, microseconds):Performance is not fully recovered for every configuration. E129/M1 remains 3–4% slower than original main in two alternating comparisons; separate-process stage1 measurements showed a larger 37–38% difference. Absolute stage1 timings are sensitive to the measurement setup, so this PR does not claim performance parity with the original implementation. The optimization consistently improves the alternating comparison against the correctness-only grid fix. Full MoE improvement is modest, and E129/M1 is slightly slower. The original implementation is only a zero-initialized correctness control, not a safe end-to-end baseline under arbitrary workspace contents.
Testing
Documentation
Dependencies
Breaking Changes
None.
PR Self-Review
Reviewed revision
Base:
cb4ac3423f56ef03ddf9d1c329d3ee32ca039270.Validated kernel SHA256:
42bbdf9fd558093e011e4708c6c7c3a153d597cdf375daf9c05b6120edebf6f5.PR head:
1ce7f9314b1c6311feefdcbf2f6535c275e90617.Behavior and intent
Stage1 must initialize padding that is consumed by the next quantization/GEMM stage, even when the caller provides a workspace containing non-finite values. The optimized path gives each participating real-output vector a distinct padding vector to clear. Eligibility checks exclude split-K, fused quantized output, bias, heterogeneous weights, and unaligned tails; those cases retain the corrected grid path.
Validation and unverified scope
python3 -m pytest op_tests/flydsl_tests/test_flydsl_moe.py -q --tb=short: 66 passed on gfx950 with FlyDSL 0.5.0.python3 op_tests/flydsl_tests/test_flydsl_moe.py: 32/32 regression/performance cases passed, with the Markdown metrics summary emitted.(tile_n,tile_k,k_wave)=(64,256,4),(128,256,1),(64,512,1),(128,512,1); padding = 0/32/64/96; XCD swizzle = 0/4. It compares against the existing torch reference withcheckAllcloseand asserts zero mismatches, exact zero padding, and unchanged guard rows.fused_moevalidation for all three affected configurations, with stage1 workspace initialized to 0, 17, Inf, and NaN: 12/12 finite outputs, bitwise equal to the zero-workspace control, repeated in all completed optimized runs. Saved final outputs also equal original main's zero-workspace control.python3 op_tests/test_moe_2stage.py --no-legacy --no-flydsl-csv --quant 7stops in the pre-existingtest_output_buffer_contract, before the added sweep, becausetriton.runtime.cache.triton_key()raisesOSError: [Errno 5] Input/output errorwhile reading a Triton file. Retrying with Inductor caches disabled encounters the same file-read error. This is not recorded as a passing standard-entry run.PR-specific question
Pending the automated question after PR creation. The new regression fails with the original kernel, rather than relying on a pre-zeroed output or an unchecked numeric comparison.
Changed op tests
op_tests/flydsl_tests/test_flydsl_moe.py: extends existing data generation to choose padding/activation and adds the poisoned-output, torch-reference, guard-row, and performance sweep. Existing tests did not poison the caller-owned stage1 buffer for these tilings.op_tests/test_moe_2stage.py: invokes the same regression sweep from the standard op-test entry, so this is not an isolated second test implementation.