Skip to content

vulkan : EXL3 matmul ops (EXL3_MUL_MAT and EXL3_MUL_MAT_ID) - #204

Merged
Nathanw1014 merged 16 commits into
halo-box:masterfrom
Nathanw1014:hb/exl3-vulkan
Dec 4, 2026
Merged

Nathanw1014 merged 16 commits into
halo-box:masterfrom
Nathanw1014:hb/exl3-vulkan

Conversation

@Nathanw1014

@Nathanw1014 Nathanw1014 commented Oct 20, 2026 •

Copy link
Copy Markdown

Vulkan kernels for the EXL3 ops of #201 (EXL3_MUL_MAT and EXL3_MUL_MAT_ID). Without them every EXL3 linear on a Vulkan build runs on the CPU. Based on halo-box master dc55218. The diff touches:

  • ggml/src/ggml-vulkan
  • ggml/exl3/README.md (a Vulkan paragraph)
  • ggml/exl3/test_exl3.c (two MUL_MAT_ID cases, and GET_ROWS counted as skipped on a backend without the op)
  • test-backend-ops

What the kernels do:

  • Dot kernel. It computes H(x * suh) in f32. Each lane then decodes its weights of a 16x16 tile in registers to the exact codebook values and accumulates in f32. The last workgroup to finish a 128-column segment applies H and svh / 128. It covers every rate and codebook (3inst, mcg, mul1; K 1 to 8 and 1.5 / 2.5 / 3.5). Used for up to 8 rows.
  • Prefill GEMM. 128 x 32 slabs of W_hat are decoded into double-buffered shared memory as f16 (exact). They are multiplied with KHR coopmat 16x16x16 at f32 accumulation, with 8 wave32 waves per 128 x 128 tile. The rotated rows are rounded to f16 with a power-of-two scale per row. The product rule is HIP's (exl3_gemm_products): one product from 512 contiguous rows, hi + lo below. Used above 8 rows.
  • EXL3_MUL_MAT_ID. One routing workgroup groups the rows by expert on the device, without a host sync.
    • Above 4 rows per expert on average, the GEMM runs in groups of 128 rows of one expert. The product count is chosen per expert, as in HIP's exl3_mmid_route: a second group table holds the experts with at least 512 routed rows (one product), and the rest take hi + lo.
    • Below that, the dot kernel runs groups of up to 1, 2, 4 or 8 rows of one expert. The width comes from the token count, as on HIP.
    • One token skips the routing dispatch.
  • Rows against EXL3_MUL_MAT. On the GEMM path, each row equals the row EXL3_MUL_MAT computes for that expert on the same backend. The same holds on the dot path for an expert with up to 8 rows. test-exl3 checks this per expert. An expert with more than 8 rows on the dot path (e.g. 11 rows at 32 tokens) runs the dot kernel where EXL3_MUL_MAT takes the GEMM. That row is f32 grade (NMSE 4.8e-14) but not bit-equal.

EXL3_GET_ROWS is not ported to Vulkan, although HIP has a kernel for it. On a Vulkan build the CPU backend decodes the embedding rows.

The ops are enabled on RADV RDNA3 only. That is the device the kernels were run on, and the gate also requires a 4-byte storage-buffer offset alignment. The EXL3 shaders are generated only with GGML_EXL3=ON. GGML_VK_DISABLE_EXL3=1 turns the ops off.

Speed was measured on Strix Halo (gfx1151, RADV, Mesa 26.2.4) with LFM2.5-8B-A1B EXL3 4.10bpw, llama-bench -b 2048 -fa 1 -p 512,2048 -n 128 -r 3, mean of 4 runs in ABBA order:

  • master is halo-box dc55218, where the EXL3 linears run on the CPU.
  • "per batch" is the previous head of this PR rebased onto the same master (one product for every expert from 512 tokens).
  • "per expert" is this PR.
ubatch test master per batch per expert per expert / per batch
512 pp512 192.10 5367.45 3770.09 0.70x
512 pp2048 189.05 5439.68 3809.61 0.70x
512 tg128 5.37 138.99 143.59 1.03x
2048 pp512 192.04 5373.75 3753.07 0.70x
2048 pp2048 227.83 5922.19 5144.81 0.87x
2048 tg128 5.32 139.96 144.88 1.04x

The prompt cost comes from the per-expert rule itself. The rule commit alone gives the same pp512 as the full PR (3761 vs 3724).

On LFM2.5 (32 experts, top-4), a 512-token batch gives about 64 rows per expert, so every MoE row takes hi + lo. At pp2048 with ubatch 2048, some experts reach 512 rows and take one product. The tg128 gain comes from the one-token path (no routing dispatch), not from the product rule.

KLD against the CPU path of the same build (GGML_VK_DISABLE_EXL3=1, same ubatch), wikitext, 4 chunks of 4096:

ubatch per batch per expert same top token (per expert)
256 - 0.0029 98.22%
512 0.0048 0.0052 96.90%
2048 0.0047 0.0052 96.87%

The CPU path is deterministic at a fixed ubatch (KLD 0 against itself). Its PPL moves with the ubatch (21.855 / 21.886 / 21.905 at 256 / 512 / 2048), and ub256 against ub512 gives KLD 0.0016. At ub256 every op takes hi + lo in both versions.

Most of the gap at ub512 / ub2048 comes from the dense one-product rule. I checked this with a local build where EXL3_MUL_MAT always takes hi + lo (not part of this PR): it gives 0.0031 / 0.0037. Why the per-expert rule moves KLD slightly up, when each op is more exact, I have not found.

Tests (Vulkan0, GGML_EXL3=ON):

  • test-backend-ops. EXL3_MUL_MAT 138/138, EXL3_MUL_MAT_ID 41/41. Hazard runs: 0/40 and 0/20 failed. With GGML_VK_DISABLE_EXL3=1, every EXL3_MUL_MAT_ID case is not supported.
  • New test-backend-ops cases. EXL3_MUL_MAT_ID at 512 tokens with 128 experts at a 1e-10 limit, and one expert with 600 rows.
  • New test-exl3 cases. 512 tokens with skewed routing (the first expert at exactly 512 rows), and 512 tokens with uniform routing at f32 grade only. The uniform case gives NMSE 2.7e-14 here; the per-batch rule gives 3.8e-8 and fails it.
  • test-exl3 --backend Vulkan0. All 10 MUL_MAT_ID cases pass, including tokens=520 skewed. The binary exits 0, with the 16 EXL3_GET_ROWS cases reported as skipped. On the CPU backend all 16 run and pass.
  • test-exl3 --op-gguf on LFM2.5. 167 of 170 pass. The 3 failures:
    • the 32-token dot-path case above
    • blk.0.shortconv.out_proj at 512 rows and at 513 rows, where the dense one-product rule gives NMSE 5.0e-7
  • Full test-backend-ops suite on Vulkan0. 61624/61630. The 6 failures (MUL_MAT q4_0 8192 x 5120 at 5 / 7 / 8 rows, and three RMS_NORM_MIX tolerance cases) also fail on master dc55218 when run alone.

Not run: ROCm, per-commit builds, drivers other than RADV, the GGML_EXL3=OFF build after the rebase.

Written with Claude, tested by me.

Assisted-by: Claude Opus 5.5

@Nathanw1014 Nathanw1014 mentioned this pull request Oct 20, 2026
@dzannotti dzannotti added in-review We are reviewing. verifying Building and running the PR to verify its claims. and removed in-review We are reviewing. labels Nov 10, 2026

@dzannotti dzannotti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Changes requested, because of the stack. The four Vulkan commits work: on Strix Halo the EXL3 ops match the CPU path (mean KLD under 1e-5, identical greedy text), the speedups reproduce, and normal models do not change. But this branch carries an older copy of #201, and #201 has open blocking findings (see our review of #201). This PR cannot merge before #201 is fixed and it is rebased onto the fixed #201.

Direction

Accept after work. A GPU path for EXL3 on Vulkan is the obvious follow-up to #201: without it, Vulkan users with GGML_EXL3=ON get about 1 t/s decode. The design is right: no new ggml type, gated by the build flag. The asks below are small.

Asks

  1. Blocking. Rebase onto #201 after #201 has the fixes from its review, so that the diff is #201 plus your four commits. Your four commits replay onto the current #201 head with three conflicts. All three are additions next to new master code, in ggml-vulkan-types.h (vk_device_struct) and ggml-vulkan.cpp (the includes and the forward declarations before ggml_vk_load_shaders). We tested that resolution. We did not push it, because the rebase onto #201 is yours to do once #201 settles.
  2. Should fix. vulkan-shaders-gen.cpp:914: the EXL3 shaders compile into every Vulkan build, also with GGML_EXL3=OFF. Gate them as GGML_TRELLIS does (ggml-vulkan/CMakeLists.txt:158, passed through to the shader generator), so that the default build does not pay for them.
  3. Should fix. exl3_route.comp:46,82, exl3_rotate.comp:78 and exl3_rotate_split.comp:88 use the expert id without a range check. An id outside [0, n_exp) writes past cnt[]/off[] in shared memory and reads past suh. count_experts.comp:71 skips such ids, and the CPU path asserts. Skip or clamp the id.
  4. Should fix. ggml-vulkan.cpp:1870 (ggml_vk_exl3_device_ok) accepts every wave32-capable device, but the kernels were only run on RADV gfx1151. The "last workgroup finishes the segment" step relies on coherent buffers and memoryBarrierBuffer without the Vulkan memory model. Either restrict the ops to the devices you measured (as the HIP path is restricted to RDNA3/RDNA4) or run the tests on another driver. The device check also does not test subgroup_arithmetic (exl3_rotate_split.comp uses subgroupMax), or the 20 KB of shared memory that the GEMM needs.
  5. Should fix. Drop GGML_VK_EXL3_DOT_MAX_ROWS (ggml-vulkan.cpp:12555). No test uses it, and it is not documented. Also drop GGML_VK_EXL3_GEMM_PRODUCTS, or add a test case that runs the hi + lo path: half of the GEMM pipelines exist only for it. Please move the op block (about 300 lines) into its own ggml-vulkan-exl3.cpp, so that ggml-vulkan.cpp keeps only a few small hunks for upstream merges.

Nits: ggml-vulkan.cpp:12666 takes the 8-row dot kernel for MUL_MAT_ID with any 2 to 8 tokens, so most of its work is wasted for MTP/speculative verify with many experts; pick mi from the rows per expert. :12759 says "more than 32 rows", but the threshold is 8. The shader header comments are long and hard-wrapped (AGENTS.md comment style). exl3_fwht128 is copied three times. The new test cases stop at 1152 x 1408, so please add a production shape (for example 4096 x 12288 and back) and the exact MUL_MAT_ID dot/GEMM boundary. We ran both (cases below) and they pass.

Correctness

PASS on Vulkan for the four commits. All required checks for a kernel change ran. test-backend-ops EXL3_MUL_MAT 125/125 and EXL3_MUL_MAT_ID 33/33, with the default settings, with GEMM_PRODUCTS=2, and with forced GEMM-only and dot-only paths. 36 more cases that we added at production shapes also pass. The full Vulkan suite has no new failure: one SET_ROWS case failed once under -j 4 and passed 3/3 alone, and this PR does not touch SET_ROWS. Qwen3.5-9B EXL3 2.00bpw, ops on against the pure CPU path: PPL 8.5443 vs 8.5443, mean KLD below 1e-6, same top token 100%. At 16k context against the CPU fallback: mean KLD 9e-6, same top 99.98%. Greedy decode is identical. Normal GGUF models: final f32 logits and prompt tokens are byte-identical to master on all four corpora, flag off and on. ROCm is not changed by these commits. The new cases also pass on ROCm (158/158, HIP_LAUNCH_BLOCKING unset and =1).

Performance

Case (Vulkan) EXL3 ops off (CPU) on change
Qwen3.5-9B EXL3 2.00bpw prompt, c2048 87.4 / 89.0 t/s 1119 / 1138 t/s 12.7x
same, decode 128 tokens (3 runs) 1.01 to 1.09 t/s 46.09 to 46.23 t/s about 44x
1.5B Q4_K_M pp2048, depth 0 / 64000, master vs head 5508 / 896 5423 / 909 within stddev

Verification

Strix Halo (gfx1151), RADV. For testing we replayed the four commits onto #201's current head 73611675b and merged that into master 0c1021e1f, locally (the branch is 339 commits behind master). We compared that against master, with identical build flags.

Not tested

EXL3_MUL_MAT_ID on a real MoE model (we have no MoE EXL3 model that loads), the LFM2.5 numbers, and drivers other than RADV.

Thank you for the kernels and the clear description.

Review made with AI on behalf of the strix-llama.cpp maintainers.

Full verification (for reproduction and agents)

Environment

Strix Halo (gfx1151, Radeon 8060S), Ubuntu 26.04.1, kernel 7.0.0. Mesa RADV 26.0.8 (STRIX_HALO, KHR_coopmat), Vulkan API 1.4.335. ROCm 10.1 (hipconfig 7.16.26385), AMD clang 24.0.0git d6f6cb69. cmake 4.2.3, gcc 15.2.0. The author used Mesa 26.2.4.

Compared

  • master tip: 0c1021e1f685531fcdcc7f28d81b7b534adc508f
  • PR head: bd64c24736eab68a006c1f44f99da3b994ba098c, based on an older #201 commit b5fe4051c (the PR's own commits are de6da4e2f, dddc0d43c, e1ab9f129, bd64c2473)
  • #201 head: 73611675bcde4e33ac38506812dfdbfd00281abc
  • The four commits replayed onto #201 head: 249cce9f4, 85c465ea1, 260278f56, cf0a0f0bf. Merged into master: 1d269f5b4 (local, not pushed)
  • PR merge base with master: ab06204095ad, 339 commits behind
  • Builds: base (master), head-off (merged, GGML_EXL3 default off), head-exl3 (merged, -DGGML_EXL3=ON)

Rebase

Cherry-picking de6da4e2f onto 73611675b conflicted in 3 hunks. The master merge then conflicted in 1 hunk. In all 4, the common ancestor side was empty and both sides added lines at the same spot. We kept both sides:

  • ggml-vulkan-types.h, struct vk_device_struct: master's pipeline_coopmat_layout_check[2] / coopmat_rdna3_layout, then your pipeline_exl3_rotate / pipeline_exl3_mmv.
  • ggml-vulkan.cpp top: master's #include <atomic>, then your #if defined(GGML_USE_EXL3) #include "../../exl3/exl3.h".
  • ggml-vulkan.cpp, the forward declarations before ggml_vk_load_shaders: master's MUL_MAT_ID/dense helper declarations, then your ggml_vk_exl3_device_ok.
  • Master merge, the same spot: your ggml_vk_exl3_device_ok / ggml_vk_exl3_device_cm1 / EXL3_MM_ROWS, then master's dense q8_0 tile configuration (ggml_vk_dense_dq8_cfgs, ggml_vk_dense_dq8_fewrow).

Commits 2 to 4 applied cleanly. git range-diff b5fe4051c..bd64c2473 73611675b..cf0a0f0bf shows commits 2 to 4 as =. Commit 1 differs only in the context lines of these hunks. Not pushed: the rebase onto #201 is the author's to do once #201 settles.

Build

VK="-DGGML_VULKAN=ON -DGGML_HIP=OFF -DCMAKE_BUILD_TYPE=Release -G Ninja"
cmake -S <tree> -B <tree>/build-vk $VK                       # base, head-off
cmake -S <head> -B <head>/build-vk-exl3 $VK -DGGML_EXL3=ON   # head-exl3
HIP="-DGGML_HIP=ON -DGGML_VULKAN=OFF -DGPU_TARGETS=gfx1151 -DCMAKE_HIP_COMPILER=$(hipconfig -l)/clang -DCMAKE_PREFIX_PATH=$(hipconfig -R) -DCMAKE_BUILD_TYPE=Release -G Ninja"
cmake -S <head> -B <head>/build-hip-exl3 $HIP -DGGML_EXL3=ON  # test-backend-ops only

Models

Model Source sha256
Qwen3.5-9B EXL3 2.00bpw (exllamav3 directory, -m <dir>) turboderp/Qwen3.5-9B-exl3, branch 2.00bpw, commit 0508aa8eeca823529f4a871bdb2bf3f50a86b18e model.safetensors 381dce8844603a25174ffc0b397d45e3ee63bd225a8b7469ba5143629dbc2adf
qwen2.5-1.5b-instruct-q4_k_m.gguf Qwen/Qwen2.5-1.5B-Instruct-GGUF 6a1a2eb6...407e

Corpora at master, sha256 (first 16 hex): prose c90398f2e2885f20, code dec1127ae75ffa56, structured c21947b360bea62d, numeric d9f08d9470e53ef6.

Commands

# ops (head-exl3); each also with GGML_VK_EXL3_GEMM_PRODUCTS=2, GGML_VK_EXL3_DOT_MAX_ROWS=0, =100000, GGML_VK_DISABLE_EXL3=1
test-backend-ops test -b Vulkan0 -o EXL3_MUL_MAT
test-backend-ops test -b Vulkan0 -o EXL3_MUL_MAT_ID
test-exl3 --backend Vulkan0
# suites: base, head-off, head-exl3
test-backend-ops test -b Vulkan0 -j 4
test-backend-ops test -b Vulkan0 -j 1 -o SET_ROWS -p '<failing case>'   # 3x, head and base
ctest --test-dir <build> --output-on-failure -L main -E 'test-opt|test-llama-archs'
test-llama-archs -b Vulkan0
test-vk-exact
# normal model parity, 4 corpora
llama-debug -m <q4km> -f tests/corpus/correctness-<t>.txt -c 16384 -b 16384 -ub 512 -ngl 99 -fa on -ctk f16 -ctv f16 --save-logits --logits-output-dir <out>
cmp <base>/llamacpp-*.bin <head>/llamacpp-*.bin         # logits and tokens
llama-completion -m <q4km> -f correctness-prose.txt -n 256 --temp 0 --seed 1 -no-cnv --ignore-eos -ngl 99 -fa on -c 16384   # base twice, both heads
# EXL3 model: references
llama-perplexity -m <dir> -f correctness-prose.txt -c 2048 -b 2048 -ub 512 --chunks 3 -ngl 0 -dev none --no-op-offload --kl-divergence-base <cpu>.kld
GGML_VK_DISABLE_EXL3=1 llama-perplexity -m <dir> -f correctness-prose.txt -c 2048 -b 2048 -ub 512 --chunks 3 -ngl 99 -fa on --kl-divergence-base <fb>.kld
# ops on (-ub 512, -ub 2048, GEMM_PRODUCTS=2) against each reference
llama-perplexity -m <dir> -c 2048 -b 2048 -ub <512|2048> --chunks 3 -ngl 99 -fa on --kl-divergence-base <ref>.kld --kl-divergence
# long: the four corpora joined
llama-perplexity -m <dir> -f <joined> -c 16384 -b 512 -ub 512 -ngl 99 -fa on [--kl-divergence-base <fb-long>.kld --kl-divergence]
# decode and speed
llama-completion -m <dir> -f correctness-prose.txt -n 128 --temp 0 --seed 1 -no-cnv --ignore-eos -ngl 99 -fa on -c 16384   # on, off, on; 3 runs each for speed
llama-completion -m <dir> -p "The capital of France is" -n 64 --temp 0 --seed 1 -no-cnv -ngl 99 -fa on   # on and off
llama-perplexity -m <dir> -f correctness-prose.txt -c <2048|4096> -ngl 99 -fa on   # prompt t/s, off and on, 2 rounds
# normal model performance, base and head-exl3 alternated, 2 rounds
llama-bench -m <q4km> -p 2048 -d 0,12000,32000,64000 -b 2048 -ub 512 -n 0 -r 5 -ngl 99 -fa on -ctk f16 -ctv f16 --load-mode none -o jsonl
llama-bench -m <q4km> -p 0 -n 128 -r 5 -ngl 99 -fa on -o jsonl
test-backend-ops perf -b Vulkan0 -o EXL3_MUL_MAT
# ROCm (head, flag on), HIP_LAUNCH_BLOCKING unset and =1
test-backend-ops test -b ROCm0 -o EXL3_MUL_MAT ; test-backend-ops test -b ROCm0 -o EXL3_MUL_MAT_ID

Extra cases, added for this test only in a separate build (not part of the PR):

for (auto [pk, pn] : {{4096, 12288}, {12288, 4096}}) for (auto [ptw, pcb] : {{32, 1}, {64, 0}}) for (rows : {1, 8, 9, 512})
    test_exl3_mul_mat(pk, pn, ptw, pcb, {rows, 1});
for (rows : {1, 8, 9, 512}) test_exl3_mul_mat(2048, 1536, 32, 2, {rows, 1});
for (t : {128, 129}) { test_exl3_mul_mat_id(512, 768, 128, 64, 1, 8, 1, t); test_exl3_mul_mat_id(512, 768, 128, 64, 1, 8, 8, t); }
for (t : {32, 33})   { test_exl3_mul_mat_id(256, 384, 8, 32, 2, 2, 1, t);   test_exl3_mul_mat_id(256, 384, 8, 32, 2, 2, 2, t); }
for (t : {1, 128, 129, 512}) { test_exl3_mul_mat_id(2048, 512, 256, 32, 1, 8, 1, t); test_exl3_mul_mat_id(2048, 512, 256, 32, 1, 8, 8, t); }

Results

Check base (master) head-off head-exl3
EXL3_MUL_MAT / _ID, default, 2 runs op absent not supported (flag off) 125/125, 33/33
same with GEMM_PRODUCTS=2 (2 runs), DOT_MAX_ROWS=0, =100000 - - 125/125, 33/33 each
GGML_VK_DISABLE_EXL3=1 - - all "not supported"
extra production-shape cases, default and PRODUCTS=2 - - 145/145, 49/49
test-exl3 --backend Vulkan0 - - 305 MUL_MAT/_ID cases pass; exits 1 because EXL3_GET_ROWS is unsupported on Vulkan and the harness counts that as a failure (ggml/exl3/test_exl3.c:1653, from #201)
test-backend-ops full, -j 4 43847/43847 43847/43847 44004/44005: SET_ROWS(f32 -> q3_0_rocmfpx, ne=[256,11,1,1], nr23=[2,3], r=7) ERR 3.5e-5; passes 3/3 alone on head and on base, SET_ROWS group 439/439 at -j 4 on both
ctest -L main fails tokenizers-ggml-vocabs, test-llama-context - + test-draft-vocab (from #201)
test-llama-archs 137/137 137/137 137/137
test-vk-exact 11 failing (hc-up-mix) same 11 same 11
llama-debug logits + tokens, 4 corpora (12273 / 10229 / 8300 / 12713 tokens) reference byte-identical byte-identical
greedy decode 256 tokens A/A identical identical identical
ROCm EXL3_MUL_MAT / _ID, HLB unset and =1 - - 125/125, 33/33

EXL3 model, prose corpus, 3 chunks of 2048 (long: 4 corpora, 16384):

Run PPL mean KLD max KLD same top p
pure CPU (reference) 8.5443 +- 0.347 - - -
CPU fallback on Vulkan (ops off) 8.5442 0 vs CPU 5.5e-5 100%
ops off vs ops off (floor) - 0 6.9e-5 99.967%
ops on -ub 512 / -ub 2048 / PRODUCTS=2, vs CPU 8.54434 / 8.54420 / 8.54426 < 1e-6 5.5e-5 100%
same, vs fallback - < 1e-6 6.8e-5 to 6.9e-5 99.967%
long, fallback 3.1047 +- 0.051 - - -
long, ops on vs fallback 3.1048 9e-6 +- 4e-6 0.054 99.976 +- 0.012%

Greedy decode, 128 tokens: on, off, on all identical. The short prompt is identical, on vs off.

Correctness

Check Method Result
changed ops test-backend-ops EXL3_MUL_MAT / _ID, env sweeps, extra shapes PASS
full backend suite test-backend-ops -j 4, base vs both heads PASS (one non-EXL3 SET_ROWS flake, 3/3 alone)
test-vk-exact (fusion) base vs head no change (the PR adds no fusion)
f32 logits + prompt tokens, 4 corpora llama-debug + cmp, normal model byte-identical
KLD/PPL short llama-perplexity -c 2048, EXL3 model vs pure CPU and vs fallback PASS, at the floor
KLD/PPL long -c 16384, 4 corpora PASS (9e-6, limit 1e-4)
greedy decode, A/A llama-completion identical
ROCm HLB unset / =1 not changed by these commits n/a; new cases pass on ROCm
-Werror HIP build, VGPR spill gate no HIP files changed n/a
performance llama-bench depths 0 to 64000, 2 rounds; EXL3 prompt/decode off vs on no slowdown; speedup reproduced
MUL_MAT_ID on a model no loadable MoE EXL3 model not tested

Performance

1.5B Q4_K_M llama-bench, avg_ts +- stddev (round 1 base, round 1 head, round 2 base, round 2 head):

Test base r1 head r1 base r2 head r2
pp2048 d0 5652 +- 33 5410 +- 154 5363 +- 181 5435 +- 200
pp2048 d12000 3038 +- 29 2900 +- 44 2850 +- 46 2855 +- 45
pp2048 d32000 1640 +- 19 1627 +- 23 1589 +- 22 1606 +- 31
pp2048 d64000 908 +- 18 910 +- 15 884 +- 26 908 +- 19
tg128 191.7 +- 2.1 191.9 +- 1.9 191.6 +- 1.9 191.5 +- 1.7

compare-llama-bench: 0.98 / 0.98 / 1.00 / 1.02 / 1.00. Base itself moved 5% between rounds at d0, so this is noise. The PR code is compiled out of the base path.

EXL3 model, Vulkan, ops off vs on: llama-perplexity prompt c2048 87.4 / 89.0 vs 1119 / 1138 t/s, c4096 87.9 / 88.0 vs 1116 / 1084 t/s. llama-completion prompt (12386 tokens) 94 vs 1125 / 1129 t/s. Decode, 128 tokens: 1.08 / 1.01 / 1.09 vs 46.23 / 46.15 / 46.09 t/s (40.0 t/s after the 12.4k-token prompt). For reference, #201's HIP path on the same model: 1510 t/s prompt, 45.6 t/s decode. test-backend-ops perf -o EXL3_MUL_MAT: 4096 x 12288, 1 row 124 us, 512 rows 2278 us (22.6 TFLOPS); 12288 x 4096, 512 rows 18.3 TFLOPS. llama-bench does not load an exllamav3 directory (failed to read magic), so we used llama-perplexity and llama-completion, as the description does.

Findings in full

  • Stack: the branch includes 41 commits of #201 at b5fe4051c. #201 is now 21 first-parent commits further on, and has blocking review findings. Rebase onto the fixed #201.
  • vulkan-shaders-gen.cpp:914-924: 7 SPIR-V shaders, plus 2 coopmat ones, are generated outside any EXL3 guard, so every Vulkan build compiles and ships them. GGML_TRELLIS shows the pattern for passing the flag to the shader generator.
  • Expert ids are unchecked in exl3_route.comp:46,82 (atomicAdd(cnt[e], 1), off[e]), exl3_rotate.comp:78-80 (sb += uint(e)*p.k) and exl3_rotate_split.comp:88. count_experts.comp:71,115 checks expert < n_experts. The ids come from the router's top-k, so a normal graph stays in range. This hardening is cheap.
  • ggml_vk_exl3_device_ok (ggml-vulkan.cpp:1870): fp16 + shuffle + subgroup size control + wave32. That passes NVIDIA, Intel, RDNA1/2 and AMDVLK, none of which was tested. The dot kernel's last-workgroup reduction (exl3_mul_mat_vec.comp) uses coherent + memoryBarrierBuffer + atomicAdd. Every other split reduction in this backend uses a separate dispatch. rotate_split uses subgroupMax without a subgroup_arithmetic check. The GEMM uses 20 KB of shared memory without a limit check (the Vulkan minimum is 16 KB).
  • The rotation dispatches are 1-D (rows_pad and CEIL_DIV(n_pairs*(k/128), 8) workgroups in x). Drivers with maxComputeWorkGroupCount[0] = 65535 would assert for large batches. RADV is not affected.
  • Env knobs: GGML_VK_DISABLE_EXL3 is read in two separate static lambdas (in both supports_op functions). It would be cleaner to read it once at device init. GGML_VK_EXL3_DOT_MAX_ROWS is unused by tests and does an unchecked atoi. GGML_VK_EXL3_GEMM_PRODUCTS=2 doubles the GEMM pipeline set and has no test case.
  • Upstream sync: about 380 lines in ggml-vulkan.cpp across 6 hunks. Two of our 4 replay conflicts were in the declaration block near ggml_vk_load_shaders. Every helper the op block needs is already in ggml-vulkan-common.h.
  • ggml-vulkan.cpp:12666: mi = n_tokens == 1 ? 0 : 3, so MUL_MAT_ID with 2 to 8 tokens always runs the 8-row dot kernel, even when most expert groups have 1 row.
  • ggml-vulkan.cpp:12759: the comment says 32 rows, the threshold is 8.
  • exl3_fwht128 exists in exl3_common.glsl, exl3_rotate.comp and exl3_rotate_split.comp. A shared include would remove two copies.
  • exl3_route.comp repeats part of count_experts.comp. The output format is different, so reuse may not fit, but the range check should match.
  • Tests: the largest correctness case is 1152 x 1408. The 4096 x 12288 cases are perf-only. No case sits exactly on the MUL_MAT_ID dot/GEMM boundary, and none has n_exp = 256 or strided ids. Our extra cases above cover all of these except strided ids, and they pass.
  • test-exl3 --backend Vulkan0 exits 1 because EXL3_GET_ROWS is unsupported on Vulkan. That is in #201's harness. A skip there would make the binary usable in CI.
  • ASCII is clean. All four commits carry Assisted-by:.

Claims

  • Prefill 11.7x (4.00bpw, 102 to 1191): reproduced on 2.00bpw, 12.7x (87 to 1119-1138 t/s).
  • Decode 30x (1.31 to 39.9): reproduced, 44x on 2.00bpw (1.0-1.1 to 46.1-46.2 t/s).
  • KLD vs CPU path about 1e-6, PPL equal, greedy text identical: reproduced on 2.00bpw.
  • New test cases all pass: reproduced. We count 125 and 33 cases, not 109 and 26.
  • Full suite 43067/43067: our number is 44004/44005 on newer master, with one SET_ROWS flake that does not come from this PR.
  • test-exl3 MUL_MAT/MUL_MAT_ID cases pass on Vulkan0: reproduced (the binary still exits 1, see above).
  • MUL_MAT_ID per-expert bit-exactness: covered by test-backend-ops and test-exl3 only, not on a model.
  • PRODUCTS=2 KLD 0.0022 vs 0.0029, and the LFM2.5 numbers: not tested (no LFM2.5 EXL3 model).
  • llama-bench cannot load an exllamav3 directory: reproduced.

Not tested

MUL_MAT_ID on a MoE EXL3 model (the directory importer loads only dense Qwen3.5, and we have no converted lfm2moe EXL3 GGUF). The LFM2.5 numbers. Strided ids and two EXL3 ops in one graph (they need a new test struct). Drivers other than RADV, and Mesa 26.2.

@dzannotti dzannotti added waiting-user We asked the author for something. risk:medium Risk: medium verified The claims were reproduced. and removed verifying Building and running the PR to verify its claims. labels Nov 11, 2026
@Nathanw1014

Copy link
Copy Markdown
Author

Thanks for the review. #201 is merged, so this is now rebased onto master (c495f90): the diff is only the Vulkan commits. Per ask:

  1. Rebased onto master after the feat: exl3 support #201 merge. The three conflicts were the additions you described, next to new master code.
  2. The EXL3 shaders are generated only with GGML_EXL3=ON (6073425); the OFF build has no EXL3 SPIR-V.
  3. The expert id is clamped to [0, n_exp) in exl3_route.comp, exl3_rotate.comp and exl3_rotate_split.comp, as on HIP (f2707ad).
  4. ggml_vk_exl3_device_ok now takes RADV RDNA3 only and also checks subgroup arithmetic and the shared memory of the routing and the GEMM (f2707ad).
  5. GGML_VK_EXL3_DOT_MAX_ROWS and GGML_VK_EXL3_GEMM_PRODUCTS are gone; one product from 512 rows and hi + lo below, as feat: exl3 support #201 decides it, so the GEMM cases under 512 rows run hi + lo. The op block moved to ggml-vulkan-exl3.cpp; ggml-vulkan.cpp keeps 67 added lines (f2707ad).

Nits: the dot-kernel group width now comes from the rows per expert and the comment says 8 (f2707ad); one exl3_fwht128 shared by the shaders, shorter shader headers (6d7b2c6); production shapes 4096 x 12288 and back (8eb96ce) and the exact dot / GEMM switch for MUL_MAT_ID (3e64f53).

Not tested in your run, now covered: EXL3_MUL_MAT_ID on a real MoE (LFM2.5-8B-A1B 4.10bpw converted to GGUF, and Qwen3.8-Flash-Next 3.05bpw). Numbers are in the updated description.

@dzannotti dzannotti added in-review We are reviewing. and removed waiting-user We asked the author for something. verified The claims were reproduced. labels Nov 15, 2026
@dzannotti dzannotti assigned dzannotti and unassigned Nathanw1014 Nov 15, 2026
@dzannotti dzannotti added verifying Building and running the PR to verify its claims. and removed in-review We are reviewing. labels Nov 15, 2026
@dzannotti
dzannotti dismissed their stale review November 15, 2026 06:41

Replaced by the re-review of f48ea91: the earlier blocking ask (rebase onto #201) is done.

@dzannotti dzannotti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Changes requested. This review replaces our earlier one. The rebase and all five earlier asks are done, and the dense op passes every check. EXL3_MUL_MAT_ID chooses the f16 product count for the whole batch and not per expert, which breaks the precision rule of #201. Its own test-exl3 reports this.

Direction

Accept after work. A Vulkan GPU path for EXL3 is the obvious follow-up to #201, and the structure is now right: one new file, small hunks in upstream files, and nothing compiled or run unless GGML_EXL3=ON on RADV RDNA3. The fix below is small, and both pipelines for it already exist.

Asks

  1. Blocking. ggml-vulkan-exl3.cpp:174 takes one f16 product for every expert group when n_tokens >= 512. #201 (ggml/exl3/README.md:128, HIP exl3.cu:1755) takes one product only for an expert with at least 512 routed rows, and hi + lo for the others. An expert gets at most one row per token. So at -ub 512 HIP runs every MoE row with hi + lo and Vulkan runs every row with one product. With 32 rows per expert, 511 tokens give NMSE 1.1e-13 and 512 tokens give 4.3e-8. The same expert's rows through dense EXL3_MUL_MAT give 7e-14. The suite passes only because its limit is 1e-7. test-exl3 --backend Vulkan0 fails on mul_mat_id synthetic ... tokens=520 skewed (rows_equal_mul_mat_per_expert: "no"). Port the HIP rule: a second group table from the route for the 512-row chunks of each expert, then mm_id with one product on that table and with hi + lo on the rest. Or use hi + lo for every MUL_MAT_ID group. With products = 2 we measured all 98 MUL_MAT_ID cases at 6.6e-14 to 1.1e-13. Please add a case with a tight limit (about 1e-10) at 512 tokens, so that this cannot come back.
  2. Blocking, after 1. Measure the LFM2.5 KLD and pp512 / pp2048 again. The current numbers were measured with this rule. Your KLD against the CPU path (0.0039) is 2.8x your CPU noise floor (0.0014), and our limit is 2x floor + 1e-4. Please correct the description: "as #201 decides it" and "bit for bit" are false for MUL_MAT_ID today. "EXL3_GET_ROWS stays on the CPU, as on HIP" is also false, because HIP has a kernel for it.
  3. Should fix. ggml/exl3/README.md:117 still says that Vulkan does not support the op. Add a short Vulkan paragraph with the dot/GEMM switch, the product rule and the device gate.
  4. Should fix. ggml-vulkan-exl3.cpp:161 divides by min(n_exp, n_pairs), so the dot-kernel width is the average over all experts and not over the used experts, as the comment says. With 128 experts, 8 used, and 2 to 16 tokens, every row becomes its own group and reads its expert's trellis again. HIP takes the width from n_tokens. Fix the rule or the comment, and give a number for 4 and 8 tokens.

Nits: ggml-vulkan.cpp:14058 adds only a blank line (one more upstream hunk). ggml-vulkan-common.h:328 has a double blank line. Comments in ggml-vulkan-exl3.cpp (:8, :158, :172) are hard-wrapped mid-sentence. The thresholds (8 rows, more than 8 rows per expert) have no measurement note. The test comment at test-backend-ops.cpp:14620 says "1 and 9 rows", but the loop also runs 40.

Correctness

FAIL on Vulkan for EXL3_MUL_MAT_ID at 512 or more tokens (ask 1). Everything else passes. EXL3_MUL_MAT 138/138 and EXL3_MUL_MAT_ID 38/38, run twice. With the ops disabled and in the GGML_EXL3=OFF build, all cases report "not supported". Extra cases at 4096 x 12288 and 12288 x 4096 with 511 to 2048 rows, and strided x at 600 rows, follow #201's dense rule. Full Vulkan suite: 44370/44370, against 44194/44194 on master, with no head-only failure. ctest and test-vk-exact have the same failures as master. Normal GGUF model: final f32 logits and prompt tokens are byte-identical to master on all four corpora, with the flag on and off, and greedy decode is identical. Qwen3.5-9B EXL3 2.00bpw against the CPU path: PPL 8.5443 vs 8.5443, mean KLD below 1e-6 (short and 16k), same top token 99.94-99.97%, greedy decode identical. Not run: MUL_MAT_ID on a real MoE model, and ROCm (this PR changes no HIP or shared runtime code).

Performance

Case (Vulkan) master (CPU path) PR change
Qwen3.5-9B EXL3 2.00bpw, prompt c2048 87.6 t/s 1072-1157 t/s 12.2-13.2x
same, decode after a 12.4k prompt 1.08 t/s 39.9 t/s 37x
1.5B Q4_K_M pp2048 d0 / d12000, mean of 3 runs 6126 / 3293 6035 / 3248 0.985 / 0.986, within run-to-run spread

Verification

Strix Halo (gfx1151), RADV. The PR is on master c495f90f5 (0 commits behind). We merged it into that commit and compared it against master with identical build flags.

Not tested

MUL_MAT_ID on a real MoE EXL3 model (the LFM2.5 and Qwen3.8-Flash-Next numbers), the cost of hi + lo for MUL_MAT_ID, out-of-range expert ids, per-commit builds, and drivers other than RADV.

Thank you for the quick and thorough follow-up.

Review made with AI on behalf of the strix-llama.cpp maintainers.

Full verification (for reproduction and agents)

Environment

Strix Halo (gfx1151, Radeon 8060S, RADV STRIX_HALO, KHR_coopmat), Ubuntu, kernel 7.0.0. Mesa RADV 26.0.8, Vulkan loader 1.4.341. cmake 4.2.3, gcc 15.2.0, glslc shaderc 2026.1. The author used Mesa 26.2.4.

Compared

  • master tip: c495f90f55e647f9a5b6820b503be6d39c74baa7
  • PR head: f48ea91fa4bdab045ce12f86d399e035cf7f5093 (9 commits); merge base = master tip, 0 commits behind
  • merged: 2c15ebe2f (local --no-ff merge, content equal to the PR head, not pushed)
  • earlier reviewed head: bd64c2473. git range-diff: commits 2 and 3 are identical, commits 1 and 4 differ in context lines and new test lines; commits 5 to 9 are new
  • builds: base-exl3 (master, -DGGML_EXL3=ON), head-exl3 (merged, -DGGML_EXL3=ON), head-off (merged, default OFF)

Earlier asks

Ask Status Where
1 rebase onto #201 done on master after the #201 merge
2 EXL3 shaders only with GGML_EXL3 done ggml-vulkan/CMakeLists.txt:164-169, vulkan-shaders-gen.cpp under #ifdef GGML_USE_EXL3; OFF build has 0 exl3 entries in ggml-vulkan-shaders.hpp, no exl3 SPIR-V or symbols
3 expert id range done clamp to [0, n_exp) in exl3_route.comp:33, exl3_rotate.comp:65, exl3_rotate_split.comp:73, as HIP
4 device gate done ggml-vulkan-exl3.cpp:11-22: RADV + RDNA3, fp16, subgroup shuffle/arithmetic/size control, shared memory 12292 B route and 20480 B GEMM (matches the shaders)
5 env knobs, own file done only GGML_VK_DISABLE_EXL3 left; op block in ggml-vulkan-exl3.cpp; ggml-vulkan.cpp +67 lines in 4 hunks
nits mostly done one exl3_fwht128; "8 rows" comment; boundary cases 128/129 tokens; the 4096 x 12288 correctness cases at 1 and 33 rows come from #201, the PR adds them to the perf list (our extra cases cover 511 to 2048 rows); dot width see ask 4

Build

VK="-DGGML_VULKAN=ON -DGGML_HIP=OFF -DCMAKE_BUILD_TYPE=Release -G Ninja"
cmake -S <head> -B <head>/build-vk-exl3 $VK -DGGML_EXL3=ON
cmake -S <base> -B <base>/build-vk-exl3 $VK -DGGML_EXL3=ON
cmake -S <head> -B <head>/build-vk $VK
cmake --build <dir> -j --target test-backend-ops test-llama-archs llama-perplexity llama-tokenize llama-bench llama-debug llama-completion test-vk-exact test-exl3
cmake --build <dir> -j     # full, for ctest

Models

Model Source sha256
Qwen3.5-9B EXL3 2.00bpw (exllamav3 directory, -m <dir>) turboderp/Qwen3.5-9B-exl3, branch 2.00bpw, commit 0508aa8eeca823529f4a871bdb2bf3f50a86b18e model.safetensors 381dce8844603a25174ffc0b397d45e3ee63bd225a8b7469ba5143629dbc2adf
qwen2.5-1.5b-instruct-q4_k_m.gguf Qwen/Qwen2.5-1.5B-Instruct-GGUF 6a1a2eb6...407e

Corpora at master, sha256 (first 16 hex): prose c90398f2e2885f20, code dec1127ae75ffa56, structured c21947b360bea62d, numeric d9f08d9470e53ef6.

Commands

test-backend-ops test -b Vulkan0 -o EXL3_MUL_MAT ; test-backend-ops test -b Vulkan0 -o EXL3_MUL_MAT_ID   # head-exl3 x2, GGML_VK_DISABLE_EXL3=1, head-off, base-exl3
test-backend-ops test -b Vulkan0 -j 4                                                                  # base-exl3, head-exl3
ctest --test-dir <build> --output-on-failure -L main -E 'test-opt|test-llama-archs'
test-vk-exact ; test-exl3 --backend Vulkan0
llama-debug -m <q4km> -f correctness-<t>.txt -c 16384 -b 16384 -ub 512 -ngl 99 -fa on -ctk f16 -ctv f16 --save-logits --logits-output-dir <out> ; cmp logits and tokens
llama-completion -m <q4km> -f correctness-prose.txt -n 256 --temp 0 --seed 1 -no-cnv --ignore-eos -ngl 99 -fa on -c 16384   # base x2, head
P="-m <exl3 dir> -f correctness-prose.txt -c 2048 -b 2048 --chunks 3 -ngl 99 -fa on"
GGML_VK_DISABLE_EXL3=1 llama-perplexity $P -ub 512 --kl-divergence-base fb.kld
GGML_VK_DISABLE_EXL3=1 llama-perplexity $P -ub 512 --kl-divergence-base fb.kld --kl-divergence     # floor
llama-perplexity $P -ub 512|2048 --kl-divergence-base fb.kld --kl-divergence
llama-perplexity -m <dir> -f <4 corpora joined> -c 16384 -b 512 -ub 512 --chunks 1 -ngl 99 -fa on [--kl-divergence-base ... --kl-divergence]
llama-completion -m <dir> -f correctness-prose.txt -n 128 --temp 0 --seed 1 -no-cnv --ignore-eos -ngl 99 -fa on -c 16384   # on, off, master
llama-bench -m <q4km> -p 2048 -d 0,12000,32000,64000 -b 2048 -ub 512 -n 0 -r 5 -ngl 99 -fa on -ctk f16 -ctv f16 --load-mode none -o jsonl
llama-bench -m <q4km> -p 0 -n 128 -r 5 -ngl 99 -fa on -o jsonl
llama-bench -m <q4km> -p 2048 -d 0,12000 ... # rerun, head, base, head, base

Product-rule check, in a separate local tree (not part of the PR): test-backend-ops prints each case's NMSE, extra cases are added, and ggml-vulkan-exl3.cpp:174 can be switched to products = 2:

-    const uint32_t products = ggml_vk_exl3_gemm_products(n_tokens);
+    const uint32_t products = getenv("MMID_P2") ? 2u : ggml_vk_exl3_gemm_products(n_tokens);
extra cases:
  test_exl3_mul_mat_id(512, 768, 128, tw, cb, 8, 8|1, 512) and test_exl3_mul_mat(512, 768, tw, cb, {32|512, 1}) for every rate x codebook
  test_exl3_mul_mat_id(1792, 2048, 32, 32, 2, 4, 4, 2048) ; test_exl3_mul_mat_id(2048, 1792, 32, 32, 2, 4, 1, 2048)
  test_exl3_mul_mat(1792, 2048, 32, 2, {256|512, 1})
  test_exl3_mul_mat_id(384, 256, 1, 64, 1, 1, 1, 511|600) ; test_exl3_mul_mat_id(2048, 768, 128, 64, 1, 8, 8, 511|512)
  test_exl3_mul_mat(4096, 12288, 64, 1, {511|512|513|2048, 1}) and 12288 x 4096; tw 32 at 2048 rows
  test_exl3_mul_mat(256, 384, 64, 1, {600, 1}, true, 3)   # strided x

Results

Check base (master) head-off head-exl3
EXL3_MUL_MAT / _ID, 2 runs not supported (29 / 8 cases) not supported 138/138, 38/38
GGML_VK_DISABLE_EXL3=1 - - all not supported
extra cases (above), as PR / MMID products = 2 - - 205/205, 98/98 / 98/98
test-backend-ops full, -j 4 44194/44194 - 44370/44370
ctest -L main 64/67 (tokenizers-ggml-vocabs, grammar-parser, llama-context) - same 3
test-vk-exact 11 failing (hc-up-mix) - same 11
test-exl3 --backend Vulkan0 - - 304 MUL_MAT/_ID cases pass; 1 MUL_MAT_ID fails (skewed, 520 tokens, rows_equal_mul_mat_per_expert: "no", nmse_op_vs_f64_two 4.13e-8); 16 EXL3_GET_ROWS counted as failures because the op is unsupported on Vulkan
llama-debug logits + tokens, 4 corpora (12273 / 10229 / 8300 / 12713 tokens) reference byte-identical byte-identical
greedy decode 256 tokens A/A identical - identical

NMSE against CPU, Vulkan0:

Case rows per expert as PR MMID products = 2
MMID (256,384,16,32,2,4,4,512) 128 4.32e-8 6.6e-14
MMID (512,768,128,64,1,8,8,512) 32 4.30e-8 7.2e-14
MMID (512,768,128, 26 rate x codebook, 8, ne11 8 and 1, 512) 32 / 4 4.29e-8 to 4.33e-8 7.18e-14 to 7.27e-14
MMID (1792,2048,32,32,2,4,4,2048) 256 4.31e-8 1.02e-13
MMID (2048,1792,32,32,2,4,1,2048) 256 4.31e-8 1.08e-13
MMID (2048,768,128,64,1,8,8, 511 / 512) 32 1.07e-13 / 4.31e-8 1.07e-13 / 1.07e-13
MMID n_exp 1 (384,256,1,64,1,1,1, 511 / 600) 511 / 600 6.9e-14 / 4.27e-8 6.9e-14 / 6.9e-14
MMID, every case under 512 tokens (45) any 5.2e-14 to 1.1e-13 same
dense (512,768, every rate, 32 / 512 rows) - 6.8e-14 to 7.5e-14 / 4.25e-8 to 4.37e-8 -
dense 4096 x 12288, 511 / 512 / 513 / 2048 rows - 1.55e-13 / 4.32e-8 / 4.31e-8 / 4.32e-8 -
dense 12288 x 4096, same - 3.39e-13 / 4.44e-8 / 4.44e-8 / 4.45e-8 -
dense strided x, 600 rows - 6.6e-14 (hi + lo, as :77) -

The n_exp 1, 600-token case shows the intended rule: the expert has 600 rows, so one product is right there (HIP would give it one product for the first 512 rows). The 32-row and 256-row cases are where Vulkan and #201 differ.

EXL3 model, prose, 3 chunks of 2048; reference = CPU path (GGML_VK_DISABLE_EXL3=1), -ub 512:

Run PPL mean KLD max KLD same top p
CPU path (reference) 8.5443 +- 0.34709 - - -
CPU path vs itself (floor) 8.544287 0 5.3e-5 100%
ops on, -ub 512 8.544438 < 1e-6 5.4e-5 99.967 +- 0.033%
ops on, -ub 2048 8.544305 < 1e-6 5.3e-5 99.935 +- 0.046%
master (CPU path) 8.5443 +- 0.34709 - - -
long (4 corpora, c16384, 1 chunk), CPU path / ops on 4.694462 / 4.694615 1e-6 4.8e-4 99.963 +- 0.021%

Greedy decode, 128 tokens after a 12386-token prompt: ops on, ops off and master give identical text.

Correctness

Check Method Result
changed ops test-backend-ops EXL3_MUL_MAT / _ID, 2 runs, disabled and OFF builds PASS at the suite limit
MUL_MAT_ID product rule per-case NMSE, products = 2 comparison, test-exl3 FAIL (ask 1)
dense one-product rule at production shape extra cases PASS
full backend suite test-backend-ops -j 4, base vs head PASS, no head-only failure
ctest -L main full builds same failures as master
test-vk-exact (fusion) base vs head same failures as master (the PR adds no fusion)
f32 logits + prompt tokens, 4 corpora llama-debug + cmp, normal model byte-identical (flag on and off)
KLD/PPL short EXL3 model, vs CPU path and floor PASS
KLD/PPL long c16384, 4 corpora PASS (1e-6)
greedy decode A/A normal and EXL3 model identical
MUL_MAT_ID on a real MoE model - not run: no MoE EXL3 model loads here
ROCm, HIP_LAUNCH_BLOCKING, -Werror, VGPR gate - n/a: no HIP or shared runtime file changed
performance llama-bench depths 0 to 64000 + rerun; EXL3 prompt and decode no slowdown; speedup reproduced (dense)

Performance

1.5B Q4_K_M llama-bench, avg_ts +- stddev, round 1 (base, then head):

Test base head head/base
pp2048 d0 6396.2 +- 59.7 5847.6 +- 66.3 0.914
pp2048 d12000 3431.1 +- 182.9 3240.8 +- 49.4 0.945
pp2048 d32000 1780.1 +- 45.6 1735.2 +- 36.3 0.975
pp2048 d64000 978.2 +- 32.1 996.4 +- 32.2 1.019
tg128 190.9 +- 1.7 191.0 +- 1.5 1.000

Rerun, head first, alternated:

Order Side pp2048 d0 pp2048 d12000
1 head 6359.9 +- 31.9 3295.1 +- 129.2
2 base 6019.8 +- 122.8 3209.1 +- 58.4
3 head 5897.2 +- 116.5 3206.9 +- 37.8
4 base 5960.9 +- 48.7 3238.1 +- 58.2

The first run after the machine goes idle is about 6% faster, whichever side it is. Mean of 3 runs per side: d0 6126 vs 6035, d12000 3293 vs 3248. A normal model runs no EXL3 code (its logits are byte-identical), so this is run-to-run spread.

EXL3 model (llama-bench cannot load an exllamav3 directory, so these come from llama-perplexity and llama-completion):

Measure master (CPU path) PR, ops off PR, ops on
perplexity c2048, prompt 87.6 t/s 86-88 t/s 1157 t/s (ub 512), 1072-1078 t/s (ub 2048)
completion, 12386-token prompt 93.2 t/s 93.5 t/s 1171.7 t/s
completion, decode after that prompt 1.08 t/s 1.10 t/s 39.9 t/s

Findings in full

  1. Blocking: MUL_MAT_ID product count per batch, not per expert (ggml-vulkan-exl3.cpp:172-174). The comment there already says that HIP differs. Below 512 tokens the backends agree; from 512 tokens every expert gets one product. Fix options and evidence are in ask 1.
  2. Blocking: the LFM2.5 KLD and speed numbers depend on finding 1, and the description claims are not correct (ask 2).
  3. Should fix: ggml/exl3/README.md:117 is stale (ask 3).
  4. Should fix: dot-kernel width from the average over all experts (ggml-vulkan-exl3.cpp:161); correct, but it can read an expert's trellis once per row (ask 4). On decode the route dispatch always runs, which HIP skips for one token (perf only).
  5. Nits: listed under Asks. Also: ids is bound without the misalignment allowance, so a view at an unaligned offset would assert (real graphs use offset 0). The device gate covers all of RDNA3, but only gfx1151 was measured. Commits 1 to 4 still name the removed environment variables in their messages, so the squash message should come from the corrected description.

Claims

Claim Result
earlier asks addressed reproduced (table above)
OFF build has no EXL3 SPIR-V reproduced
MUL_MAT_ID "one product from 512 rows, hi + lo below, as #201 decides it" not reproduced: the switch is on n_tokens
MUL_MAT_ID rows equal EXL3_MUL_MAT of their expert bit for bit not reproduced: test-exl3 rows_equal_mul_mat_per_expert: "no"
new test cases pass reproduced (138 / 38)
full suite 44369/44370 with one SET_ROWS flake 44370/44370 here
dense KLD about 1e-6, same top token, PPL equal reproduced (Qwen3.5-9B 2.00bpw; the author used 4.00bpw)
normal models: logits byte-identical, no speed change reproduced
LFM2.5-8B-A1B and Qwen3.8-Flash-Next numbers not tested (no MoE EXL3 model)
each commit builds alone not tested

Not tested

MUL_MAT_ID on a real MoE EXL3 model (no such model loads here: the directory loader supports only dense qwen35, and conversion was not possible); the speed cost of hi + lo for MUL_MAT_ID (test-backend-ops has no EXL3_MUL_MAT_ID perf case); out-of-range expert ids (the CPU reference asserts, so the suite cannot compare); per-commit builds; an OFF to ON to OFF reconfigure of one build directory; ROCm (not changed); drivers other than RADV.

@dzannotti dzannotti added waiting-user We asked the author for something. and removed verifying Building and running the PR to verify its claims. labels Nov 15, 2026
The GEMM path took one f16 product for every expert group from 512 tokens. ggml-org#201 takes one product only for an
expert with at least 512 routed rows and hi + lo for the others. The route now writes a second group table for
those experts (one_rows = 512 from 512 tokens on the GEMM path, as exl3_mmid_route on HIP); the rotation always
writes lo, the hi + lo GEMM runs over table 0 and the one-product GEMM over table 1. No GEMM work on an empty
MUL_MAT_ID (n_pairs == 0).

Tests: a per-case NMSE limit for EXL3_MUL_MAT_ID, 512 tokens at 128 experts (32 rows each) at 1e-10, and one
expert with 600 rows (one product) at the default limit.

Assisted-by: Claude Opus 5.5
- Dot path: groups of up to M rows of one expert with M from the token count (an expert gets at most one row per
  token), as on HIP, instead of the average rows over all experts. LFM2.5-8B-A1B, gfx1151, llama-bench pp4 / pp8 /
  pp16: 335 / 426 / 586 t/s against 306 / 379 / 548.
- GEMM from more than 4 rows per expert on average (was 8): pp48 / pp64 1085 / 1367 t/s against 991 / 1142.
- One token: no routing dispatch; the rotation and the dot kernel read each pair's expert from ids (as HIP).
  tg128 144.0 against 139.6 t/s.
- Measurement notes for the dense dot / GEMM switch at 8 rows and the MMID thresholds.
- Device gate: storage buffer offset alignment <= 4, so ids bind at their own offset without a misalignment
  allowance; assert the rotation's workgroup count against the device limit.
- Nits: one blank line in ggml-vulkan.cpp and one in ggml-vulkan-common.h dropped, comments one sentence per line,
  test comment names the 40-row cases.

Tests: EXL3_MUL_MAT_ID cases at the new switch (64 / 65 tokens at 128 experts, top-8) and perf cases for 128 experts
top-8 and the LFM2.5 expert shapes from 1 to 512 tokens.

Assisted-by: Claude Opus 5.5
Device gate, dot / GEMM switch, the product rule per expert and what is not ported (EXL3_GET_ROWS).

Assisted-by: Claude Opus 5.5
…path and for experts with up to 8 rows

At 32 tokens on the LFM2.5-8B-A1B stacks an expert with 11 rows runs the dot kernel inside
EXL3_MUL_MAT_ID, while EXL3_MUL_MAT with 11 rows takes the GEMM (test-exl3 --op-gguf:
rows_equal_mul_mat_per_expert "no", NMSE 3.6e-14).

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
Two synthetic EXL3_MUL_MAT_ID cases at 512 tokens: skewed routing, where the first expert has exactly 512 rows (one
product) and the others take hi + lo, and uniform routing over 16 experts, where no expert reaches 512 rows. The
uniform case must be f32 grade (NMSE <= 1e-10 against ggml_mul_mat_id on the CPU), without the calibrated pass, so a
backend that takes one product per batch instead of per expert fails it.

Assisted-by: Claude Opus 5.5
@Nathanw1014

Copy link
Copy Markdown
Author

Thanks @dzannotti for the three rounds of review, and for spelling out each rebase conflict. That made the rebase quick.

Rebased onto master dc55218. Per ask:

  1. MUL_MAT_ID now picks the product count per expert, as HIP's exl3_mmid_route does. The route writes a second group table for the experts with at least 512 routed rows. Those run the one-product GEMM, and the rest run hi + lo.

    test-exl3 --backend Vulkan0 passes all 10 MUL_MAT_ID cases, including tokens=520 skewed. It now exits 0 and reports the 16 EXL3_GET_ROWS cases as skipped, as you suggested earlier.

    I added two test-exl3 cases at 512 tokens:

    • skewed, with the first expert at exactly 512 rows
    • uniform, at f32 grade only: NMSE 2.7e-14 here, while the old rule gives 3.8e-8 and fails

    test-backend-ops also has a 512-token case at a 1e-10 limit.

  2. LFM2.5-8B-A1B EXL3 4.10bpw, gfx1151, Mesa 26.2.4, llama-bench, mean of 4 ABBA runs, old rule -> new rule:

ubatch test old rule new rule
512 pp512 5367 3770
512 pp2048 5440 3810
2048 pp512 5374 3753
2048 pp2048 5922 5145
2048 tg128 140.0 144.9

The prompt cost is the rule itself. On this model, a 512-token batch gives about 64 rows per expert, so every MoE row takes hi + lo.

KLD against the CPU path, same ubatch, 4 chunks of 4096:

  • ub512: 0.0048 -> 0.0052
  • ub2048: 0.0047 -> 0.0052
  • ub256: 0.0029 (all hi + lo either way)

The CPU path is deterministic at a fixed ubatch, so measured like that the floor is 0 and the bar is 1e-4. With the cross-ubatch floor you used before (CPU path ub256 vs ub512, 0.0016 here), the bar is 0.0033. ub256 meets it; ub512 and ub2048 miss it, with the old rule too.

Most of the gap comes from the dense one-product rule. A local build with EXL3_MUL_MAT always at hi + lo gives 0.0031 at ub512 and 0.0037 at ub2048. Why the per-expert rule moves KLD slightly up I don't know yet. The PPL of the CPU path itself moves with the ubatch (21.86 / 21.89 / 21.91), so routing on this model reacts to small differences.

How would you like to handle ask 2 for MoE models? I see three options: keep #201's dense rule and judge at ub256, change the dense rule on Vulkan only, or change it on both backends.

The description is corrected:

  • the product rule is spelled out
  • "bit for bit" is limited to what test-exl3 checks
  • GET_ROWS: HIP has a kernel; on Vulkan it runs on the CPU
  1. Rebased; the conflicts went the way you listed.

  2. The README has a Vulkan paragraph (device gate, dot / GEMM switch, product rule).

  3. The dot groups now take their width from the token count, as on HIP, not from the average over all experts. LFM2.5, ub512 (measured on master 403dfcb, mean of 4 ABBA runs):

    • pp4: 298 -> 330 t/s
    • pp8: 362 -> 410 t/s

    In the same commit, the MUL_MAT_ID GEMM now starts above 4 rows per expert, and one token skips the routing dispatch. That is where the tg gain above comes from.

The nits are done, with measurement notes for the thresholds. I also added a device gate on storage-buffer offset alignment, so ids binds at its own offset.

Still open, not from this change:

  • test-exl3 --op-gguf on LFM2.5 fails 3 of 170 cases:
    • blk.0.shortconv.out_proj at 512 and at 513 rows, from the dense one-product rule (NMSE 5.0e-7)
    • an expert with 11 rows at 32 tokens that runs the dot kernel inside MUL_MAT_ID, while EXL3_MUL_MAT takes the GEMM (NMSE 4.8e-14, but not bit-equal)
  • The full Vulkan suite gives 61624/61630. The 6 failures (MUL_MAT q4_0, RMS_NORM_MIX) also fail on master.

Not run: ROCm, per-commit builds.

@dzannotti dzannotti added in-review We are reviewing. verifying Building and running the PR to verify its claims. and removed waiting-user We asked the author for something. in-review We are reviewing. labels Dec 2, 2026

@dzannotti dzannotti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

This review replaces our reviews of 2026-11-15 and 2026-11-22. All five asks are done. On Vulkan, EXL3_MUL_MAT_ID now picks the product count per expert, as HIP does, and the new 512-token cases catch the old rule. We reproduced your LFM2.5 numbers. The remaining KLD gap at ubatch 512 and 2048 comes from #201's dense one-product rule. ROCm has the same gap, so this PR does not cause it. A maintainer has to make the call on your question, so we hand the PR to the maintainers with our recommendation below.

Direction

Accept. This is the Vulkan half of #201. It is gated to RDNA3 on RADV and to GGML_EXL3=ON builds, and it now follows the HIP rules case by case.

Recommendation on your question (a)/(b)/(c)

This is our recommendation. The maintainers can overrule it.

Our recommendation is (c), one rule on both backends, as its own follow-up PR. Until that PR lands, judge this PR as in (a). The reasons:

  1. #201's dense rule causes the gap, not the MUL_MAT_ID change. With EXL3_MUL_MAT always at hi + lo, Vulkan KLD drops to 0.0013 at ub512 (floor 0.0011). The per-batch to per-expert change moves KLD by 0.0002, which is inside the error (+-0.0004). test-exl3 --op-gguf fails blk.0.shortconv.out_proj at 512 and 513 rows on ROCm0 too, with the same NMSE (7.0e-7). The same --op-gguf check fails 15 cases with the old rule and 3 with your head.
  2. We would not do (b). It gives the two backends different output for the same model without a hardware reason, and ROCm keeps the failing case.
  3. (c) is the right end state, because correctness comes before speed. The one-product rule fails #201's own f32-grade check on a shipping model. It costs pp on both backends: ROCm 11-15%, Vulkan 14-36%. The MUL_MAT_ID one-product experts must change at the same time. Our dense-only build broke the per-expert row equality and failed 8 MUL_MAT_ID --op-gguf cases on both backends. That change is in exl3.cu and needs ROCm numbers, so it does not belong in a Vulkan PR.
  4. If we hold this PR, Vulkan users keep the CPU path for EXL3. The PR matches the rule that ROCm already ships.

Asks

None block the merge.

  1. Should fix. test-exl3 --op-gguf on LFM2.5 fails the 32-token uniform MUL_MAT_ID case on Vulkan (an expert with 11 rows, NMSE 3.6e-14, not bit-equal). The reference splits rows at HIP's 32-row dot limit, and Vulkan's limit is 8. Fix the reference chunking for the backend, or list the case as expected in the README tests section.
  2. Nit. The PR body names only Claude Opus 5.5, but f6380fa34 has Assisted-by: Codex (GPT-6.1). Add it to the body.

Other nits, all optional:

  • the hard-wrapped comment on vk_op_exl3_mmv_push_constants
  • the two rows_pad asserts that dispatch already does
  • the hard-coded 16 - n_skip in test_exl3.c
  • README line 228, which names the 32-row threshold that only HIP uses

Correctness

The op level passes on both backends. On Vulkan0, EXL3_MUL_MAT is 138/138 and EXL3_MUL_MAT_ID is 41/41 (2 runs), and test-exl3 --backend Vulkan0 passes all cases with rc 0. ROCm0 gives the same counts with HIP_LAUNCH_BLOCKING unset and =1, and test-exl3 passes there too. The PR adds no head-only failure to the full Vulkan suite (61622/61630 against 61446/61451 on master). The extra failures are flaky RMS_NORM_MIX cases that also fail on master (see the details). test-vk-exact fails the same 11 checks as master. On Qwen2.5-1.5B Q4_K_M, f32 logits and tokens are byte-identical to master on all four corpora, and so is greedy decode. On LFM2.5-8B-A1B EXL3, 128 greedy tokens on Vulkan are identical to the CPU path. KLD is under the bar at ub256 and above it at ub512 and ub2048, as you reported. That is the dense-rule question above.

Performance

LFM2.5-8B-A1B EXL3 4.10bpw, t/s, mean of 2 rounds of -r 5:

test old rule (VK) this PR (VK) ROCm (master) dense hi + lo (VK) dense hi + lo (ROCm)
pp512, ub512 4990 3211 (-36%) 4295 2747 3822
pp2048, ub512 4993 3220 (-36%) 4354 2794 3858
pp2048, ub2048 5111 4221 (-17%) 5285 2721 4475
tg128 143.5 147.0 (+2.4%) 148.5 147.0 148.0

The direction and size of your numbers reproduce. Our absolute numbers are lower, maybe from the Mesa version (26.0.8 here). Non-EXL3 models are flat: Qwen2.5-1.5B Q4_K_M pp2048 at depths 0/12000/32000/64000 and tg128 are within 0.7% of master, inside the spread.

Verification

Strix Halo (gfx1151), RADV and ROCm. We tested the PR merged into master 8707b3a91 (9 commits after your base, clean merge) against master, with identical flags. We built the old rule from your rebased commit 29b4a900e. The "dense hi + lo" builds are a local one-line experiment on each backend and are not part of the PR.

Not tested

The model with your exact text (we used the four repository corpora), drivers other than RADV, a ROCm-hosted CPU-path KLD reference, and per-commit builds.

Thanks for the careful answer and the extra measurements.

Review made with AI on behalf of the strix-llama.cpp maintainers.

Full verification (for reproduction and agents)

Environment

Strix Halo (gfx1151, Radeon 8060S), Ubuntu 26.04, kernel 7.0.0. Mesa RADV 26.0.8. ROCm 10.1 (hipconfig 7.16.26385), AMD clang 24.0.0git d6f6cb69. cmake 4.2.3, gcc 15.2.0, glslc shaderc 2026.1.

Compared

  • master tip: 8707b3a915b51f614de48061622f3da118d43d4f
  • PR head: f6380fa343902aa1fcd795a20fbe48391a640226, merge base dc5521842, 9 commits behind, merges clean
  • merged: local merge commit (not pushed)
  • old rule: 29b4a900e (your rebased commit before the 7 new ones)
  • dense hi + lo experiment: the merged tree with const bool two = true; in ggml_cuda_op_exl3_mul_mat (exl3.cu) and products = 2u in ggml_vk_exl3_mul_mm (ggml-vulkan-exl3.cpp). The MUL_MAT_ID rules are unchanged.

Build

VK="-G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_VULKAN=ON -DGGML_HIP=OFF -DGGML_EXL3=ON"
HIP="-G Ninja -DCMAKE_BUILD_TYPE=Release -DGGML_HIP=ON -DGGML_VULKAN=OFF -DGPU_TARGETS=gfx1151 -DCMAKE_HIP_COMPILER=$(hipconfig -l)/clang -DCMAKE_PREFIX_PATH=$(hipconfig -R) -DGGML_EXL3=ON"

Vulkan: master, merged, old rule, experiment. ROCm: merged, experiment.

Models

  • LFM2.5-8B-A1B EXL3 4.10bpw: turboderp/LFM2.5-8B-A1B-exl3, branch 4.10bpw (commit f3f954b5d776), model.safetensors sha256 0e7e039135ecd3c1134d281571387b107a59708b183210bc46820165495af291. llama-bench cannot load a directory and the directory importer is qwen35 only, so we wrote one GGUF the way conversion/exl3.py does: the trellis, suh and svh copied as stored (experts stacked), the other tensors kept at their stored type (F32 for norms and 1-D tensors), and the metadata and tokenizer of LiquidAI/LFM2.5-8B-A1B-GGUF LFM2.5-8B-A1B-Q4_0.gguf (sha256 48ed1465d761311b2fd57b7fb46cf969a20b3a8281945b04e10f52bd1609e715) plus the exl3.* keys. Result: 523 tensors, sha256 906bc9160089efb3c5ed6b0b8d44c4f86264315e58a0fd5903d2a30b6101d544.
  • Qwen2.5-1.5B-Instruct Q4_K_M (Qwen/Qwen2.5-1.5B-Instruct-GGUF) for non-EXL3 parity and speed.

Commands

test-backend-ops test -b Vulkan0|ROCm0 -o EXL3_MUL_MAT|EXL3_MUL_MAT_ID      # ROCm also with HIP_LAUNCH_BLOCKING=1
test-exl3 --backend Vulkan0|ROCm0 ; test-exl3 --backend <dev> --op-gguf <lfm2.5>.gguf
test-backend-ops test -b Vulkan0 -j 4 ; test-vk-exact                       # master and merged
# KLD: the four tests/corpus files joined; CPU path = master Vulkan build (EXL3 ops on the CPU)
llama-perplexity -m <lfm2.5> -f <joined> -c 4096 -b 4096 --chunks 4 -ub <ub> -ngl 99 -fa on -ctk f16 -ctv f16 --kl-divergence-base cpu-ub<ub>.kld
llama-perplexity -m <lfm2.5> <same> -ub <ub> --kl-divergence-base cpu-ub<ub>.kld --kl-divergence   # each build, same ub
llama-completion -m <model> -f correctness-prose.txt -n 128 --temp 0 --seed 1 -no-cnv --ignore-eos -ngl 99 -fa on -c 16384 -ub 512
llama-debug -m <qwen2.5-1.5b> -f correctness-<t>.txt -c 16384 -b 16384 -ub 512 -ngl 99 -fa on -ctk f16 -ctv f16 --save-logits
llama-bench -m <lfm2.5> -p 512,2048 -n 0 -b 2048 -ub 512,2048 -r 5 -ngl 99 -fa 1 -ctk f16 -ctv f16 --load-mode none   # + -p 0 -n 128; 2 rounds, order reversed in round 2
llama-bench -m <qwen2.5-1.5b> -p 2048 -d 0,12000,32000,64000 -b 2048 -ub 512 -n 0 -r 5 ...                          # + -p 0 -n 128; master and merged alternated, 2 rounds

Results

KLD against the CPU path at the same ubatch, LFM2.5-8B-A1B EXL3 (4 x 4096 tokens). Floor: the CPU path at ub512 against ub256 gives 0.00105, and ub2048 against ub512 gives 0.00113. The CPU path against itself gives 0. Bar = 2 x floor + 1e-4, about 0.0022.

ub old rule VK this PR VK dense hi + lo VK ROCm (master rule) dense hi + lo ROCm
256 0.0020 0.0020 0.0020 0.0077 0.0077
512 0.0035 0.0037 0.0013 0.0087 0.0081
2048 0.0036 0.0036 0.0021 0.0090 0.0088

The error is about +-0.0002 to +-0.0005. Same top token on Vulkan: 98.97% / 98.28% / 98.24% (this PR) and 98.97% / 99.39% / 99.07% (dense hi + lo). CPU-path PPL: 27.153 / 27.151 / 27.138 at ub 256 / 512 / 2048. ROCm is about 0.008 from the reference at every ubatch and under both rules. Its greedy decode leaves the CPU path late in the 128 tokens, while Vulkan matches it byte for byte. So the ROCm gap does not come from the product rule. It comes from the other ops, because the reference runs them on Vulkan. That is outside this PR.

test-exl3 --op-gguf on LFM2.5 (170 cases):

build Vulkan0 ROCm0
old rule 15 fail -
this PR (ROCm = master) 3 fail: shortconv.out_proj 512/513 (NMSE 7.0e-7), MMID 32 tok uniform 11 rows 2 fail: shortconv.out_proj 512/513 (NMSE 7.0e-7)
dense hi + lo 9 fail: MMID 512/513 skewed (row equality), 32 tok uniform 8 fail: MMID 512/513 skewed (row equality)

Full Vulkan suite: master 61446/61451, merged 61622/61630 (176 new EXL3 cases pass). Master and merged both fail MUL_MAT q4_0 m=8192 k=5120 n=5/7/8 and RMS_NORM_MIX cases. The RMS_NORM_MIX cases that fail differ from run to run (run alone 3 times on each side: master fails 2-3 and merged 2-3 per run, at ERR 1.00e-7 to 1.10e-7 against a 1e-7 limit, and master fails every case that merged fails).

LFM2.5 llama-bench, every round (t/s +- stddev, round 1 / round 2):

test old rule VK this PR VK dense hi + lo VK ROCm dense hi + lo ROCm
pp512 ub512 5027+-16 / 4953+-35 3202+-186 / 3220+-146 2772+-141 / 2721+-154 4297+-119 / 4292+-119 3838+-84 / 3806+-122
pp512 ub2048 5011+-31 / 4736+-66 3239+-61 / 3175+-171 2804+-92 / 2848+-166 4176+-94 / 4348+-39 3758+-112 / 3771+-100
pp2048 ub512 4999+-16 / 4987+-27 3191+-63 / 3248+-48 2813+-77 / 2774+-36 4366+-20 / 4342+-7 3862+-4 / 3854+-10
pp2048 ub2048 5146+-150 / 5076+-205 4116+-75 / 4326+-218 2604+-168 / 2838+-116 5281+-35 / 5288+-27 4486+-42 / 4464+-37
tg128 144 / 143 147 / 147 147 / 147 149 / 148 148 / 148

Qwen2.5-1.5B Q4_K_M Vulkan, master / merged, t/s (round 1, round 2):

test master merged
pp2048 d0 7071+-31, 7057+-32 7064+-32, 7057+-28
pp2048 d12000 3751+-30, 3732+-27 3713+-41, 3717+-36
pp2048 d32000 1932+-13, 1934+-16 1916+-33, 1938+-24
pp2048 d64000 1031+-18, 1059+-18 1031+-14, 1044+-22
tg128 194.5+-0.2, 194.5+-0.2 194.4+-0.2, 194.5+-0.1

Correctness

check method result
changed ops test-backend-ops EXL3_MUL_MAT / _ID, Vulkan0 x2, ROCm0 HLB unset and =1 pass, 138 + 41 each
contract test-exl3 --backend Vulkan0 / ROCm0 (HLB unset and =1) / CPU pass, rc 0
real-model ops test-exl3 --op-gguf LFM2.5 see table: dense-rule cases fail on both backends
full suite test-backend-ops -b Vulkan0 -j 4, master vs merged no head-only failure (RMS_NORM_MIX flaky on master too, 3 runs each side)
fusion test-vk-exact same 11 failures as master
non-EXL3 logits llama-debug f32 logits + tokens, 4 corpora byte-identical
non-EXL3 decode greedy 256, master A/A and merged identical
EXL3 KLD llama-perplexity vs CPU path, ub 256/512/2048 ub256 pass, ub512/2048 above the bar (dense rule)
EXL3 decode greedy 128, CPU path A/A vs Vulkan A/A identical
HIP -Werror / spill gate n/a no HIP file changed
performance llama-bench as above see tables

Findings in full

  • All asks from 2026-11-22 are done. The route matches HIP exl3_mmid_route: the same 512-row threshold, >= (an expert with exactly 512 rows takes one product on both backends), the same group-table bounds, and the same chunking. The ids binding is safe through the new offset-alignment gate.
  • The new tight cases catch the old rule: the 512-token test-backend-ops case at 1e-10 and the test-exl3 uniform f32 case. The skewed case at exactly 512 rows catches > vs >=.
  • The dot-path reference mismatch at 9..32 rows (ask 1) is a test issue, not a precision issue (3.6e-14).

Claims

  • Per-expert MUL_MAT_ID as HIP, test-exl3 Vulkan0 passes incl. 520 skewed: reproduced.
  • New 512-token cases at a tight limit: they pass on Vulkan0 and ROCm0 (uniform f32 case 2.7e-14 on Vulkan0). We did not run the new test file against the old kernel. By code reading, the old per-batch rule (about 4e-8) cannot pass them.
  • pp512 5367 -> 3770 at ub512, tg 140.0 -> 144.9: reproduced in direction and size (4990 -> 3211, 143.5 -> 147.0).
  • KLD misses the cross-ubatch bar at ub512/2048 with both rules, mostly from the dense rule: reproduced (0.0035/0.0037 vs bar 0.0022; dense hi + lo gives 0.0013/0.0021).
  • Per-expert rule moves KLD up: not reproduced beyond noise (+0.0002 at ub512, 0 at ub2048).
  • --op-gguf 3/170 failures on Vulkan: reproduced, same cases. ROCm fails the 2 shortconv cases too.
  • Full suite 61624/61630 with failures that also fail on master: reproduced, with the flaky cases noted above.

Not tested

Your exact text and chunking, drivers other than RADV, a ROCm-hosted CPU-path reference (no switch to put EXL3 on the CPU in a ROCm build), and per-commit builds.

@dzannotti
dzannotti dismissed stale reviews from themself December 3, 2026 00:37

Replaced by our re-review of 2026-12-03 (review 6161632616): the requested changes are done.

@dzannotti dzannotti added needs-human Review done; a maintainer must approve. verified The claims were reproduced. and removed verifying Building and running the PR to verify its claims. CUDA model conversion labels Dec 3, 2026
@dzannotti dzannotti assigned dzannotti and unassigned Nathanw1014 Dec 3, 2026

@dzannotti dzannotti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by the maintainers, as verified in the earlier review on this head. For ask 2 we judge this PR as in (a) for now: the KLD gap at ubatch 512 and above comes from the dense one-product rule of #201, which master already has. Changing that rule on both backends is welcome as its own PR.

Review made with AI on behalf of the strix-llama.cpp maintainers.

@dzannotti dzannotti added ready-to-merge Review done, low risk, approved. and removed needs-human Review done; a maintainer must approve. labels Dec 3, 2026
@Nathanw1014
Nathanw1014 merged commit cd44688 into halo-box:master Dec 4, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ggml ready-to-merge Review done, low risk, approved. risk:medium Risk: medium testing verified The claims were reproduced. Vulkan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants