Skip to content

npu: Qwen3-Coder-30B-A3B needs two more full_i8 sets (QKV K2048xN5120, D K768xN2048) before the NPU row can be measured #1035

Closed

Description

@bong-water-water-bong

The NPU row for the supreme scoreboard is blocked on two ELF sets, on the one model we hold in both formats

Context: ~/briefs/TSUPREME.md names NPU and HRX+NPU hybrid rows as the differentiation nobody else in the Strix Halo
container field can match, and asks for them as measured cells. This lane (pi-mosaic, the NPU split lane) went to see
whether such a row is measurable today, and the answer is "yes, after two kernel sets" — not after a device, a model
download, or a decision.

What we hold

Qwen3-Coder-30B-A3B is in the scoreboard's common model set, and it is the only model we hold in both formats:

format path bytes
GGUF Q4_K_M (the file the container engines are measured on) ~/models/Qwen3-Coder-30B-A3B-Instruct-Q4_K_M.gguf —
.q4nx (our NPU container) ~/models/npu/qwen3-coder-30b-a3b-moe/model.q4nx 19 528 322 120

hidden 2048, 48 layers, 128 experts, qwen3moe.

What the plan says, and what the kernel set has

tools/npu_plan.py <model dir> --kernels ~/1bit-MONSTER-iso-build/engine/npu/xclbins generates a valid plan
(format 1bit-npu-plan/1, 48 layers, layout rm, prefill.M 128, decode.M 16). Per-role shapes against that kernel
directory:

role K×N the plan asks for artifact present
qkv (fused) 2048 × 5120 full_i8_QKV_K2048_N5120.elf no (we have K1536_N5120, K2048_N3072)
down (MoE expert) 768 × 2048 full_i8_D_K768_N2048.elf no
gate / up / o 2048 × 1536 full_i8_{G,U,O}_K2048_N1536.elf yes
MoE expert gate/up 2048 × 8192 full_i8_{G,U}_K2048_N8192.elf yes

So: two M=128 sets (QKV K2048 N5120, D K768 N2048), and their _m16 twins if the decode twin path is wanted —
the same artifact-shaped gap as the 0.6B _m16 row this lane already declared unrun, and the reason it is worth saying
out loud is that it silently decides whether the NPU has a scoreboard row at all.

Why it matters more than the shape list suggests

  • Every container engine in the field (llama.cpp, ds4, ROCm FPX, gufo, Halogen) is iGPU-only. An NPU cell is the only
    structurally different row available to us, and the scoreboard's addendum asks for it together with power (tok/J),
    which is the axis an NPU can plausibly win even where it loses tok/s.
  • This lane's own measurements say what to expect on tok/s: our NPU prefill GEMM runs at 1.5 TFLOP/s against the
    iGPU's 29-41 on the same shapes, and an M-split between them is worth +1.3 % on a healthy GPU and +10-13 % on a
    throttled one (engine#754, docs/hetero-prefill.md). So the row is likely to lose prefill and to be interesting only
    on power and on decode-side offload — which is exactly why it should be measured rather than assumed.

Acceptance bar for the two sets (so this is not "build it and see")

  1. forward-serve loads the container with the two new sets plus the existing ones and answers /v1/chat/completions.
  2. The same identity gate this lane uses on engine#808: greedy output byte-identical and content logprobs bit-identical
    against the host-GEMM arm on the same container (~/p4-gate/logprob.sh + logprob-compare.py), and the per-launch
    taps identical on the folded route. A fast wrong engine does not count.
  3. Then the scoreboard rows: pp512 / pp4096 / tg128@d0 / tg128@8k / TTFT-2k, plus board power and tok/J, under an
    npu-hold ticket.

Whoever builds them: the family is full_i8_* (i8 activations, one kernel per role) as used by --kernels today; this
lane has the harness and the gate and will run step 2-3 as soon as the sets exist. No numbers are published anywhere
(blog rule); this issue carries shapes only.

Activity

  1. bong-water-water-bong commented on Nov 5, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Device-free inventory for whoever picks this up, measured on this box 2026-11-05 (not a claim on the issue — it stays
    unowned): a sweep of 9,753 *.elf under /home/bcloud finds no *_K2048_N5120* and no *_K768_N2048*, i.e. both
    sets this issue names really are absent, including their _m16, _b8 and pb16i variants.

    The nearest neighbours that do exist, in case one of them is a near-miss rather than a different shape:

    existing shape relation to this issue's ask
    full_i8_QA_K2048_N768, full_i8_QB_K768_N5120 K2048xN768, K768xN5120 the two halves of the Qwen3-30B-A3B attention pair, transposed: 768 = kv heads x head_dim, 5,120 = q+k+v
    full_i8_QKV_K2048_N3072(_b8, _b8_m16) K2048xN3072 a fused QKV, but at 3,072 columns (a 24-head/6-kv model), not 5,120
    full_i8_D_K10240_N2560, full_i8_O_K2048_N2048(_m16) — other models' down/o shapes

    So the container side of the row exists (48 layers, 128 experts, top-8, expert_ffn 768, no shared expert, 19,528,322,120 B,
    __metadata__.moe with 144 expert stacks x 128 offsets — docs/npu.md), and the two ELF families are the whole blocker:
    host-side this lane's reference, gate artifact and expert-chunk tooling already run over that container.

  2. bong-water-water-bong commented on Nov 5, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Second device-free data point, and it turns the ask from a reading of the model into the plan's own output: on origin/main
    6211c2fe, tools/npu_plan.py ~/models/npu/qwen3-coder-30b-a3b-moe --print (qwen3moe, hidden 2,048, 48 layers, container
    layout: rm, chunk_kind: mode0, pb16i: false, decode M: 16) emits these per-layer shapes:

    plan entry K N
    qkv (fused) 2,048 5,120
    gate_up (fused) 2,048 1,536
    down 768 2,048

    So both families this issue names are what the plan asks for at every one of the 48 layers, and down is the same
    K768 -> N2048 shape the routed experts need, i.e. one family serves both the layer and the expert stack. moe.batched_expert_gu
    prints enabled: false, K: 0, N: 0 as generated, so the expert gate/up is not yet a plan entry either.

    Against the box's ELF inventory, the exact names are absent in every variant (_m16, _b8, pb16i), while the nearest
    neighbours are full_i8_G_K2048_N1536.elf / full_i8_U_K2048_N1536.elf (the unfused gate and up at 1,536) and
    full_i8_QB_K768_N5120.elf (the transposed attention pair). Nothing here changes the issue's scope; it just confirms the
    two names are the plan's, not a guess, so an arena build can be scoped from the plan alone.

  3. bong-water-water-bong commented on Nov 6, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Disposition: parked on the private NPU kernel-set program — every other piece of this row is in place.

    The issue's own tables already establish this: tools/npu_plan.py <dir> --kernels <kernel-dir> generates a valid plan for the 30B-A3B MoE (48 layers, layout rm, prefill M=128, decode M=16), and the per-role shape check against the kernel directory shows exactly two missing artifact families:

    role K x N the plan asks for artifact present
    qkv (fused) 2048 x 5120 full_i8_QKV_K2048_N5120.elf no (we have K1536_N5120, K2048_N3072)
    down (MoE expert) 768 x 2048 full_i8_D_K768_N2048.elf no
    gate / up / o 2048 x 1536 full_i8_{G,U,O}_K2048_N1536.elf yes
    MoE expert gate/up 2048 x 8192 full_i8_{G,U}_K2048_N8192.elf yes

    plus the _m16 twins if the decode-twin path is wanted. Those sets are authored in the private NPU-kernels repository (the same outside-this-repo split as #812's driver patches and #796's ELF set), not generated by anything in the engine repo's CI surface; no engine-side change can produce them, and the issue itself says the row is blocked "only on the two kernel sets", not on a device, a model download or a decision.

    Unpark: the private NPU kernel lane generates QKV K2048 N5120 and D K768 N2048 (and the m16 twins), tools/npu_plan.py --kernels <dir> shows every role present, then the row is measured on the model we hold in both formats (~/models/npu/qwen3-coder-30b-a3b-moe, 19.5 GB) against the GGUF Q4_K_M baseline.

  4. bong-water-water-bong commented on Nov 6, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The two missing kernel sets are built — this unparks the row. Compile-only, no device was opened, on the box's pinned NPU toolchain.

    Built

    artifact bytes
    full_i8_QKV_K2048_N5120.elf 2,155,272
    full_i8_QKV_K2048_N5120_m16.elf 333,064
    full_i8_D_K768_N2048.elf 364,680
    full_i8_D_K768_N2048_m16.elf 86,952

    In ~/models/npu/qwen3-coder-elfs/ (compile logs beside them), with the prefill family at M=128 (v26, 32x64x128) and the _m16 decode twins at M=16 (v27 -r 1, 16x64x128) — the same recipe that built the d3-lite set (engine#796 rung 2).

    Toolchain, per ~/wt/npu-arena/TOOLCHAIN.lock: aiecc from the wheel venv ~/amd-oss/iron-upstream-venv (mlir-aie 1.4.4.dev53+gd53582d), Peano/llvm-aie 22.0.0.2026091701+773413fb, --get-full-elf (required by this aiecc: --full-elf-name alone exits 0 and writes nothing). Generators: ~/1bit-MONSTER-iso-build/engine/npu/generators/ (n1_core_i8_v26.py / v27.py, mm_kernel_reference.cc). Geometry from the plan's own output in this issue: qkv K2048 N5120, down K768 N2048, 48 layers, layout rm.

    What this changes

    The row is no longer blocked on kernel authoring: with this set plus the artifacts already present for gate/up (K2048 N1536) and MoE expert gate/up (K2048 N8192), every role the plan asks for has a full ELF. The remaining work is the measurement itself — stage the kernels dir (xclbins artifacts + these four), run the 30B-A3B pack through forward-serve on the NPU under an npu-hold ticket, and record the row against the GGUF Q4_K_M baseline. That is a device run, not a build.

  5. bong-water-water-bong commented on Nov 6, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Progress after building the missing sets: the NPU row now initialises on the device — and the next blocker is a container-metadata disagreement, not kernels.

    Built (all in ~/models/npu/qwen3-coder-kernels, M=128 + _m16 decode twins)

    artifact bytes
    full_i8_O_K4096_N2048.elf 1,720,584
    full_i8_O_K4096_N2048_m16.elf 270,088
    full_i8_GU_K2048_N1536.elf 664,120
    full_i8_GU_K2048_N1536_m16.elf 117,992

    (plus the QKV K2048 N5120 and D K768 N2048 from the previous comment). The plan derived four designs from the model's own config: QKV H=2048 -> 5120, O NH*HD=4096 -> H=2048, GU IM=768 -> 1536 (fused, cols 6), D 768 -> 2048.

    Device run (npu-hold ticket 01793977592491894553.1035-row2, 0 s wait, die 37 C)

    • npu-hold -> forward-serve -m qwen3-coder-30b-a3b-moe/model.q4nx --kernels ~/models/npu/qwen3-coder-kernels;
    • health ok, device fds = 1, all four roles loaded in both families ([forward] decode family: 4 role(s) at M=16), server ready (full ELF);
    • completion request fails fast with: forward step failed: MLP dequant : data_size 0 at geometry 768x2048 = 192 tiles (chunk 0 B is not a kind, and no padded grid fits): the container and config.json disagree.

    What that means

    The kernel-set gap this issue was about is closed — every design the plan asks for exists and loads on the array. The remaining blocker is the model.q4nx container's down-projection metadata: its chunk/layout information does not describe the 768x2048 geometry the config declares, so the dequant path sees no chunk kind (same family as #1110's foreign tile-order containers). That is converter/container work on the model file, not kernel authoring, so this issue can move from "blocked on kernel sets" to "needs the 30B container re-converted/normalised"; the row is one container fix away.

  6. bong-water-water-bong commented on Nov 6, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Root cause of the MLP dequant : data_size 0 … chunk 0 B is not a kind failure: the container's expert tensors are stored in a different chunked shape than the engine's derived designs expect — this is a converter/container mismatch, not the kernel sets.

    Container header (model.q4nx, 302,144-byte JSON header)

    tensor dtype shape
    model.layers.0.mlp.experts.gate_proj.weight I8 [3072, 8, 5120]
    model.layers.0.mlp.experts.down_proj.weight I8 [8192, 3, 5120]
    model.layers.0.self_attn.q_proj.weight (dense) I8 (scalar-shape path, loads fine)

    config.json says hidden 2048, intermediate 768, 128 experts, 8 active; the plan derives gate_up K2048 N1536 (fused, 32 folds), down 768x2048 (192 tiles). The engine's MoE dequant reads a chunk-kind byte and finds none it recognises at the expert geometries, so it reports data_size 0 … the container and config.json disagree.

    The container was made by tools/gguf_to_q4nx.py from Qwen3-Coder-30B-A3B-Instruct-Q4_K_M.gguf (per its own config.json q4nx_source). The dense/attention tensors load and the four NPU designs init fine (health ok, device fds 1, 4 roles at M=16); only the MoE expert dequant path is mismatched.

    Next step

    Re-convert the GGUF with the current engine converter (matching the engine's expected expert chunk kind/grid — mode0, layout rm, pb16i false, and the expert tensors' 2-D geometry rather than the [8192,3,5120] blocked form), then re-run: forward-serve -m model.q4nx --kernels ~/models/npu/qwen3-coder-kernels, which now loads every design the plan asks for.

    Kernel-set status in this issue is done: QKV K2048 N5120, O K4096 N2048, GU K2048 N1536, D K768 N2048 all exist in M=128 + M=16 families and initialise on the array. The row is one container re-conversion away.

  7. bong-water-water-bong commented on Nov 6, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    The container now loads and answers on the device — row measured, next blocker named. Fix: PR #1266.

    Root cause of the MLP dequant : data_size 0 at geometry 768x2048. tools/gguf_to_q4nx.py writes the engine's own MoE convention: num_experts/num_experts_per_tok in config.json, router mlp.gate.weight, stacks mlp.experts.{gate,up,down}_proj.weight with a plain [N][K] per-expert tile grid. The forward read the FastFlowLM-style convention (n_expert/top_k, moe_router.weight, *_exps_proj names, [K][N] slice grid), so n_expert_ was 0 and layer 0 took the dense path looking for a mlp.gate_proj.weight the container does not carry. The grid would have been the next silent failure: converter slice vs GGUF correlates 0.99999 on [N][K], 0.00855 on [K][N] (expert 0). PR #1266 teaches the forward both conventions (detected from layer 0), falls back on the config keys, decodes with the right geometry, accepts a fused-GU plan's batched GB/UB designs (it required split G/U before), and keeps moe_mlp's failure reason. CI test npu_moe_container is a known-answer decode.

    Device row (strixhalo, one npu-hold ticket: queued 11:16:45, held 196 s, released 11:20:01, amdxdna errors 0; current main a6c9bf5 + PR #1266): 48 layers, 6 designs, 4 M=16 roles, device fds: 1, every request HTTP 200.

    • 5-token prompt + 1 token: 50.3 s cold / 23.5 s warm → prefill 0.21-0.23 tok/s
    • 8 tokens decoded in 58.4 s → 0.137 tok/s decode (7.3 s/token)
    • baseline for scale: in-tree HRX GGUF Q4_K_M row coder30b-hrx-solo-20261030 = 84.33 tok/s; CPU llama.cpp on the same GGUF/box, same prompt = 29.2 tok/s decode / 49.4 tok/s prefill.

    Next blocker (throughput, named). 7.3 s/token is the host-side per-token dequant of the top-8 experts: ~1.1 GB of q4_1 tiles per token (8/128 x 3 projections x 48 layers) decoded and packed per layer. The device-resident/streamed expert path (the chunk-list dispatch direction in docs/npu.md, "Routed expert stacks") is what a competitive row needs; this PR only makes the container readable by the existing per-token path.

    Fidelity note. On the same prompt the short completion differs from llama.cpp's, but the container is a requantisation of that GGUF and the docs already measured that 32/48 layers route a different top-8 for a 0.5 % hidden-state difference; single-token comparisons are not the gate. The next fidelity measurement is aggregate KLD/perplexity against the container's own host reference (tools/moe_q4nx_ref.py).

  8. bong-water-water-bong commented on Nov 6, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Resolved: the NPU row for Qwen3-Coder-30B-A3B is now measurable and measured. The issue's ask — two kernel sets before the row could be measured — is done, and the row exposed the next (already-named) blocker.

    Kernel sets (the ask)

    Built and loading on the array (~/models/npu/qwen3-coder-kernels, M=128 prefill + _m16 decode twins):

    role K x N bytes (prefill)
    QKV (fused) 2048 x 5120 2,155,272
    O 4096 x 2048 1,720,584
    GU (fused) 2048 x 1536 664,120
    D 768 x 2048 364,680

    Toolchain per ~/wt/npu-arena/TOOLCHAIN.lock (mlir-aie 1.4.4.dev53+gd53582d, Peano 22.0.0.2026091701, --get-full-elf).

    The container mismatch, and the fix

    The first run then failed in MLP dequant (data_size 0 at geometry 768x2048 … chunk 0 B is not a kind). Root cause measured, not inferred: tools/gguf_to_q4nx.py writes the engine's own MoE convention (HF num_experts/num_experts_per_tok, mlp.gate.weight, mlp.experts.*_proj.weight on a [N][K] per-expert tile grid), while the forward read the FastFlowLM convention (n_expert/top_k, moe_router.weight, *_exps_proj, [K][N] grid) — so n_expert_ stayed 0 and layer 0 took the dense path. The grid half would have been the next silent failure: converter slice vs GGUF corr 0.99999 on [N][K], 0.00855 on [K][N]. A second blocker fell out: the fused-GU plan's batched GB/UB designs were rejected by the split-G/U requirement.

    Fixed in PR #1266: npu/forward/include/moe_container.h (both conventions in one table), detection from layer 0, config-key fallbacks, convention-aware mla_expert geometry, batched GB/UB accepted, moe_mlp failure reason preserved; CI test npu_moe_container is a known-answer decode through the shipped q4nx_dequant.c (both spellings/keys/geometry), 8/8 ctest subset on current main, copyright clean.

    The row (strixhalo, npu-hold ticket: queued 11:16:45, held 196 s, released 11:20:01, amdxdna errors 0)

    • 48 layers, 6 designs (4 M16 roles), device fds 1, all requests HTTP 200;
    • prefill 0.21-0.23 tok/s (5-token prompt: 50.3 s cold / 23.5 s warm);
    • decode 0.137 tok/s (8 tokens in 58.4 s = 7.3 s/token);
    • scale: in-tree HRX GGUF Q4_K_M row 84.33 tok/s; CPU llama.cpp same box/prompt 29.2 tok/s decode, 49.4 prefill.

    Next blocker (named, out of this issue's scope)

    7.3 s/token is the host-side per-token dequant of the top-8 experts — ~1.1 GB of q4_1 tiles per token (8/128 x 3 projections x 48 layers) decoded and packed per layer. A competitive row needs the device-resident/streamed expert path (chunk-list dispatch, docs/npu.md "Routed expert stacks"); this fix only makes the existing per-token path able to read the container. Fidelity caveat: the short completion differs from llama.cpp, but per the docs' own measurement 32/48 layers route a different top-8 for a 0.5% hidden difference, so single-token text is not the gate — aggregate KLD/perplexity against tools/moe_q4nx_ref.py on this container is the next fidelity measurement.

    Closing: the two sets exist, the container is read correctly under a test, and the NPU row is a measured number with its next lever identified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions