Skip to content

[FlyDSL] Count tile2_pad in the stage-1 XCD remap grid - #8512

Open
peymanr wants to merge 1 commit into
ROCm:mainfrom
peymanr:fix/flydsl-stage1-xcd-remap-tile2-pad-2b033db253
Open

peymanr wants to merge 1 commit into
ROCm:mainfrom
peymanr:fix/flydsl-stage1-xcd-remap-tile2-pad-2b033db253

Conversation

@peymanr

@peymanr peymanr commented Nov 23, 2026 •

Copy link
Copy Markdown

Summary

Fixes #8382; the same failure is also reported in #8051 at the 385-expert, top-7 key.

The FlyDSL a8w4 MoE stage-1 kernels with XCD swizzle (*_bnt0_gui_xcd4_fp8) skip the last launched N block when intermediate_pad is non-zero. That block's padded output columns and their e8m0 scales are never written. Stage 2 then reads them, so whatever the memory held reaches every output row. This PR makes the in-kernel XCD remap count the same N blocks as the launch grid. It is a one-term change in compile_mixed_moe_gemm1_common. At pad 0 the kernel is unchanged.

Motivation

On MI355X (gfx950), aiter.fused_moe with MX-fp8 activations, MXFP4 weights, SiLU and gate/up interleaved can return NaN/Inf rows without raising an error. This happens when stage 1 is one of these kernels:

  • flydsl_moe1_afp8_wfp4_bf16_t64x128x256_w4_bnt0_gui_xcd4_fp8
  • flydsl_moe1_afp8_wfp4_bf16_t64x256x256_w3_bnt0_gui_xcd4_fp8

and the caller passes a non-zero intermediate_pad.

The DeepSeek-V4.1 TP4 shape is affected: 576 real intermediate columns padded to 640, intermediate_pad=64. The tuned rows in aiter/configs/model_configs/dsv41_fp8_tuned_fmoe.csv (key 5120 / 640 / 384 experts / top-6) select the first kernel at T 8192 and 16384.

Cause. The launcher sizes the stage-1 grid to cover the padded output width, including tile2_pad. The XCD remap inside the kernel (xcd_swizzle 4) recomputes grid_x from n_in - 2 * inter_dim_pad and leaves out tile2_pad. With inter_dim 640, pad 64 and tile_k 256, the launch has 10 N blocks but the remap spreads only 9. No workgroup is ever assigned to the last N block, so stage-1 columns 576-639 and their scales stay unwritten. The v2-layout stage 2 reads all 640 K columns. The non-swizzled kernel (..._w4_bnt0_gui_fp8) does not run the remap, writes every column, and stays finite.

Whether a call fails depends on what the reused memory held before the call. That would fit the input-dependent counts in the report, but we did not measure it under the normal allocator.

Changes

Relation to open PRs:

Performance (if applicable)

Not measured. The change only alters which N blocks the remap hands out, but kernel timings were not taken with or without the patch.

Hardware Workload/configuration Before After Change
MI355X (gfx950) not benchmarked not measured not measured not measured

Testing

  • Unit tests added or updated
  • Performance benchmarks run
  • Tested on MI250X
  • Tested on MI300X

Validated on MI355X only; see "Validation and unverified scope" below. No unit test is added in this PR; a suggested regression test is described below.

Documentation

  • Docstrings updated
  • User guide updated
  • Performance guide updated
  • No documentation change is needed, with the reason stated below

This is an internal kernel bug fix. No API, option or documented behavior changes.

Dependencies

  • No new third-party dependencies added
  • New dependencies are listed and justified below

Breaking Changes

None.

PR Self-Review

Reviewed revision

5394390

Behavior and intent

Before this change, the XCD-swizzled stage-1 kernels skipped the last launched N block whenever tile2_pad was non-zero. Padded intermediate columns were left unwritten and were then consumed by stage 2. After the change, the remap and the launch agree on the N-block count, so every column is written. When tile2_pad is 0, the behavior is identical to before.

Validation and unverified scope

Checks on this diff. The patch applies cleanly to main at 2bd3416. The repository has no .pre-commit-config.yaml, so no pre-commit hooks ran. No build check was run.

GPU setup. GPU results were validated on one MI355X in the vLLM nightly ROCm image of 2026-11-22 (aiter 0.1.29.post1, FlyDSL 0.5.0, torch 2.13 on ROCm 10). The FlyDSL MoE kernel source in that image is byte-identical to aiter 07766baea, the commit in the report. The patch was applied to that copy, not to a build of current main.

Method.

  • Shape: 5120 / 640 (576 real + 64 pad) / 384 experts / top-6, with random MXFP4 weights and random routing.
  • Each kernel pair was forced through a one-row AITER_CONFIG_FMOE table and checked against aiter's dispatch log.
  • To make unwritten memory visible, every buffer allocated inside fused_moe was filled with 0xFF (NaN) before each call.
  • A call counts as failing when any output row is non-finite.
  • Each case ran 32 calls (16 inputs × 2).

Results.

  • Reproduction (T 8192 and 16384, pad 64, 0xFF). The xcd4 stage 1 failed 32 of 32 calls, with every row non-finite and columns 576-639 still 0xFF. The non-swizzled kernel failed 0 of 32. FlyDSL 0.4.2 (vLLM v0.34.0 image) behaved the same.
  • Conditions for the failure. With a 0x00 fill instead of 0xFF, 0 of 32 failed. At pad 0 with 0xFF, 0 of 32 failed.
  • With this patch. The same kernels were dispatched, and stage 1 received inter_dim_pad=64 and xcd_swizzle=4 on every call. Failures went from 32 of 32 to 0 of 32, and calls with unwritten columns went from 32 of 32 to 0 of 32. The patched xcd4 output was bit-identical to the non-swizzled kernel's on all 16 inputs.
  • 385-expert, top-7 key. At pad 64, both xcd4 kernels failed 32 of 32 and the non-swizzled kernel 0 of 32. At pad 0, all gave 0 of 32. This was run without the patch, to confirm the same cause.
  • Predictions set up in advance from the block-count arithmetic, without the patch:
    • At inter 640, pad 32 (counts agree) gave 0 of 32 and pad 96 (counts differ) gave 32 of 32.
    • At inter 1024 with pad 64, the tile_n 128 kernel gave 32 of 32 and the tile_n 256 kernel (counts agree) gave 0 of 32.
    • With 448 real columns, pad 192 gave 32 of 32 and pad 160 gave 0 of 32.

Reproducer. A reduced reproducer (one 1024-token batch, xcd4 vs non-swizzled, pad 64, 0xFF workspace) gives 32 of 32 against 0 of 32, and it did so again on a rerun. It can be shared on request. Without it: call fused_moe on the shape above with intermediate_pad=64, force the xcd4 stage 1, and fill the stage-1 output buffer with 0xFF beforehand. Columns 576-639 of the stage-1 output keep 0xFF.

Not tested:

  • intermediate_pad=0. No failure was reproduced there, and the report's script was not posted, so its pad setting is unknown. If the report's failures happen at pad 0, they have another cause that this PR does not address.
  • GPUs other than MI355X (gfx950), including MI250X and MI300X.
  • The reporter's ROCm 7.2.4 / torch 2.11 stack. Only the ROCm 10 / torch 2.13 images were used.
  • The failure rate under the normal allocator without a filled workspace.
  • End-to-end vLLM or SGLang serving, real DeepSeek-V4.1 weights, and multi-GPU tensor parallelism.
  • With the patch: the gate-only and separate gate/up stage-1 paths, tile_k other than 256, atomic stage 2 and split-K.
  • Kernel timing with the patch.
  • The tuner (gemm_moe_tune.py) reporting 0% error for these kernels is a separate problem and is not addressed here.

Points raised in review of this diff, not addressed here:

  • The tile2_pad formula is duplicated at compile scope instead of being shared with the launcher's copy in _launch_mixed_moe_gemm1. If one copy changes without the other, the mismatch returns.
  • The stage-1 XCD remap computes workgroups_per_xcd = num_workgroups // 8 with no remainder handling. Even with the corrected grid_x, it is a one-to-one mapping only when grid_x * grid_y is a multiple of 8. This is a separate concern that this PR does not change and did not test.
  • No regression test is added. Suggested test, following [FlyDSL] Fix and efficiently initialize A8W4 MoE stage1 padding #7796's method: fill the stage-1 output with 0xFF and check that columns inter_dim - pad .. inter_dim are written, for xcd_swizzle 0 and 4 and pad 0, 32, 64 and 96.

PR-specific question

Question (from the PR Self-Review comment): What is the most important boundary or failure mode introduced by this change, and what evidence covers it?

Boundary: the remap must count exactly the N blocks the launcher launches. The change subtracts the compile-time tile2_pad from the remap's pad term. The remap and the launcher compute this value separately; the launcher's copy is in _launch_mixed_moe_gemm1.

Failure mode if the copies diverge. If the two formulas ever differ, the mismatch returns:

  • if the remap counts fewer blocks, the last launched N block is skipped again and its columns stay unwritten;
  • if it counts more, workgroups are mapped to an N block that was never launched.

Scope of the change.

  • When tile2_pad is 0, including intermediate_pad=0, the generated kernel is unchanged.
  • Gate-only kernels are unaffected: they keep tile2_pad=0.
  • Kernels with xcd_swizzle 0 do not run the remap.

Evidence.

  • At the DeepSeek-V4.1 TP4 shape (pad 64, tile_k 256), with a 0xFF-filled workspace on one MI355X, failing calls went from 32 of 32 to 0 of 32.
  • The output was bit-identical to the non-swizzled kernel.

Not covered.

  • Other pads and tile_k values.
  • The gate-only and separate gate/up stage-1 paths.
  • grid_x * grid_y not divisible by 8.

These are listed under "Validation and unverified scope".

Changed op tests

None.

The stage-1 launcher sizes the grid to the padded output width,
including tile2_pad, but the XCD remap inside the kernel
(xcd_swizzle 4) recomputed grid_x from n_in - 2 * inter_dim_pad
without it. With inter_dim 640, pad 64 and tile_k 256, the launch has
10 N blocks and the remap spreads only 9. The last N block is never
computed, so stage-1 columns 576-639 and their e8m0 scales stay
unwritten. The v2-layout stage 2 reads them, and the output can turn
non-finite (ROCm#8382, ROCm#8051).

Compute the launcher's tile2_pad in compile_mixed_moe_gemm1_common and
subtract it from the remap's pad term, so the remap covers every
launched N block. When tile2_pad is 0 (including pad 0), the kernel is
unchanged.

Validated on one MI355X with a 0xFF-filled workspace at the
DeepSeek-V4.1 TP4 shape (pad 64): failing calls went from 32 of 32 to
0 of 32, and the output was bit-identical to the non-swizzled kernel.

Fixes ROCm#8382

Signed-off-by: Peyman Razaghi <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter standard tests on MI35X
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 8512 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@peymanr
peymanr marked this pull request as ready for review November 25, 2026 03:44
@peymanr
peymanr requested review from a team and a balanced review from Copilot November 25, 2026 03:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@aiter-bot

aiter-bot commented Nov 25, 2026 •

Copy link
Copy Markdown

NOT READY FOR HUMAN REVIEW

PR Self-Review

Revision 5394390ac4bd · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

Before this change, the XCD-swizzled stage-1 kernels skipped the last launched N block whenever `tile2_pad` was non-zero. Padded intermediate columns were left unwritten and were then consumed by stage 2. After the change, the remap and the launch agree on the N-block count, so every column is written. When `tile2_pad` is 0, the behavior is identical to before.

Validation and unverified scope

**Checks on this diff.** The patch applies cleanly to `main` at 2bd34162e491. The repository has no `.pre-commit-config.yaml`, so no pre-commit hooks ran. No build check was run.

**GPU setup.** GPU results were validated on one MI355X in the vLLM nightly ROCm image of 2026-11-22 (aiter 0.1.29.post1, FlyDSL 0.5.0, torch 2.13 on ROCm 10). The FlyDSL MoE kernel source in that image is byte-identical to aiter `07766baea`, the commit in the report. The patch was applied to that copy, not to a build of current `main`.

**Method.**

- Shape: 5120 / 640 (576 real + 64 pad) / 384 experts / top-6, with random MXFP4 weights and random routing.
- Each kernel pair was forced through a one-row `AITER_CONFIG_FMOE` table and checked against aiter's dispatch log.
- To make unwritten memory visible, every buffer allocated inside `fused_moe` was filled with 0xFF (NaN) before each call.
- A call counts as failing when any output row is non-finite.
- Each case ran 32 calls (16 inputs × 2).

**Results.**

- **Reproduction (T 8192 and 16384, pad 64, 0xFF).** The xcd4 stage 1 failed 32 of 32 calls, with every row non-finite and columns 576-639 still 0xFF. The non-swizzled kernel failed 0 of 32. FlyDSL 0.4.2 (vLLM v0.34.0 image) behaved the same.
- **Conditions for the failure.** With a 0x00 fill instead of 0xFF, 0 of 32 failed. At pad 0 with 0xFF, 0 of 32 failed.
- **With this patch.** The same kernels were dispatched, and stage 1 received `inter_dim_pad=64` and `xcd_swizzle=4` on every call. Failures went from 32 of 32 to 0 of 32, and calls with unwritten columns went from 32 of 32 to 0 of 32. The patched xcd4 output was bit-identical to the non-swizzled kernel's on all 16 inputs.
- **385-expert, top-7 key.** At pad 64, both xcd4 kernels failed 32 of 32 and the non-swizzled kernel 0 of 32. At pad 0, all gave 0 of 32. This was run without the patch, to confirm the same cause.
- **Predictions set up in advance from the block-count arithmetic, without the patch:**
  - At inter 640, pad 32 (counts agree) gave 0 of 32 and pad 96 (counts differ) gave 32 of 32.
  - At inter 1024 with pad 64, the tile_n 128 kernel gave 32 of 32 and the tile_n 256 kernel (counts agree) gave 0 of 32.
  - With 448 real columns, pad 192 gave 32 of 32 and pad 160 gave 0 of 32.

**Reproducer.** A reduced reproducer (one 1024-token batch, xcd4 vs non-swizzled, pad 64, 0xFF workspace) gives 32 of 32 against 0 of 32, and it did so again on a rerun. It can be shared on request. Without it: call `fused_moe` on the shape above with `intermediate_pad=64`, force the xcd4 stage 1, and fill the stage-1 output buffer with 0xFF beforehand. Columns 576-639 of the stage-1 output keep 0xFF.

**Not tested:**

- `intermediate_pad=0`. No failure was reproduced there, and the report's script was not posted, so its pad setting is unknown. If the report's failures happen at pad 0, they have another cause that this PR does not address.
- GPUs other than MI355X (gfx950), including MI250X and MI300X.
- The reporter's ROCm 7.2.4 / torch 2.11 stack. Only the ROCm 10 / torch 2.13 images were used.
- The failure rate under the normal allocator without a filled workspace.
- End-to-end vLLM or SGLang serving, real DeepSeek-V4.1 weights, and multi-GPU tensor parallelism.
- With the patch: the gate-only and separate gate/up stage-1 paths, tile_k other than 256, atomic stage 2 and split-K.
- Kernel timing with the patch.
- The tuner (`gemm_moe_tune.py`) reporting 0% error for these kernels is a separate problem and is not addressed here.

**Points raised in review of this diff, not addressed here:**

- The `tile2_pad` formula is duplicated at compile scope instead of being shared with the launcher's copy in `_launch_mixed_moe_gemm1`. If one copy changes without the other, the mismatch returns.
- The stage-1 XCD remap computes `workgroups_per_xcd = num_workgroups // 8` with no remainder handling. Even with the corrected `grid_x`, it is a one-to-one mapping only when `grid_x * grid_y` is a multiple of 8. This is

[truncated in readiness report; see the PR description for the full answer]

PR-specific question

**Question (from the PR Self-Review comment):** What is the most important boundary or failure mode introduced by this change, and what evidence covers it?

**Boundary: the remap must count exactly the N blocks the launcher launches.** The change subtracts the compile-time `tile2_pad` from the remap's pad term. The remap and the launcher compute this value separately; the launcher's copy is in `_launch_mixed_moe_gemm1`.

**Failure mode if the copies diverge.** If the two formulas ever differ, the mismatch returns:
- if the remap counts fewer blocks, the last launched N block is skipped again and its columns stay unwritten;
- if it counts more, workgroups are mapped to an N block that was never launched.

**Scope of the change.**
- When `tile2_pad` is 0, including `intermediate_pad=0`, the generated kernel is unchanged.
- Gate-only kernels are unaffected: they keep `tile2_pad=0`.
- Kernels with `xcd_swizzle` 0 do not run the remap.

**Evidence.**
- At the DeepSeek-V4.1 TP4 shape (pad 64, tile_k 256), with a 0xFF-filled workspace on one MI355X, failing calls went from 32 of 32 to 0 of 32.
- The output was bit-identical to the non-swizzled kernel.

**Not covered.**
- Other pads and tile_k values.
- The gate-only and separate gate/up stage-1 paths.
- `grid_x * grid_y` not divisible by 8.

These are listed under "Validation and unverified scope".

Changed op tests

None.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot could not review the current head (for example, quota or service failure)

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • FAIL — Aiter Test Gate: failed
  • Required CI failed; fix it before requesting human review.

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@peymanr

peymanr commented Nov 26, 2026

Copy link
Copy Markdown
Author

WAITING ON AUTHOR

PR Self-Review

Revision 5394390ac4bd · mode shadow

@aiter-bot Updated the PR Self-Review section of the description:

  • Reviewed revision now holds the head SHA 5394390ac4bd. This round adds no commit, so the head is unchanged.
  • PR-specific question now answers the default question: what is the most important boundary or failure mode, and what evidence covers it. The answer covers:
    • the remap/launcher N-block count invariant;
    • the duplicated tile2_pad formula in _launch_mixed_moe_gemm1;
    • what stays unchanged (tile2_pad == 0, gate-only, xcd_swizzle 0);
    • the MI355X evidence (32/32 to 0/32 failing calls);
    • what is not covered.

I ran this repo's .github/scripts/pr_self_review.py validate_author_answers on the new description against head 5394390ac4bd542aed91e7699a7e60629edbb9a1. It reports no issues; the PR-specific answer is now 224 units (the minimum is 14).

Prepared with PR Pundit.

@peymanr

peymanr commented Nov 26, 2026

Copy link
Copy Markdown
Author

Standard Tests (1 GPU) (linux-aiter-mi35x-1, MI35X, 8, 1): failure.

Job log (lines around failures):
2026-11-25T05:30:21.0982253Z pad_batches = 0,
2026-11-25T05:30:21.0982415Z kv_granularity = None)

These failures are mla_decode-absorb [golden vs aiter_asm] allclose mismatches. They come from the MLA decode op tests (op_tests/test_mla.py / test_mla_persistent.py / test_mla_sparse.py print this message) running the prebuilt asm kernel mla_a8w8_qh16_qseqlen1_gqaratio16_ps.

This PR changes only aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage_common.py (compile_mixed_moe_gemm1_common). That function is reached only through the FlyDSL MoE path (aiter/ops/flydsl/moe_kernels.py → kernels/mixed_moe_gemm_2stage.py / kernels/fhmoe.py).

A grep of aiter/mla.py and these test files finds no import of mixed_moe*, moe_kernels or fused_moe. So the failing tests do not exercise the changed code. I did not rerun this test or compare against main in this round, so I am not claiming it also fails there; the claim is only that this diff does not reach the failing code.

Prepared with PR Pundit.

@peymanr

peymanr commented Nov 26, 2026

Copy link
Copy Markdown
Author

Standard Tests (1 GPU) (linux-aiter-mi35x-1, MI35X, 8, 2): failure.

Job log (lines around failures):
2026-11-25T06:05:53.9584225Z + docker exec -w /workspace -e AITER_MOE_2STAGE_FULL_MATRIX aiter_test bash -c 'SHARD_TOTAL=8 SHARD_IDX=2 ./.github/scripts/aiter_test.sh'
2026-11-25T06:05:54.9781851Z Running op_tests/test_fused_qk_norm_rope_cache_quant.py op_tests/test_rope.py op_tests/test_flydsl_qk_norm_rope_quant.py op_tests/test_gemm_a8w8_mxfp8_bpreshuffle.py op_tests/test_mla_sparse_prefill.py op_tests/test_pa_mqa_logits_mxfp4_opus.py op_tests/test_flydsl_compre

These failures are k_cache allclose mismatches in op_tests/test_fused_qk_norm_rope_cache_quant.py (the chunk / decode1 / prefill cases). The q/k/v outputs in the same cases pass.

That test uses aiter.ops.fused_qk_norm_rope_cache_quant and reshape_and_cache*. A grep of the test, aiter/ops/fused_qk_norm_rope_cache_quant.py and aiter/ops/triton/rope/fused_qk_norm_rope_cached.py finds no reference to mixed_moe*, moe_kernels, fused_moe or FlyDSL MoE.

This PR changes only the FlyDSL MoE stage-1 XCD remap in aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage_common.py, so this test does not run the changed code. I did not rerun this test or compare against main in this round, so I am not claiming it also fails there; the claim is only that this diff does not reach the failing code.

Prepared with PR Pundit.

@peymanr

peymanr commented Nov 26, 2026

Copy link
Copy Markdown
Author

Aiter Test Gate: failure.

Job log (lines around failures):
2026-11-25T07:06:05.8748419Z �[36;1m} >> "$GITHUB_STEP_SUMMARY"�[0m
2026-11-25T07:06:05.8749695Z �[36;1m�[0m

The gate log shows every other prerequisite succeeded (check-signal, build_aiter_wheels, split_aiter_tests, prepare_triton_wheel, the scope detection) and multi-GPU was skipped. It failed only on standard=failure.

That comes from the two Standard Tests shards above:

  • shard 1: mla_decode-absorb asm mismatches;
  • shard 2: test_fused_qk_norm_rope_cache_quant.py k_cache mismatches.

As explained in those replies, neither test reaches the file this PR changes. I did not rerun them in this round.

Prepared with PR Pundit.

Arist12 added a commit to Arist12/aiter that referenced this pull request Nov 30, 2026
…le on 2 * inter_dim

The interleaved stage-1 gate/up kernel walks 2 * (inter_dim - inter_dim_pad)
on its N axis, and one workgroup writes tile_n // 2 output columns, but the
resolver checked inter_dim % tile_n.  A tuned 256-wide tile at inter_dim
640/1152 was therefore forced to 128 even though it is legal.

Resolve the interleaved tile against the real unpadded N axis, keep the
historical rule for separated gate/up, and fall back to the largest supported
divisor (256/128/64).  Cap the interleaved tile at 128 for k_wave > 1: the
k_wave reduction path is only exercised with the 128-wide tile, and the
128-wide k_wave=2 output already differs from k_wave=1 on MI350X
(pre-existing, outside this diff).

A tile move changes grid_x.  Replay the stock XCD remap on the kernel's real
y grid - ceil(sorted M blocks / persist_m) - and keep the stock tile when a
missing workgroup would leave a fillable (M block, N tile) unwritten.  When
the caller sets an XCD swizzle and tile2_pad != 0, where the launcher and the
in-kernel remap count different N tiles (ROCm#8512/ROCm#6598), keep the stock tile;
without a swizzle a padded launch may resolve a smaller legal tile than stock
(outputs unchanged).  With xcd_swizzle=4 the stock launch on the pad64 shape
still drops the last N tile, which is the pre-existing main issue
tracked by ROCm#8512 and is not changed or claimed fixed here.

The interleaved non-split-K CShuffle epilogue only holds tile_n // 2 columns;
take the half budget only when the full-width buffer would not fit the LDS
limit, so launches that already fit keep their compiled kernel.

Tests: 339 CPU cases in op_tests/test_flydsl_moe_stage1_tile_n.py, including
a guard-vs-kernel-remap equivalence sweep over persist_m {1,2,3,4,8} and
xcd_swizzle 1..8, and the public-API persist_m=2/xcd_swizzle=4 case.  The
file runs under `python3 <file>` (aiter_test.sh's path) and is collected by
split_tests.sh.  Public-API MI350X A/B: 14 changed tuned rows 1.045-1.046x
A/A-corrected over two runs, 8-shape focus 1.084x, CShuffle rows neutral;
14/14, 32/32, 9/9, 51/51 outputs SHA-256 equal.  A 152-case persist_m x
xcd_swizzle x tile_n sweep is SHA-equal to main.  The pad64 guard case
(resolves 128 on both trees) and the 64-wide fallback (inter_dim=128,
inter_dim_pad=32, requested 256 -> 64, SHA-equal to stock 128) were run on
MI350X; the pad64 stock 128 path still loses the last N tile on main.

Signed-off-by: Arist12 <[email protected]>
Arist12 added a commit to Arist12/aiter that referenced this pull request Dec 4, 2026
…le on 2 * inter_dim

The interleaved stage-1 gate/up kernel walks 2 * (inter_dim - inter_dim_pad)
on its N axis, and one workgroup writes tile_n // 2 output columns, but the
resolver checked inter_dim % tile_n.  A tuned 256-wide tile at inter_dim
640/1152 was therefore forced to 128 even though it is legal.

Resolve the interleaved tile against the real unpadded N axis, keep the
historical rule for separated gate/up, and fall back to the largest supported
divisor (256/128/64).  Cap the interleaved tile at 128 for k_wave > 1: the
k_wave reduction path is only exercised with the 128-wide tile.

A tile move changes grid_x.  Replay the stock XCD remap on the kernel's real
y grid - ceil(sorted M blocks / persist_m) - before accepting an upgrade, and
keep the stock tile when a missing workgroup would leave a fillable
(M block, N tile) unwritten, or when the launcher pads the N axis
(tile2_pad != 0, ROCm#8512/ROCm#6598).  A downgrade is always kept.

Tests: op_tests/flydsl_tests/test_flydsl_moe_stage1_tile_n.py pins the
interleaved axis, the fallback, the k_wave cap and the XCD/pad guards.

MI355X (FlyDSL 0.5.5, production use_async_copy=True and sync): of the twelve
tuned rows that name 256, dsv41_fp4 M2048/N1152/E385 and dsv41_fp8
M4096/N640/E128 are 1.23x and 1.28x async, every warm round above 1.02x, on
the stock split-output path; the other ten are not faster, so their CSV rows
name the 128 tile main already ran and compile to main's kernel.  Outputs are
SHA-256 equal and no other tuned row changes its launch.  The two kept rows'
us1/TFLOPS/BW are refreshed.

Signed-off-by: Arist12 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

4 participants