Repository navigation
[ASM] Tune conc 256 and 128 for qwen3.8-flash - #7901
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 |
|
@mjkvaak-amd do you have time to run qwen3.8-flash with this PR ? |
E2E validation of #7901 on Flash-Next TP2 on vLLMSetup
Serving (8k/1k and 1k/1k, range ratio 0, N = 4C, two rounds swapping HIP pairs)
The rows with conc=32-64 are flat, as expected. Conc=128 sees a small boost. Conc=256 seems to be on the noise level. |
ddfe619 to
f5d8594
Compare
|
Not a blocker, but worth a guard while this kernel is open: MI355X, E = 513, top-11, model_dim 2560, inter_dim 320 (unpadded), MXFP4 SiLU, random weights. With this PR's 128/256 rows the call runs
The padded Flash-Next layout from #7611 (stored 384, pad 64) gives the same results. For comparison, Suggestions, either would do:
Repro (one GPU): import torch
from aiter import ActivationType, QuantType, dtypes
from aiter.fused_moe import fused_moe
E, K, D, I, M = 513, 11, 2560, 320, 256
dev = "cuda"
w1 = torch.randint(0, 256, (E, 2 * I, D // 2), dtype=torch.uint8, device=dev).view(dtypes.fp4x2)
w2 = torch.randint(0, 256, (E, D, I // 2), dtype=torch.uint8, device=dev).view(dtypes.fp4x2)
w1s = torch.full((E, 2 * I, D // 32), 127, dtype=torch.uint8, device=dev).view(dtypes.fp8_e8m0)
w2s = torch.full((E, D, I // 32), 127, dtype=torch.uint8, device=dev).view(dtypes.fp8_e8m0)
hs = torch.randn(M, D, device=dev, dtype=torch.bfloat16)
w = torch.rand(M, K, device=dev)
ids = torch.stack([torch.randperm(E - 2, device=dev)[: K - 1] + 1 for _ in range(M)])
ids = torch.cat([ids, torch.full((M, 1), E - 1, device=dev)], 1).to(torch.int32)
ids[:, :10] = 0 # what topk_gating returns for an all-NaN row; [:, :6] at M=256 passes
fused_moe(hs, w1, w2, w, ids, None, ActivationType.Silu, QuantType.per_1x32, False,
w1s, w2s, None, None, dtype=torch.bfloat16)
torch.cuda.synchronize() |
f5d8594 to
151074d
Compare
Thanks @mjkvaak-amd . I have fixed the kernel to truncate sorting that fails topk contract instead of faulting. But these kernels are not designed for topk output being repetative. |
Thanks for the topk fix. A separate issue arised: Qwen3.8-Flash-Next MXFP4, TP2, MI355X, vLLM nightly 8ca76632 + vllm#64025, AITER v0.1.29 + #7611 (stored 384, pad 64) + this PR. Eager server with every 33-512-token
From there the NaN propagates through later layers and the router turns those rows into duplicate ids. Replaying one failing call (real layer weights, routing, activations) on one GPU: 151074d gives NaN/inf on 10 / 300 launches, da83cb7 and Possibly related, from the disassembly: since da83cb7 the 8 producers ( Replay script: import sys, torch
from aiter.fused_moe import fused_moe
d = torch.load(sys.argv[1], weights_only=False) # args / kw of the server's fused_moe call
args = [a.cuda() if torch.is_tensor(a) else a for a in d["args"]]
kw = {k: (v.cuda() if torch.is_tensor(v) else v) for k, v in d["kw"].items()}
bad = 0
for _ in range(300):
out = fused_moe(*args, **kw)
torch.cuda.synchronize()
bad += int(not torch.isfinite(out).all())
print("launches with NaN/inf:", bad) |
151074d to
a039fb5
Compare
Conflicts in the SiLU/GELU MXFP4 manifests, where ROCm#7901 appended the emsort 16x320_stk rows: keep this branch's dim_align column and give the new rows 512, as for the other EMSORT rows. Signed-off-by: Mikko Tukiainen <[email protected]> Co-authored-by: Cursor <[email protected]>
Conflicts in the SiLU/GELU MXFP4 manifests from the ROCm#7901 revert (ROCm#8489): drop the emsort 16x320_stk rows it removes, keeping this branch's dim_align column on the rest. Signed-off-by: Mikko Tukiainen <[email protected]> Co-authored-by: Cursor <[email protected]>
Summary
Tune conc 128 and 256 for qwn38-flash.
This is a non-monokernel path for moe on TP2.
Motivation
It seems that prev results for conc128 on e2e were not giving any uplift. This kernel makes further 20% improvement to the kernel.
Changes
New stk emsort kernel for conc128 and con 256.
Performance (if applicable)
Data from moe traces for qwen38-flash
Testing
Documentation
Dependencies
Breaking Changes
PR Self-Review
Reviewed revision
151074d
Behavior and intent
Previously committed asm kernels did not show improvement on concurrencies 128 and above.
This new stk kernel will cover concurrencies 64 through 512 delivering an uplift.
Validation and unverified scope
aiter op_tests/test_moe_2stage.py has been used to verify correctness.
python3 -u op_tests/test_moe_2stage.py -t 64 128 256 512 -d bf16 -dim 2560,320 -q 4 -a silu -e 512 -k 10 -s f --no-flydsl-csv --ref-dtype fp32
Plus @mjkvaak-amd has helped to verify performance uplift on qwen38-flash mxfp4
Nothing is unverified. This PR touches only Qwen38-flash shapes for TP2.
PR-specific question
Changed op tests