Skip to content

[AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP: opt-in QSA, MXFP4 MoE, HC prefill and GDN verify kernels on the update-monokernel recipe / [AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP:在 update-monokernel 配方上启用 QSA、MXFP4 MoE、HC 预填充与 GDN verify 可选内核 - #1

Draft
eppaneamd wants to merge 5 commits into
base/chang-qwen38-update-monokernelfrom
amd/qwen3.8next-mi355x-sglang-optin-kernels

Conversation

@eppaneamd

@eppaneamd eppaneamd commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Status (2026-11-19): an unofficial run of this head with main merged, 44408546542 on SemiAnalysisAI/InferenceX#5133, passed 14 of 16 jobs. The c48 benchmark and the c80 GSM8K failed in the cluster's host setup before their servers started and need a re-run.

Summary

Adds eight opt-in kernel patches (11-16, 21 and 24) to the MI355X Qwen3.8-Flash-Next FP4 SGLang AgentX recipe, qwen3.8next-fp4-mi355x-sglang-agentic-mtp. They come from open upstream PRs and add gfx950 kernels for QSA verify and sparse prefill attention, QSA block selection, the MXFP4 MoE, the hyper-connection prefill and GDN verify. Concurrency 12-80 turns them on.

Changes

  • Patches 11-16, 21 and 24 apply after patch 10, in that order (qwen3.8next-rocm10-patches.sh). Numbers 17-20, 22 and 23 are not on this branch.
  • Each patch is off unless its variable is set. Each file's header names its upstream PR, head commit and how the patch differs from it.
  • c12, c24, c48 and c80 set all eight variables; c1 (TP1, TP2, TP4) and c2 set none. c1 and c2 run the monokernel, which takes the decode, verify and draft steps that patches 11, 14, 21 and 24 change.
  • Every monokernel point sets SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0, so the MTP draft's lm_head runs at its shipped precision instead of on patch 10's FP8 copy.
  • No patch lowers the dtype of a weight or an activation, in the target or the MTP draft.
  • 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.
  • Unchanged: the image, the AITER wheel, patches 01-10, the eight points, the two GSM8K eval groups and every other argument and variable.

Validation

Unofficial run 44408546542 of this head with main merged (ba2e5a9e), against the base's run 43505902743:

  • Failed jobs: the c48 benchmark and the c80 GSM8K, both on one node before a server started (host_setup: "GPUs still draining prior job's memory after 60min").
  • c12, c24 and c80 (patches on): P90 E2E-normalized interactivity +17.8 %, +26.0 % and +36.9 %; throughput per GPU +5.0 %, +4.1 % and +19.2 %.
  • c1 and c2 (no patch on): P90 E2E-normalized interactivity −2.9 % (c2), −1.1 % (TP2 c1) and −4.3 % (TP4 c1). TP1 c1 reads +19.1 % against a base row that is below the key's published c1 (run 41882345112).
  • Other differences from the base run: thinking on (this PR removes enable_thinking: false) and the AgentX harness 1.0.14 from main against 1.0.13.
  • Accuracy: GSM8K strict 0.9757-0.9795 (thinking on) at the seven points evaluated, against the base run's 0.9689 (c2) and 0.9682 (c80); acceptance length 2.487-2.723 at c2, c12, c24 and c48, above the golden 2.32 (a report-only check).
Validation details

T = total tokens/s per GPU, N = P90 E2E-normalized interactivity, I = 1 / P90 ITL.

Point Base run 43505902743: T / N / I This run 44408546542: T / N / I Change: T / N / I
TP1 c1 14,215 / 115.2 / 284.1 19,360 / 137.2 / 467.3 +36.2 / +19.1 / +64.5 %
TP2 c1 10,402 / 156.0 / 574.7 10,260 / 154.3 / 558.7 −1.4 / −1.1 / −2.8 %
TP4 c1 5,558 / 175.6 / 632.9 5,423 / 168.1 / 617.3 −2.4 / −4.3 / −2.5 %
TP1 c2 21,644 / 191.8 / 387.6 21,356 / 186.2 / 367.6 −1.3 / −2.9 / −5.1 %
TP1 c12 66,263 / 109.6 / 148.4 69,596 / 129.1 / 180.8 +5.0 / +17.8 / +21.9 %
TP1 c24 127,067 / 72.8 / 99.6 132,288 / 91.8 / 123.2 +4.1 / +26.0 / +23.6 %
TP1 c48 181,022 / 44.9 / 55.0 no result (job 135214539114 failed) –
TP1 c80 231,915 / 24.0 / 27.4 276,412 / 32.8 / 37.9 +19.2 / +36.9 / +38.0 %
  • Published c1 (run 41882345112, image …-20261031): 16,818 / 128.1 / 389.1.
  • GSM8K strict per point, 1,319 questions each: TP1 c1 0.9788, c2 0.9780, c12 0.9795, c24 0.9757, c48 0.9788, TP2 c1 0.9788, TP4 c1 0.9788; c80's job (135271926237) failed. Acceptance length: c2 2.723, c12 2.499, c24 2.487, c48 2.490.
  • Every server that started logged qwen3.8next patch applied: 18 times. c12-c80 log amd qsa grouped verify: on, amd qsa flydsl prefill 1: warmed and AMD_ACTIVE s2_mxfp4_pad128; c1 and c2 log none of them.
  • c12-c80 serve kv_cache_dtype and speculative_draft_kv_cache_dtype fp8_e4m3, as in the base recipe; c1 and c2 auto and the draft default.

Upstream pieces

All open on 2026-11-18.

Patch Change Upstream PR Variable
11 QSA verify: the four draft rows of a request share each read of a selected compressed-key block sglang#48625 (draft), carrying #46631 SGLANG_AMD_QSA_GROUPED_VERIFY
12 FlyDSL QSA sparse prefill kernels, written into the installed AITER wheel aiter#7556 none (13 calls them)
13 QSA sparse prefill (extend) on patch 12's kernels, compiled by the backend warm-up at start-up sglang#51179 (draft) SGLANG_AMD_QSA_FLYDSL_PREFILL
14 TP1 MXFP4 MoE intermediate aligned to 128 instead of 256 columns, so AITER's tuned FlyDSL rows apply sglang#49852 (draft) SGLANG_AMD_MXFP4_PAD128
15 Prefill-size hyper-connections: one GEMM on the raw residual with the norm folded into the weights, then Triton finish, up and combine kernels sglang#50863 (draft) SGLANG_AMD_HC_PREFILL
16 QSA indexer prefill: request-relative blocks selected by the exact topk_v2 on unscaled scores; one-stage scoring on gfx95 sglang#50871 + #51263 (drafts) SGLANG_AMD_QSA_PREFILL_TOPK_V2
21 QSA decode, verify and draft extend: blocks selected by the exact topk_v2; draft-extend rows share block reads as in 11 sglang#50871 + #51242 (drafts) SGLANG_AMD_QSA_DECODE_TOPK_V2
SGLANG_AMD_QSA_GROUPED_DRAFT_EXTEND
24 GDN ReplaySSM target verify: a q/k prep kernel from 11 requests and a layer-loop commit from 32 sglang#51180 (draft) SGLANG_AMD_GDN_VERIFY
How each patch differs from its upstream PR
  • 11: one log line per verify size.
  • 12: the PR's files at e6a31510c9; its later commits only merge main.
  • 13: the same scheme on this image's SGLang; the PR rebuilds it on main behind SGLANG_ROCM_QSA_FLYDSL_PREFILL.
  • 14: the PR's first commit, 624fa95a85.
  • 15: an earlier revision of the PR's kernels; the PR's switch is SGLANG_USE_HIP_HC_PREFILL_TRITON.
  • 16: neither PR has a switch on gfx95. The exact selection replaces fast_topk, which can miss blocks in an overfull threshold bin; in batch-invariant mode the selection keeps fast_topk.
  • 21: [Perf] [AMD] qsa: Select blocks with the exact topk_v2 on gfx95 sgl-project/sglang#50871's selection (commit 0e30623971), reworked; neither PR has a switch. The grouped draft extend acts with patch 11's variable.
  • 24: the PR has no switch. Up to 10 requests, the image's verify kernel runs with one pipeline stage. The patch also drops two dead compares:
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:

  • 13: its prefill, with BF16 Q, K and V, as the Triton path.
  • 14: its MoE, padded like the target's: the same MXFP4 bytes, 640 columns instead of 768.
  • 15: its hyper-connection sites above 128 rows (prefill, and verify and draft extend from 33 requests), with the norm folded into BF16 weights.
  • 16 and 21: its QSA blocks in draft extend, selected from the same fp32 scores of BF16 queries and keys.

Patches 11 and 24 run on target verify only.

Unchanged settings, and this base against SemiAnalysisAI#4832

Unchanged:

  • Image: lmsysorg/sglang-rocm:v0.5.23-rocm10-mi35x-20261102@sha256:acf1fee05096c6eb757d4642e3b87c36766bce1334277e49b917afc2f06c7b5a.
  • AITER: the v0.1.29 wheel with FlyDSL 0.4.2.
  • Patches 01-10.
  • The eight points: TP1 c1, c2, c12 and c24 from GPU KV; c1 at TP2 and TP4; TP1 c48 and c80 with HiCache DRAM offload.
  • The two GSM8K eval groups, and every other argument and variable.

This base against SemiAnalysisAI/InferenceX#4832 at 2ac71ff7 (2026-11-17; its head a6a72472, 2026-11-18, adds an empty commit):

This base, run 43505902743 (3a24884e) SemiAnalysisAI#4832 at 2ac71ff7
Image …-20261102 …-20261117 (SGLang c67db7c762)
AITER v0.1.29 wheel, FlyDSL 0.4.2 the image's 581579ab, FlyDSL 0.4.2
SGLang patches 01-09 01-04 and 06-08, rebased; 05 (sgl-project/sglang#41683) merged on 2026-11-17; no 09 (sgl-project/sglang#50024)
Monokernel patch 10 (afbb25a) the image's sgl-amd-mono (a04ceab)
c1 points TP1, TP2, TP4 TP1

This base is SemiAnalysisAI#4832's earlier head 13f2b0e3 plus one commit: patches 09 and 10, and c1 at TP2 and TP4.

AI model disclosure
  • Model/version: claude-opus-5-5 (Claude Code).
  • Role:
    • assembled this branch from prepared files;
    • generated patches 16, 21 and 24 from the measured code, rebased onto patches 01-15;
    • set patch 11's row cap to the upstream PRs' 380 and edited a code comment in patch 15;
    • kept the patch headers' upstream references current;
    • checked that the patches apply in order on the image's source revisions, and ran the changelog and matrix checks;
    • compared run 44408546542 with run 43505902743 from the runs' results and logs;
    • wrote this description.
  • The patch files and the recipe, setup-script, master-config and changelog edits were prepared in earlier Claude Code sessions whose exact model could not be verified here.
PR checklist and change type

Type of Change

  • Bug fix
  • New feature
  • Configuration change
  • Documentation update
  • Other (please describe)

Checklist

  • I have completed the AI model disclosure and kept it current
  • I have tested my changes locally
  • I have updated documentation if necessary
  • If python -m infx.matrix.changed --base origin/main lists affected config keys, I have appended one new entry covering them to the physical end of inferencex-e2e/perf-changelog.yaml; if it lists none, I have added none. I have not edited historical entries
  • If this PR appends an inferencex-e2e/perf-changelog.yaml entry, it carries exactly one primary sweep label (a maintainer applies it on fork PRs): full-sweep-fail-fast (recommended), full-sweep-enabled, or non-canary-full-sweep-enabled. Optional modifiers all-evals, evals-only, and agentx-fast require a primary label; the last two block reuse while applied.
  • Before merging via reuse, a maintainer with write access to the repository has commented /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.
中文

状态(2026-11-19): 本 head 合入 main 后在 SemiAnalysisAI/InferenceX#5133 上完成了一次非官方运行 44408546542,16 个作业中 14 个成功。c48 基准测试与 c80 GSM8K 在集群的 host setup 阶段、服务器启动之前失败,需要重新运行。

概要

本 PR 为 MI355X 上的 Qwen3.8-Flash-Next FP4 SGLang AgentX 配方(qwen3.8next-fp4-mi355x-sglang-agentic-mtp)新增八个可选内核补丁(11-16、21 与 24)。它们来自尚未合并的上游 PR,为 gfx950 提供 QSA verify 与稀疏 prefill attention、QSA block 选择、MXFP4 MoE、hyper-connection prefill 以及 GDN verify 的内核;并发 12-80 启用它们。

改动

  • 补丁 11-16、21 与 24 由 qwen3.8next-rocm10-patches.sh 在补丁 10 之后按此顺序应用;编号 17-20、22 与 23 不在本分支中。
  • 未设置对应变量时补丁不生效。每个补丁文件的头部注明其上游 PR、head commit 以及与该 PR 的差异。
  • 并发 12、24、48、80 设置全部八个变量;并发 1(TP1、TP2、TP4)与并发 2 均不设置。c1 与 c2 运行 monokernel,由它执行补丁 11、14、21 与 24 所改动的 decode、verify 与 draft 步骤。
  • 所有 monokernel 测试点设置 SGLANG_AMD_MONO_QWEN38_DRAFT_HEAD_FP8=0,MTP draft 的 lm_head 以其发布时的精度运行,而不是使用补丁 10 的 FP8 副本。
  • 没有补丁降低目标模型或 MTP draft 中任何权重或激活的数据类型。
  • 删除 default-chat-template-kwargs: '{"enable_thinking": false}',与 main 上的条目一致:服务器采用 chat template 的默认设置,即 harness 注入的 acceptance length 所对应的 thinking 模式。
  • 不变的部分:镜像、AITER wheel、补丁 01-10、八个测试点、两个 GSM8K 评估组,以及其他所有参数与变量(明细见上方“Unchanged settings, and this base against [AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang agentic MTP: ROCm 10 image 20261117 + 7 upstream-PR patches, conc 1/2/12/24/48/80 / [AMD][MI35X] Qwen3.8-Flash-Next:ROCm 10 镜像 20261117 + 7 个上游 PR 补丁,并发 1/2/12/24/48/80 SemiAnalysisAI/InferenceX#4832”)。

验证

本 head 合入 main(ba2e5a9e)后的非官方运行 44408546542 与基线运行 43505902743 对比:

  • 失败的作业: c48 基准测试与 c80 GSM8K,均在同一节点上、服务器启动之前失败(host_setup:"GPUs still draining prior job's memory after 60min")。
  • c12、c24 与 c80(启用补丁):P90 E2E-normalized interactivity 分别为 +17.8 %、+26.0 % 与 +36.9 %;每 GPU 吞吐量分别为 +5.0 %、+4.1 % 与 +19.2 %。
  • c1 与 c2(不启用补丁):P90 E2E-normalized interactivity 为 −2.9 %(c2)、−1.1 %(TP2 c1)与 −4.3 %(TP4 c1)。TP1 c1 为 +19.1 %,但基线运行的该行低于该配置键已发布的 c1(运行 41882345112)。
  • 与基线运行的其他差异: 开启 thinking(本 PR 删除 enable_thinking: false),以及来自 main 的 AgentX harness 1.0.14(基线为 1.0.13)。
  • 精度: 七个评估点的 GSM8K strict 为 0.9757-0.9795(thinking 开启),基线运行为 0.9689(c2)与 0.9682(c80);c2、c12、c24 与 c48 的 acceptance length 为 2.487-2.723,高于 golden 2.32(该检查仅作报告)。

逐点数据、日志与 KV 数据类型见上方“Validation details”。

上游组件

各补丁的改动、上游 PR(2026-11-18 均未合并)与变量见上方表格。与上游 PR 的差异:

Draft 精度

MTP 层发布时为 MXFP4 专家、FP8 E4M3 的 attention 与 indexer 投影、BF16 的 hyper-connection、router 与 norm,并使用目标模型的 BF16 lm_head。也作用于该层的补丁保持这些数据类型:

  • 13:作用于其 prefill,Q、K、V 为 BF16,与 Triton 路径相同。
  • 14:与目标模型相同地对其 MoE 做 padding:MXFP4 字节不变,640 列而非 768 列。
  • 15:作用于其超过 128 行的 hyper-connection 位置(prefill,以及 33 个请求起的 verify 与 draft extend),把 norm 折叠进 BF16 权重。
  • 16 与 21:在其 draft extend 中用同样的 fp32 分数(BF16 的 query 与 key)选择 QSA block。

补丁 11 与 24 只作用于目标模型的 verify。

AI 模型使用说明

  • 模型/版本:claude-opus-5-5(Claude Code)。
  • 工作内容:基于预先准备的文件组装本分支;从实测代码生成补丁 16、21 与 24(rebase 到补丁 01-15 之上);把补丁 11 的行数上限改为上游 PR 的 380,并修改补丁 15 中的一处代码注释;保持各补丁头部的上游引用为最新;检查各补丁能按顺序应用到镜像的源码版本上,并运行 changelog 与 matrix 检查;根据两次运行的结果与日志对比运行 44408546542 与 43505902743;撰写本说明。
  • 补丁文件以及配方、setup 脚本、master 配置与 changelog 的改动由更早的 Claude Code 会话准备,其具体模型无法在此确认。

改动类型:配置变更。

🤖 Generated with Claude Code

eppaneamd and others added 3 commits November 18, 2026 11:35
…at its shipped precision

Patches 11-15 add opt-in kernels, each off unless the recipe sets its SGLANG_AMD_* variable;
c12, c24, c48 and c80 set all four:
- 11 grouped QSA verify scoring (sgl-project/sglang#48625, carries #46631)
- 12-13 FlyDSL QSA sparse prefill (ROCm/aiter#7556 kernels, 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)

Every monokernel point sets 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…patches

Drop the header and section comments added for patches 11-15 (AGENTS.md
Comments); keep the line comments on the variables and move the draft-head
reason to its first flag. The setup script uses set -eo pipefail (AGENTS.md
Bash: no nounset). The changelog entry states that no patch lowers the dtype
of a weight or an activation.
Patches 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:
- 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)

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
@eppaneamd eppaneamd changed the title [AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP: opt-in QSA, MXFP4 MoE and HC prefill kernels on the update-monokernel recipe / [AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP:在 update-monokernel 配方上启用 QSA、MXFP4 MoE 与 HC 预填充可选内核 [AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP: opt-in QSA, MXFP4 MoE, HC prefill and GDN verify kernels on the update-monokernel recipe / [AMD][MI35X] Qwen3.8-Flash-Next FP4 SGLang AgentX MTP:在 update-monokernel 配方上启用 QSA、MXFP4 MoE、HC 预填充与 GDN verify 可选内核 Nov 18, 2026
eppaneamd and others added 2 commits November 18, 2026 17:10
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
…nly merge main

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Rony Leppänen <rony.leppanen@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant