Repository navigation
fix(moe): port effective aiter runner and shuffle markers and fix PTPC padding - #86
Merged
Merged
Conversation
sammysun0711
reviewed
Nov 5, 2026
sammysun0711
added a commit
that referenced
this pull request
Nov 6, 2026
* [AMD] Tune Qwen3.8 HC mix for MI308X Specialize the BF16 HC mix for the Qwen3.8 shape on 80-CU gfx942 devices using measured Triton launch parameters and smaller row tiles. Expand correctness coverage to 1-16 rows, add graph replay regression tests, and register AMD kernel CI. Validation: 39 tests passed on MI308X. Graph replay with all 100 checkpoint HC weight pairs improves by approximately 2.28x over the original persistent configuration. (cherry picked from commit 8cf5501) * feat(rocm): add Pyhip GR read support for Qwen3.8 Flash Next TP2 and TP4 (#39) * use pyhip gr read * update comments * add comments * update scripts * update setup * update pyproject_other.toml * Revert "update pyproject_other.toml" This reverts commit 9b0cebd. * update pyprojct * update warmup (cherry picked from commit 182e5e8) Ported onto qwen4_v0.5.21 with only the changes the branch's lint requires: - Test moved to test/registered/kernels/ops/gemm/ (kernel test layout) and registered with register_amd_ci (check-registered-tests). - ruff-format applied to the added lines. - Dropped hunks whose context no longer exists: scripts/ TP1 launcher (removed), compressed-tensors bump, and weight_updater call-site edits (call sites already pass the model). * Address review comments on Qwen3.8 GR cherry-pick - hc_mix: use is_gfx942_supported() for the gfx942 check and keep the original num_ctas line. - launch script: drop the duplicate AITER_MOE_PADDING_SIZE export; #86 exports it at its definition. --------- Co-authored-by: apinge <[email protected]> Co-authored-by: tongqiu <[email protected]> Co-authored-by: root <[email protected]> Co-authored-by: Xiake Sun <[email protected]>
apinge
force-pushed
the
qwen4-aiter-ptpc-padding
branch
2 times, most recently
from
November 6, 2026 07:11
cf50814 to
e2c6c5c
Compare
Adapt the source branch interfaces required by the PR #30 FP8 PTPC and BF16 MoE import to qwen4_v0.5.21. Keep explicit Triton selection ahead of SGLANG_USE_AITER in allocation, routing and shared-expert setup. Load padded BF16 buffers with logical TP checkpoint offsets. Based-on: 619632b Based-on: 6053574 These are selective interface adaptations, not full cherry-picks of the referenced commits. Keep generic padding at 128 and omit INT4-triggered backend selection. The following commits contain PR #30 itself and the project PTPC alignment and launch policy. Signed-off-by: apinge <[email protected]>
…o aiter (#30) * add preshuffle flag for ptpc * fix(moe): align FP8 PTPC shuffle with runner * recover mtp tp2 and tp4 (cherry picked from commit cc0c3c5) Source-PR: #30 Port notes: - Resolve PTPC context against the new base, which already has some shuffle markers; retain the effective-runner import and source padding behavior. - Preserve the new base gfx95 activation guard and parameter identity while removing the old BF16 128-alignment restriction from PR #30. - Adapt source regression fixtures to the new MoeRunnerConfig interfaces. - Project-specific 64 alignment and launch policy are in the next commit. Signed-off-by: apinge <[email protected]>
Load equal logical TP checkpoint slices before padding FP8 PTPC gate/up weights and channel scales, then pad down-projection K and shuffle. Require PTPC alignment 64 without changing the generic AITER default. Keep explicit Triton MoE free of AITER padding and preshuffle even with SGLANG_USE_AITER=1, as required by the Qwen3.8 TP1 launch. Use 64-aligned physical BF16 dimensions for the gfx942 gated MTP path, with zero pad metadata for the tuned Qwen3.8 kernels. Preserve Qwen3.5 automatic AITER selection, shared-expert routing and ASM/CK layouts. Export the PTPC default in Qwen launch scripts and select AITER for the Qwen3.8 MTP MoE. Keep source PR #30 regressions in the repository; local migration experiments and their artifacts are kept separately in /opt. Qwen3.8 MoE configs: apinge/aiter@23115cc Qwen3.5 ASM configs: apinge/aiter@4752a40 Qwen3.5 CK configs: apinge/aiter@3bb5dfa Signed-off-by: apinge <[email protected]>
apinge
force-pushed
the
qwen4-aiter-ptpc-padding
branch
from
November 6, 2026 08:32
0b9bcb3 to
fcb6f43
Compare
Restore the inline F.pad, torch.cat and Parameter assignments from the source branch after PR #30 so reviewers can compare the padding path directly. Remove the local padding helpers and copy_or_rebind_param use. Release temporary tensors after use to limit their lifetime. Keep strict alignment-64 validation, unpadded logical TP loading and effective backend selection unchanged. Explicit Triton still bypasses AITER MoE padding and shuffle. Preserve the padding observation log. Reference: cc0c3c5 Validation: 56 targeted tests and 6 subtests passed. Real GPU FP8 padding and shuffle produce identical weight/scale bytes and layout markers for intermediate 128, 160 and 320. The 160-to-192 single-layer allocation test peaks about 361 MiB above the helper implementation; unpadded cases match. No full model evaluation was rerun for this refactor. Signed-off-by: apinge <[email protected]>
Signed-off-by: apinge <[email protected]>
Restore the source get_moe_padding_size implementation, including the AITER_MOE_PADDING_SIZE override and the generic default of 128. Pass the effective AITER backend directly to PTPC weight allocation again, then use the existing padded loader to copy logical TP weight and scale slices. Remove the project-specific gfx942 BF16 alignment override so BF16 also uses the source environment-driven allocation. Retain the requested strict PTPC alignment-64 check, but validate the same resolved value used for allocation. PTPC launch scripts supply the 64 default; a direct PTPC launch without that setting now fails early instead of validating 64 and silently allocating with the generic 128. Explicit Triton continues to bypass AITER MoE padding and shuffle. Based-on: cc0c3c5 Validation: 47 targeted checks and 6 subtests passed, including every TP rank, presharded inputs, channel scales and explicit Triton selection. Real single-layer GPU loading, normalization and shuffle produced identical weight/scale bytes and markers for Qwen3.8 TP2/TP4. Local experiments are under /opt; no full-model runs were added. Signed-off-by: apinge <[email protected]>
sammysun0711
approved these changes
Nov 7, 2026
sammysun0711
left a comment
Collaborator
There was a problem hiding this comment.
Local check with following config
- Qwen3.8 TP2/TP4 + MTP
- Qwen3.5 35B TP1/TP2/TP4 + Dflash
- Qwen397B TP8 + Dflash
Both function and accuracy check passed, invoked MOE kernel matched tuned aiter moe kernel introduced by apinge/aiter#1.
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.
Motivation
This PR is mainly based on #30, adds modifications for padding of ptpc fp8 and other changes from 619632b
Modifications
Aside from scripts, testing and utils files, the main difference from the base commit 816ff20 is the moe padding chanages.:
get_moe_weight_sizes()to allocate padded weights and zero-fill padding during loading. Remove the fixed 128-alignment restriction and explicitly set theis_shuffledmarkers.shuffle_weight(), andis_shuffledmarkers were already present.Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci