Repository navigation
[AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP: monokernel update and opt-in QSA, MXFP4 MoE, HC prefill and GDN verify kernels on the 20261117 image / [AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP:在 20261117 镜像上更新 monokernel 并启用 QSA、MXFP4 MoE、HC 预填充与 GDN verify 可选内核 - #2
Draft
eppaneamd wants to merge 7 commits into
Draft
eppaneamd wants to merge 7 commits into
eppaneamd wants to merge 7 commits into
Conversation
…patch 10) on the 20261117 image - 09 packs the GDN in_proj_qkvz / in_proj_ba of up to 64 rows into one FP8 quant and one GEMM (sgl-project/sglang#50024), the file of chang/qwen3.8-flash-fp4-mi355x-update-monokernel (3a24884), which applies unchanged on the image's SGLang c67db7c762 - 10 updates the image's Qwen3.8-Flash-Next monokernel to amd-asalykov/sgl-amd-mono asalykov/qfn-mono-tp (afbb25a), the source-only diff from the image's sgl-amd-mono a04ceab The setup script applies both after patch 07 and checks that the patched monokernel is the one Python imports; c1 and c2 set SGLANG_QWEN35_PACKED_IN_PROJ=0. The search space is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
…draft head at its shipped precision Patches 11-16, 21 and 24 add opt-in kernels, each off unless the recipe sets its SGLANG_AMD_* variable; c12, c24, c48 and c80 set all eight: - 11 grouped QSA verify scoring (sgl-project/sglang#48625, carries #46631) - 12-13 FlyDSL QSA sparse prefill (ROCm/aiter#7556 kernels in the image's AITER checkout, sgl-project/sglang#51179 wiring) - 14 MXFP4 MoE intermediate kept 128-aligned at TP 1 (sgl-project/sglang#49852) - 15 Triton HC prefill path (sgl-project/sglang#50863) - 16 QSA indexer prefill blocks selected by the exact topk_v2, one pipeline stage on gfx95 (sgl-project/sglang#50871, #51263) - 21 QSA decode, verify and draft-extend blocks selected by the exact topk_v2, draft-extend rows scored grouped as in verify (sgl-project/sglang#50871, #51242) - 24 GDN ReplaySSM verify and commit kernels (sgl-project/sglang#51180) c1 and c2 set SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0, and the recipe drops default-chat-template-kwargs so the server serves the chat template's default thinking mode. The setup script uses set -eo pipefail (AGENTS.md Bash: no nounset). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
…ithin the admission Patches 22, 23, 26 and 27; c12, c24, c48 and c80 set their two variables: - 22-23 FP8 stage-2 route output for the target's MXFP4 MoE (ROCm/aiter#8174 in the image's AITER checkout, sgl-project/sglang#51198 wiring), SGLANG_AITER_MOE_STAGE2_FP8 - 26 brings patch 15 to the head of sgl-project/sglang#50863; SGLANG_USE_HIP_HC_PREFILL_TRITON replaces SGLANG_AMD_HC_PREFILL, which 26 no longer reads - 27 decode FP8 quant fused into the GDN gated norm and the attention output gate (sgl-project/sglang#51023), no variable cuda-graph-bs-decode at c12-c80: every size to the admission at c12 and c24, every size to 64 and every 8 to 128 at c48 and c80. c48 also sets strip-thinking-cache and mamba-max-states-per-path 2, as c80 does. Patch 12's header names ROCm/aiter#7556's head 1c8725c7f3 and how the patch differs from it. c1 and c2 are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
…and c2 c1 and c2 set hybrid-cache-checkpoints-level 3 instead of the image's default level 2 (branch points and request ends, one state per path), so the prefix cache recomputes fewer prompt tokens. c12, c24, c48 and c80 keep the default level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
c12 no longer lists every decode batch size to its admission of 24 (cuda-graph-bs-decode) and captures the image's default sizes, as before patches 22-27. c24, c48 and c80 keep their lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
…ches 28, 29) Patches 28 and 29, in the forms the validation windows ran (their kernels in SGLang's tree); every point sets both variables: - 28 runs the fused FlyDSL GDN chunked prefill for a batch of 1,024 tokens or more as prep kernels in parallel over the chunks plus a serial state kernel, bit for bit the fused kernel's outputs and tracked states; SGLANG_AMD_GDN_PREFILL (ROCm/aiter#8329 ports the kernels into AITER) - 29 runs the GDN prefill's causal conv, one FP8 quant for in_proj_qkvz and in_proj_ba, the gated norm with the out_proj quant, and the gating on new kernels; SGLANG_AMD_GDN_PREFILL_FUSED (ROCm/aiter#8328, sgl-project/sglang#51658) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
…ge-model-only) Patch 30 is sgl-project/sglang#51663 (both commits): Qwen4ExpForConditionalGeneration joins the architectures --language-model-only accepts, and MRoPE sends text positions to its Triton kernel through a stride-0 view instead of forward_native. Every point sets language-model-only, so the server skips the vision tower's weights. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
maeehart
added a commit
to SemiAnalysisAI/InferenceX
that referenced
this pull request
Nov 24, 2026
The entry came from eppaneamd#2 with a placeholder link. This branch is carried by #5133.
5 of 11 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.
Summary
Adds 17 patches to the MI355X Qwen3.8-Flash-Next FP4 SGLang AgentX recipe (
qwen3.8next-fp4-mi355x-sglang-agentic-mtp) of SemiAnalysisAI/InferenceX#4832, "the base PR" below:chang/qwen3.8-flash-fp4-mi355x-update-monokernel, which the base PR lacks: the packed GDN input projection (09) and the updated monokernel (10)language-model-onlyEvery added patch but 10 (from a branch) has an open upstream PR, listed under Upstream pieces. 28 and 29 keep their kernels in SGLang's tree, as our windows ran them; their draft PRs move 28's kernels and 29's conv kernel into AITER.
a6a72472(this fork'sbase/chang-qwen38-refactor): thelmsysorg/sglang-rocm:v0.5.23-rocm10-mi35x-20261117image with the image's own AITER. The base PR has no e2e run on this image; its last, 42802324736, ran its earlier head13f2b0e3on the…-20261102image.inferencex-e2e/docs/waiver/<PR>.mdwaiver. None is filed, and the patches are in nolmsysorgimage. The branch is for an unofficial run.…-20261102image; its head with main merged ran unofficially as 44408546542. What this branch adds to it is under Changes.Changes
Against the earlier PR, whose eight patches this branch ports to this image:
language-model-onlycuda-graph-bs-decodestrip-thinking-cacheandmamba-max-states-per-path 2, which c80 already setshybrid-cache-checkpoints-level 3qwen3.8next-rocm10-patches.sh). Numbers 08, 17-20 and 25 are not on this branch.language-model-only. Each file's header names its upstream source, head commit and how the patch differs from it.SGLANG_AMD_GDN_PREFILLandSGLANG_AMD_GDN_PREFILL_FUSED, andlanguage-model-only: true, with which the server skips the vision tower's weights.SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0(the MTP draft'slm_headat its shipped precision, not patch 10's FP8 copy) andSGLANG_QWEN35_PACKED_IN_PROJ=0(patch 09 off).default-chat-template-kwargs: '{"enable_thinking": false}'is removed, as in main's entry: the server applies the chat template's default, the thinking mode of the acceptance length the harness injects.Validation
The two windows of a pair ran together on one node; per-pair values are in the details.
Validation details
T = total tokens/s per GPU, N = P90 E2E-normalized interactivity.
This head without patch 30 (B) against the earlier PR's patches on this image (A), thinking off:
The same, thinking on:
Patch 30 (B) against the same settings without it (A), thinking off, 28 and 29's variables unset in both:
c1 and c2,
hybrid-cache-checkpoints-level3 (B) against 2 (A), withSGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0in both:The earlier PR's patches on this image (B) against the base PR with patches 09 and 10 (A):
infx.bench agentic) at mainfabf7ba3(agentx-harness 1.0.14; this branch pins 1.0.13, as the base PR does), the 256k-capped trace corpus and an injected acceptance length of 2.32.…-20261117with each arm's patches applied when the image was built.python/sglang, AITER'saiter/opsandaiter/fused_moe.py, the monokernel package) equal, file for file, what this branch's setup script makes of the stock image's, without and with patch 30 (git applyin the script's order, compared without a GPU).fabf7ba3render from this branch's recipe withoutlanguage-model-only, exceptdefault-chat-template-kwargsin the thinking-off windows and c12's decode graph sizes in the thinking-on windows.in_projquant, the norm with theout_projquant), and no fallback; at c12-c80 each logged one[fused_moe] stage2_fp8:line (patches 22 and 23). With the earlier PR's patches the servers loggedamd qsa grouped verify: on,amd qsa flydsl prefill 1: warmedandAMD_ACTIVE s2_mxfp4_pad128, and none loggedstays on Triton.Upstream pieces
Every PR open on 2026-11-20.
in_proj_qkvzandin_proj_baof up to 64 rows: one FP8 quant and one GEMMSGLANG_QWEN35_PACKED_IN_PROJ=0turns it offasalykov/qfn-mono-tp(no PR)--enable-amd-monokernel;SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8SGLANG_AMD_QSA_GROUPED_VERIFYSGLANG_AMD_QSA_FLYDSL_PREFILLSGLANG_AMD_MXFP4_PAD128topk_v2on unscaled scores; one-stage scoring on gfx95SGLANG_AMD_QSA_PREFILL_TOPK_V2topk_v2; draft-extend rows share block reads as in 11SGLANG_AMD_QSA_DECODE_TOPK_V2SGLANG_AMD_QSA_GROUPED_DRAFT_EXTENDfused_moe(stage2_fp8=True): that call's FlyDSL reduce stage 2 writes FP8 route rows summed in FP32; an MXFP4 scatter stage 2 after an MXMOE stage 1 runs as the reduce of the same tilestage2_fp8=Truein every MoE layer except a speculative draft's; the server refuses to start without 22SGLANG_AITER_MOE_STAGE2_FP8SGLANG_AMD_GDN_VERIFYSGLANG_USE_HIP_HC_PREFILL_TRITONout_projoro_projat 1-256 BF16 tokens takes its (FP8, scale) input from the launch before it: the GDN gated RMSNorm or the attention output gateSGLANG_AMD_GDN_PREFILLout_projquant, gatingSGLANG_AMD_GDN_PREFILL_FUSED--language-model-onlyacceptsQwen4ExpForConditionalGeneration; MRoPE takes text (1-D) positions on its Triton kernel through a stride-0 viewlanguage-model-only: true(server argument)How each patch differs from its upstream source
…-20261102image's SGLang; it applies unchanged on this image.qwen38_flash_nextpackage as the source-only diff from this image's sgl-amd-monoa04ceab, which already has the branch's two shared modules (tests, the README and other models left out). The setup script fails if Python does not import the patched package.e6a31510c9; the head1c8725c7f3has the same kernel files. The PR's later commits add main's selection-width query (ROCm/aiter#8083), which patch 13 does not call, and change two argument checks of the prefill entry point: asoftmax_scalethat does not convert to a float is rejected, and the output-overlap check skips the padding between strided K/V rows. The setup script fails if Python imports AITER from anywhere other than the image's editable checkout, which 12 and 22 patch.SGLANG_ROCM_QSA_FLYDSL_PREFILL.624fa95a85, behind the variable.SGLANG_AMD_HC_PREFILLis no longer read.fast_topk, which can miss blocks in an overfull threshold bin; in batch-invariant mode the selection keepsfast_topk, where sglang#50871 runstopk_v2in its deterministic mode. It relies on the image's defaultSGLANG_TOPK_V2_MODE=1.0e30623971), reworked; neither PR has a switch. The grouped draft extend acts with patch 11's variable.581579ab, which lacks main commits the PR builds on. Two hunks have no counterpart there and are left out: thedeterministic=Truerefusal (thisfused_moetakes nodeterministicargument) and main'sAITER_MXFP4_INTERMEDIATEterm infused_moe_2stages' route-weight condition.lengths != 0compare is skipped under the variable; the PR builds that mask only when read. The GDN layers' compare is already lazy on this image (sgl-project/sglang#48414, merged).qwen4_exp.py.gdn_split_prefill*.py, called fromgdn_aiter_prefill.py), as our windows ran them; the draft moves the kernels into AITER'sgdn_fused_prefillbehindAITER_GDN_SPLIT_PREFILL.AITER_CONV1D_PREFILL_VEC, and sglang#51658 carries the quant and gating fusions on patch 27's PR.e3ccb7faad.Draft-model precision
The MTP layer ships MXFP4 experts, FP8 E4M3 attention and indexer projections, and BF16 hyper-connections, router and norms, and uses the target's BF16
lm_head. The patches that also run on it keep those dtypes:o_projqualifies (Quark per-channel weights, per-token activations, 1-256 tokens), the input's FP8 codes and scales come from the output-gate launch, bit for bit the linear's own quant.forward_native; both cast the cos/sin cache to the query's dtype.Patches 11 and 24 run on target verify only, and patch 23 leaves the draft's MoE on the default stage 2. Patches 28 and 29 run in the target's GDN layers only; the draft layer is full attention. At c1 and c2 the monokernel runs the draft with
SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0, its BF16lm_head.Unchanged settings, and this branch against the base PR
Unchanged:
lmsysorg/sglang-rocm:v0.5.23-rocm10-mi35x-20261117@sha256:09b8237296024285e6286ffb54d75c3af6d59342bbbb3558dea56bed86798814.581579abwith FlyDSL 0.4.2 (patches 12 and 22 write into its editable checkout).a6a72472)a04ceabafbb25a)SGLANG_AMD_GDN_PREFILL,SGLANG_AMD_GDN_PREFILL_FUSEDlanguage-model-onlystrip-thinking-cache,mamba-max-states-per-path 2hybrid-cache-checkpoints-level(c1, c2)enable_thinking: falseAI model disclosure
PR checklist and change type
Type of Change
Checklist
python -m infx.matrix.changed --base origin/mainlists affected config keys, I have appended one new entry covering them to the physical end ofinferencex-e2e/perf-changelog.yaml; if it lists none, I have added none. I have not edited historical entriesinferencex-e2e/perf-changelog.yamlentry, it carries exactly one primary sweep label (a maintainer applies it on fork PRs):full-sweep-fail-fast(recommended),full-sweep-enabled, ornon-canary-full-sweep-enabled. Optional modifiersall-evals,evals-only, andagentx-fastrequire a primary label; the last two block reuse while applied./use <run_id>(or the legacy/reuse-sweep-run) on this PR. Do this only once there is a final full sweep that is all green with evals passing, since after this comment the primary sweep label will no longer automatically kick off new sweeps. Remove and re-add the primary sweep label to force a new sweep.中文
概要
本 PR 在 SemiAnalysisAI/InferenceX#4832(下称“基线 PR”)的 MI355X Qwen3.8-Flash-Next FP4 SGLang AgentX 配方(
qwen3.8next-fp4-mi355x-sglang-agentic-mtp)之上加入 17 个补丁:chang/qwen3.8-flash-fp4-mi355x-update-monokernel(基线 PR 没有):打包的 GDN 输入投影(09)与更新后的 monokernel(10)language-model-only除 10(取自一个分支)外,每个新增补丁都有尚未合并的上游 PR,见“上游组件”。28 与 29 的内核位于 SGLang 源码树中,与我们的窗口所运行的相同;它们的 draft PR 把 28 的内核与 29 的卷积内核移入 AITER。
a6a72472(本 fork 中为base/chang-qwen38-refactor):镜像lmsysorg/sglang-rocm:v0.5.23-rocm10-mi35x-20261117,使用镜像自带的 AITER。基线 PR 在该镜像上还没有 e2e run;其最近一次 e2e run 42802324736 基于较早的 head13f2b0e3(镜像…-20261102)。inferencex-e2e/docs/waiver/<PR>.md豁免说明的补丁。本分支没有提交豁免说明,这些补丁也不在任何lmsysorg镜像中。本分支用于一次非官方运行。…-20261102镜像上的补丁 11-16、21 与 24;其 head 合入 main 后的非官方运行为 44408546542。本分支相对它新增的内容见“改动”。改动
相对早先 PR(本分支把其八个补丁移植到本镜像):
language-model-onlycuda-graph-bs-decodestrip-thinking-cache与mamba-max-states-per-path 2(c80 已设置)hybrid-cache-checkpoints-level 3qwen3.8next-rocm10-patches.sh)。编号 08、17-20 与 25 不在本分支中。language-model-only下生效。每个补丁文件的头部注明其上游来源、head commit 以及与之的差异。SGLANG_AMD_GDN_PREFILL与SGLANG_AMD_GDN_PREFILL_FUSED,以及language-model-only: true,使服务器跳过视觉塔的权重。SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0(MTP draft 的lm_head以发布时的精度运行,而不是补丁 10 的 FP8 副本)与SGLANG_QWEN35_PACKED_IN_PROJ=0(关闭补丁 09)。default-chat-template-kwargs: '{"enable_thinking": false}',与 main 上的条目一致:服务器采用 chat template 的默认设置,即 harness 注入的 acceptance length 所对应的 thinking 模式。验证
每一对的两个窗口在同一节点上一起运行;逐对数据见上方“Validation details”。
逐对数据、运行条件、日志中的路径与 checkpoint level 的对比见上方“Validation details”。
上游组件
各补丁的改动、上游来源(相关 PR 在 2026-11-20 均未合并)与变量见上方表格。与上游来源的差异:
…-20261102镜像的 SGLang 生成,可在本镜像上原样应用。qwen38_flash_next包,以相对本镜像 sgl-amd-monoa04ceab的纯源码差异给出;a04ceab已包含该分支的两个共享模块(不含测试、README 与其他模型)。若 Python 导入的不是打过补丁的包,setup 脚本失败。e6a31510c9的文件;head1c8725c7f3的内核文件相同。该 PR 之后的提交加入了 main 的 selection-width 查询(ROCm/aiter#8083,补丁 13 不调用),并修改了 prefill 入口的两项参数检查:无法转换为 float 的softmax_scale会被拒绝;输出重叠检查跳过跨步 K/V 行之间的填充。若 Python 从 12 与 22 所修改的镜像可编辑 AITER 源码目录以外的位置导入 AITER,setup 脚本失败。SGLANG_ROCM_QSA_FLYDSL_PREFILL。624fa95a85),由变量控制。SGLANG_AMD_HC_PREFILL不再被读取。fast_topk,后者在过满的阈值分桶中可能漏选 block;batch-invariant 模式下选择仍用fast_topk,而 sglang#50871 在该模式下以确定性模式运行topk_v2。它依赖镜像默认的SGLANG_TOPK_V2_MODE=1。0e30623971),已重做;两个 PR 都没有开关。grouped draft extend 需与补丁 11 的变量一起生效。581579ab上,后者缺少该 PR 所基于的若干 main commit。有两个 hunk 在那里没有对应位置,因此未包含:deterministic=True的拒绝(该fused_moe没有deterministic参数),以及 main 在fused_moe_2stages路由权重条件中的AITER_MXFP4_INTERMEDIATE项。lengths != 0比较在变量开启时被跳过;该 PR 只在读取时才构建该掩码。GDN 层的该比较在本镜像上已是惰性的(sgl-project/sglang#48414,已合并)。qwen4_exp.py)之上以偏移量应用。gdn_split_prefill*.py,由gdn_aiter_prefill.py调用),与我们的窗口所运行的相同;该 draft 把这些内核移入 AITER 的gdn_fused_prefill,开关为AITER_GDN_SPLIT_PREFILL。AITER_CONV1D_PREFILL_VEC;sglang#51658 在补丁 27 的 PR 之上承载量化与 gating 融合。e3ccb7faad的两个 commit 相同。Draft 精度
MTP 层发布时为 MXFP4 专家、FP8 E4M3 的 attention 与 indexer 投影、BF16 的 hyper-connection、router 与 norm,并使用目标模型的 BF16
lm_head。也作用于该层的补丁保持这些数据类型:o_proj满足条件(Quark per-channel 权重、per-token 激活、1-256 个 token)时,输入的 FP8 码值与 scale 来自 output gate 的 launch,与该线性层自身的量化逐位相同。forward_native;两者都把 cos/sin cache 转换为 query 的数据类型。补丁 11 与 24 只作用于目标模型的 verify,补丁 23 让 draft 的 MoE 保持默认的 stage 2。补丁 28 与 29 只作用于目标模型的 GDN 层;draft 层为 full attention。在 c1 与 c2,monokernel 以
SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0(BF16lm_head)运行 draft。AI 模型使用说明
改动类型:配置变更。
🤖 Generated with Claude Code