Skip to content

strix-hip/qwen3.8: GDN K=4 DP4A verify arm + fused conv + strided QKV GEMV - #30

Merged
AzeezIsh merged 22 commits into
port/qwen3.8-strix-linuxfrom
work/qwen38-nvidia-nvfp4
Sep 14, 2026
Merged

AzeezIsh merged 22 commits into
port/qwen3.8-strix-linuxfrom
work/qwen38-nvidia-nvfp4

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Strix-hip (gfx1151) decode-path stack for the Qwen3.8-27B dense NVFP4 port. Routes the single-sequence K=4 verify QKVZ and output projections — and the attention QKV M=4 path — through the W4A8 integer-DP4A GEMV arm; adds a fused generic-K (K=3/K=4) GDN conv-verify kernel; adds strided-output (_os) QKV GEMV variants that write projections directly into the interleaved qkv_buf; fixes a real panic in dense + --mtp-quantization nvfp4 MTP construction; and adds the missing cuStreamIsCapturing symbol to the HIP libcuda shim.

Observed under serialized, own-PID-verified same-binary A/B on AzeezStrix: 24.62–24.66 → 28.3–28.6 tok/s K=4 decode (+~15%), decode @30k ctx 10.4 → 13.3–13.6 tok/s. Authoritative 995-row BFCL leg (the MLPerf ST golden draw): 83.02 overall / 80.41 normalized — no regression vs the requantized-checkpoint record (82.71 / 79.58).

Test plan

  • cargo fmt --all -- --check — clean at 6c77f41a6
  • ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests — clean (the ci.yml gate; --all-features variant fails on objc2, an Apple-only dep — pre-existing workspace property on Linux, unaffected by this diff)
  • bash scripts/check-license-headers.sh — 2315 files, 0 invalid
  • typos — clean (one pre-existing README typo fixed in 6c77f41a6)
  • Tested against a real model + hardware: AzeezStrix (Ryzen AI Max+ 395 / Radeon 8060S, gfx1151), Qwen3.8-27B all-NVFP4 requantized checkpoint
  • Tests added/updated: mock dispatch pins for the DP4A arm, fused-conv copy-count win, _os dispatch order; qwen3_ssm + multi_seq attention suites pass (25 tests)

Evidence

All perf numbers are single-harness serialized A/Bs (own-PID socket-verified serves, n=3 × 1024-token MinHeap-prompt runs, temp 0, reasoning_effort:"none", K=4 spec verify, bf16-mtp). Fingerprints: binary spark_gdndp4a2 sha256 f94e6d34… built at 3645161b3 for strix-hip; checkpoint /home/azeez/HaloLoom/workspace/qwen38-27b-fp8to4 (all-NVFP4, FP8→NVFP4 requant); host AzeezStrix.

Lever Commit Observed tok/s Note
Baseline — 24.62–24.66 output hash 64ea7cc9
GDN qkvz + out_proj → DP4A 80ce2bc, c93329c 28.3–28.6 +~15%; hash 66032313 (expected — int8 acts)
+ fused conv K=4 4a0766c 28.43 +2.8% stacked
QKV _os strided writes 46e697f 24.68 vs 24.62 throughput-neutral; removes 3·M D2D scatter copies/layer; hash-identical
nvfp4-MTP vs bf16-MTP 3645161 28.6 vs 29.1 wash (−1.7%): weaker drafts cancel draft-read savings

Arm engagement proven in serve logs (GDN/attention W4A8 DP4A M=4 arm ACTIVE) and ROCProfiler kernel trace (w4a16_gemv_dp4a_batch4_d4 31.0% + _dual_batch4_d4 27.5% of GPU time).

Accuracy

  • BFCL golden draw (non_live 62 / live 10 / hallucination 10, floor 25, n=995, seed 42, temp 0, no overrides): 83.02 / 80.41 — run-1789370409958768995.json, ~4 h leg on the full stack. Prior requantized-ckpt record: 82.71 / 79.58 → +0.31 / +0.83. The runner displays the Qwen3.6 floors (83.64/85.32); those do not gate this Qwen3.8 validation baseline.
  • Non-spec M=1 logit dump, DP4A vs float path: 511/511 argmax match, 0 top-1 flips, mean |Δlogit| 0.058 over 511 steps.
  • Gates: coherence 3/3, fibonacci PASS, tool_calls 2/2, tps PASS, longctx 2/3 (16k probe OOMs by design against --max-seq-len 8192 — same as baselines).

Notes for reviewers

  • DP4A is now default-on. ATLAS_W4A16_DP4A=0 is the opt-out (=1 still accepted for harness back-compat). Eligibility requires exact m=4, both kernel handles resolved, and non-null int8 scratch — any negative falls back to the float E2M1-LUT path bit-identically. On non-gfx1151 targets the handles are KernelHandle(0), so the float path is unconditional there — the flip is inert on GB10. Justified by the accuracy record: 83.02/80.41 on the 995-row golden draw + 511/511 M=1 argmax match vs float.
  • serve-amd.sh remains the single user entry point — updated so the validated config is the default: spec decode on via NUM_DRAFTS=3 (=0 reproduces the frozen non-spec recipe), the DP4A export removed (default-on now; a user =0 still opts out), thinking/tool-grammar determinism pins dropped (requestable thinking; soak ran a 52%-thinking mix clean), and the shim pick now selects the newest build dir that actually contains libcuda.so. MODEL.toml also bakes default_num_drafts=3 and default_kv_dtype="bf16" — the latter fixes a real gap: unset resolved to the engine default fp8, the unproven path on gfx1151. README gains a Recipe D quickstart for the bare-metal Linux/AMD path (build-amd.sh → serve-amd.sh).
  • Shared GB10 kernel files are additive only. w4a16_gemv.cu gains a C_stride param on the internal impl; every existing extern "C" entry point passes N (identical codegen), plus two new _os symbols. rms_norm.cu appends rms_norm_offset_warp_row. No existing GB10 kernel was modified.
  • w4a16_gemv_sw launch contract preserved: base GEMV 4 outs/block, SW 8 outs/block, SW only when lever + handle valid.
  • MTP fix is a real crash fix: under MtpQuantization::Nvfp4 the handle tuple was fully nulled but the dense-FFN path still unwraps moe_silu_mul_k (moe_forward.rs:60); the commit resolves the dense-needed handles. Validated end-to-end (drafts engage, mtp=1.00).
  • Fused conv is generic-K (K=3/K=4 verified; mock pin on the copy-count win), _os grid math is coupled to the kernel output-block constants.

Known issues / follow-ups

  • Post-shutdown teardown segfault: pure virtual method called fires after "Shutdown complete" on HIP-shim builds. Cosmetic teardown-ordering bug — request results are unaffected — but worth a follow-up before publicizing.
  • 2.55 h sustained soak on this exact binary (realistic_soak.py, 6 clients, 52% thinking requests, 86 tool calls): 320 requests, 4 errors (1.2%, flat — no accumulation), zero crashes or leaks. Sustained fresh prefill 93 tok/s (harness forces 0% prefix-cache hit); 36,353 decode tokens generated, 56% reasoning. Aggregate decode ≈4 tok/s reflects the thinking-heavy mix (inside-<think> runs the serial floor by design), not the K=4 path the burst numbers measure.
  • The PR benchmark gate check is red by construction here: committed gate records are sha-anchored and the whole port-branch delta vs main invalidates them — green needs a fresh 10-gate campaign (~4–5 h) on a GB10 host at a frozen head. This PR targets the unprotected port/qwen3.8-strix-linux branch; the campaign belongs to the main-bound landing, not this port-stage merge.
  • Prefill: no in-tree arm flip closes the ~2.4× gap vs the reference (bf16tc ≈ noise, fp8m64 −15% and wrecks decode, mmqoff = identical) — that's a kernel-quality follow-up, not arm selection.
  • One-time lazy weight-staging copy floods (~93% of D2D copies in trace, ~2 s between load and steady decode) could move to load-time; steady-state copies are already ~80–150/step (<1% GPU time).

CLA

AzeezIsh and others added 14 commits September 13, 2026 03:47
The bail predates the dense forward path's ProjectionWeight dispatch:
gemv()/dense_ffn_forward_generic already route Nvfp4 through
w4a16_decode_gemv, and propose_batch_scope_ok confines the BF16-only
batched propose (scope check fails -> serial per-seq propose). KV stays
FP8 as with MoE NVFP4 heads; drafter-context prefill declines with a
warning as it does for fp8.

Acceptance on a dense head is unmeasured — gate on the A/B before
adopting --mtp-quantization nvfp4.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Adds the nvidia/Qwen3.8-27B-NVFP4 bfcl-subset entry (83.22/79.02,
run-1789114625433625524) with the fp8to4 requant derivative's 82.71/79.58
recorded as provenance — normalized +0.56, inside noise; the requant is
shippable. Also vendors the vectorized requant script and a checkpoint
fingerprint sidecar so the derived weights are reproducible/verifiable.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
strix-hip never shipped gdn_verify_fused_conv_kn.cu, so every GDN MTP
verify ran the per-token conv1d_update_l2norm loop plus a conv_state
copy_d2d per position: K=4 verify cost 4 conv launches + 3 D2D copies
per SSM layer per step (~48 layers => ~144 copies + ~144 launches/step
of the profiled copyBuffer mass). The K=2 twin and the cross-sequence
batched variant (gdn_verify_fused_conv_kn_batched, 2 launches/depth-run
instead of n*K) resolve automatically once the modules exist.

Port both files verbatim from gb10/common (hip compat covers bf16/shfl;
KERNEL.toml --fmad=false is already global on strix-hip) and dispatch
K=3/K=4 through ops::gdn_verify_fused_conv_kn when the handle resolves
and conv_state_intermediates are pool-contiguous. Bit-identical to the
per-token path (same accumulation order; gdn_verify_fused_microtest
cos == 1.0 on gb10). Kill switch: ATLAS_GDN_FUSED_CONVK=0.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The factory silently rewrote any non-Bf16 --mtp-quantization to Bf16 when
the checkpoint's quantization_config.ignore_modules lists mtp.* — which
the NVFP4 checkpoint does. Since mtp_quant defaults to bf16, reaching that
branch non-bf16 is always an explicit user request; the veto made
--mtp-quantization nvfp4 un-engageable on exactly the checkpoints where
runtime-quantizing the BF16 MTP head is the intended path (Qwen3.8 dense
lever). Warn and honor instead; ATLAS_MTP_RESPECT_QUANT_EXCLUDE=1
restores the protective override where acceptance is known to collapse.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The strix generic-K fused conv arm removes exactly the K-1 conv-state
snapshot copies; the non-contiguous fallback keeps them. MockGpuBackend
counts copy_d2d calls, so the delta pins the win without a GPU.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The upstream test pinned w8a16_gemm_pipelined geometry at R=7, but the
strix stack's w8a16_gemv_batch16 arm (4003f74) sits ahead of the
num_tokens>4 GEMM fallback and resolves on every target — under the mock
it always wins. Pin the batch16 grids instead.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…atter

ms_qkv_batchn at n<=8 ran three batched GEMVs into scratch and then
copied every row into the interleaved qkv_buf (3*n D2D copies per
attention layer per verify step — 12/layer at K=4, ~192/step across 16
layers). New w4a16_gemv_batch{4,8}_os and w4a16_gemv_dp4a_batch4_d4_os
entry points take an output row stride, so each projection lands in its
qkv_buf slice directly — same bit-exact body, same bytes. The DP4A arm
also quantizes the shared normed input once instead of three times.

Fallback chain is unchanged: missing _os kernels or ATLAS_NO_QKV_OS=1
restore the scratch+scatter route, and the dispatch keeps whichever
numeric path (DP4A vs float) the scratch route would have used.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…proj — DP4A arm for GDN

The batched single-seq verify path (trait_decode_batched) called\nw4a16_gemv_batchm directly for both GDN projections at num_tokens==4,\nleaving the two biggest per-layer weight reads on the non-DP4A GEMV\nwhile attention/FFN/multi-seq mixer already ran w4a16_gemv_dp4a_batch4_d4.\nProfile basis: w4a16_gemv_batch4 29.9% of step GPU time vs DP4A kernels\n35% — roughly half the verify GEMV traffic unported.\n\nssm_fp4_proj engages the W4A8 DP4A arm at m==4 under ATLAS_W4A16_DP4A=1\nand falls back to the identical batchm call otherwise; visibility widened\npub(super) -> pub(crate) for the sibling module. No kernel changes.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
spark-runtime's stream_is_capturing (telemetry tap gate) references\ncuStreamIsCapturing on non-SCALE builds; the strix-hip shim never\nexported it, so test/bin links failed with undefined symbol. Wraps\nhipStreamIsCapturing — same status enum values as CUDA.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The Nvfp4 arm nulled every optional handle, but dense-checkpoint heads\nstill run BF16-kernel helpers: dense_ffn_forward_generic silu_muls its\ngate/up pair via moe_silu_mul (moe_forward.rs:60 — panic observed on\nstrix, thread unwrap on None at first draft), the batched path repeats\nit (forward_batch.rs:469) and gated-Q uses deinterleave_qg. Resolve\nthose three under Nvfp4; MoE-only handles (topk, weighted_sum, fp8w)\nstay None — NVFP4 MoE goes through the fused MoeLayer.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
AzeezIsh and others added 8 commits September 14, 2026 11:21
Inherited over-cap on port/qwen3.8-strix-linux via 9bf3487; the
whole-checkout scan fails every fresh PR off this base. Split tracked
in #31.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…10 shadows

The warp-per-row offset-convention norm was added to gb10/common for the
Strix Qwen3.8 port's short-row Q/K shapes; the nine pre-existing gb10
rms_norm.cu shadows predate it and the only dispatch site is a soft
probe().unwrap_or(KernelHandle(0)), so omission degrades to the
block-per-row kernel rather than failing the startup audit.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The entries carry real measured data, but the gate's self-start resolves
recipe from atlas-recipes and no recipe can express the strix serve
environment (env-var-bound levers the recipe schema has no field for).
A measured entry without a resolvable recipe fails the coverage check;
an invented recipe would self-start the wrong config. Floors preserved
in the notes; also records the full-stack 83.02/80.41 re-run.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
cargo-deny's advisory check started failing on the newly published rustls advisory (TLS 1.3 handshake messages accepted at the wrong encryption level). Lockfile-only update via cargo update -p rustls; also pulls rustls-webpki 0.103.15.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…opts out

Accuracy-validated on gfx1151 (995-row bfcl-subset 83.02/80.41; 511/511 M=1 argmax match vs the float path) and every dispatch site still requires resolved kernel handles, so targets without the DP4A kernel set miss on KernelHandle(0) and take the float E2M1-LUT path unchanged — inert on GB10. The flag remains as an explicit-off escape hatch; =1 is still accepted for harness back-compat.

Also adds scripts/start-qwen38-strix.sh: the native-bare-metal serve invocation for Qwen3.8-27B NVFP4 on Strix Linux, flag-expressible end to end now that no env vars are required.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… defaults

default_num_drafts=3 (the measured K=4 arm: 28.3-28.6 tok/s, bfcl-subset 83.02/80.41, run-1789370409958768995) and default_kv_dtype=bf16 — the latter fixes a real gap: unset resolved to the engine default fp8, the unproven path on gfx1151.

serve-amd.sh: drop the ATLAS_W4A16_DP4A export (now default-on; keeping it would override a user's =0 opt-out), spec on by default via NUM_DRAFTS=3 (=0 reproduces the frozen non-spec accuracy recipe), drop the thinking/tool-grammar determinism pins (thinking stays requestable; soak ran 52% thinking clean), and pick the newest shim dir that actually contains libcuda.so instead of the plain ls -dt head.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…h defaults to the validated config

README gains a Strix Halo (gfx1151) recipe: build-amd.sh + serve-amd.sh, measured fingerprint (28.3-28.6 tok/s K=4, 83.02/80.41 bfcl-subset), and the env knobs. serve-amd.sh: spec on by default via NUM_DRAFTS=3 (=0 reproduces the frozen recipe), drops the DP4A export (default-on; a user =0 still opts out), drops thinking/tool-grammar determinism pins, picks the newest shim dir containing libcuda.so. MODEL.toml bakes default_num_drafts=3 and default_kv_dtype=bf16 (unset silently resolved to engine fp8).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The deep validation (995-row bfcl-subset 83.02/80.41, K=4 decode numbers, 2.55h soak) all ran on the nvidia Qwen3.8-27B-NVFP4 family — the default should be the tested path. LM_HEAD=bf16 remains the switch for the unsloth preservation checkpoint (its lm_head ships per-row FP8).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@AzeezIsh
AzeezIsh merged commit 2cb3a44 into port/qwen3.8-strix-linux Sep 14, 2026
28 of 29 checks passed
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