Repository navigation
[MoE] Add Qwen3.8 Flash Next FP8 PTPC and BF16 FlyDSL kernels for MI308X - #1
Merged
sammysun0711 merged 5 commits intoSep 20, 2026
Merged
Conversation
Merged
5 tasks
Comment on lines
+294
to
+300
| pk1_f32 = llvm.inline_asm( | ||
| T.f32x2, | ||
| [as_ir_value(src_val)], | ||
| "v_cvt_pk_f32_fp8_sdwa $0, $1 src0_sel:WORD_1", | ||
| "=v,v", | ||
| has_side_effects=False, | ||
| ) |
Collaborator
There was a problem hiding this comment.
Can we replace inline_asm with flydsl api?
Owner
Author
There was a problem hiding this comment.
The V_CVT_PK_F32_FP8 can in principle be expressed with the following flydsl api (0.3.2):
pk0_f32 = Vec(rocdl.cvt_pk_f32_fp8(T.f32x2, src_val, word_sel=False))
pk1_f32 = Vec(rocdl.cvt_pk_f32_fp8(T.f32x2, src_val, word_sel=True))Of course at the mlir level, the generated code is different from the original implementation.
e.g.
llvm inline
%355 = llvm.extractelement %299[%129 : i64] : vector<32xi32>
%356 = llvm.inline_asm "v_cvt_pk_f32_fp8 $0, $1", "=v,v" %355 : (i32) -> vector<2xf32>
%357 = llvm.inline_asm "v_cvt_pk_f32_fp8_sdwa $0, $1 src0_sel:WORD_1", "=v,v" %355 : (i32) -> vector<2xf32>api version
%2319 = rocdl.cvt.pk.f32.fp8 %2318[false] : vector<2xf32>
%2320 = rocdl.cvt.pk.f32.fp8 %2318[true] : vector<2xf32> But the generated asm is not exactly the same. The api version results in higher vgpr pressure than llvm inline asm. e.g. In batch 16 TP2 FP8
fx942,80,16,2560,320,513,11,ActivationType.Silu,torch.bfloat16,torch.float8_e4m3fnuz,torch.float8_e4m3fnuz,QuantType.per_Token,1,0,16,0,130.8017099999999,impl__flydsl_gfx942__16_128_64_False,0.02%,0.0,,0%,130.8017099999999,0,0,0,0.0,0.0,
flydsl api increases vgpr usage from 124 -> 170.
The batch-level performance data below shows a slight regression as well.
for example
| config ptpc fp8 | llvm inline asm μs | api μs | Δ |
|---|---|---|---|
| TP1 / token1 | 22.579 | 22.655 | +0.334% |
| TP1 / token2 | 34.992 | 35.085 | +0.270% |
| TP2 / token1 | 15.306 | 15.444 | +0.900% |
Collaborator
There was a problem hiding this comment.
Noted, let's revisit here for api replacement & refactor later.
sammysun0711
approved these changes
Sep 20, 2026
Merged
5 tasks
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.
This PR adopts the kernel implementation from @luocheng25 's branch
luocheng/moe_gemm_308-opt. We added support for ptpc fp8 and bf16 moe.Notably, this PR upgrades flydsl to version 0.3.2 in aiter.
Perf
Note
--no-flydsl-csvwas added to this test command line. It doesn’t mean all flydsl kernels are deselected; without it, the unit test would read all the cases in the *,csv and test other TPs' kernels.FP8 TP1
FP8 TP2
FP8 TP4
BF16 TP1
BF16 TP2
BF16 TP4
Acc