Repository navigation
sycl: IQ3 code reorder - #29107
sycl: IQ3 code reorder#29107
Conversation
|
Hi @anantshri, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
arthw
left a comment
There was a problem hiding this comment.
It's good job!
Qwen3.8-27B-UD-IQ3_XXS.gguf on B60:
| Test | fa | Base t/s | Primary t/s | Increase Rate (Primary vs Base) |
|---|---|---|---|---|
| pp512 | 0 | 159.10 | 162.98 | 2.44% |
| pp512 | 1 | 159.70 | 159.65 | -0.03% |
| tg128 | 0 | 7.67 | 14.94 | 94.78% |
| tg128 | 1 | 7.67 | 14.95 | 94.92% |
Thank you!
b58bc4b to
acec959
Compare
|
There was a problem hiding this comment.
Flags used:
GGML_SYCL_ENABLE_DNN=1
GGML_SYCL_ENABLE_MKL_FA=0
GGML_SYCL_FA_ONEDNN=1
GGML_SYCL_FA_ONEDNN_MAX_KV=0
GGML_SYCL_GRAPH=0 \
everything here is tested without MTP
It is alot faster.
Double the speed vs unfixed.
Qwen3.8-27B-GSQ-RCO-IQ3_S-mtp.gguf
Before:
0.25.985.651 I slot print_timing: id 0 | task 0 | n_gen = 100, tg = 8.02 t/s, tg_3s = 8.10 t/s 0.29.103.753 I slot print_timing: id 0 | task 0 | n_gen = 125, tg = 8.02 t/s, tg_3s = 8.02 t/s 0.32.221.462 I slot print_timing: id 0 | task 0 | n_gen = 150, tg = 8.02 t/s, tg_3s = 8.02 t/s 0.35.338.813 I slot print_timing: id 0 | task 0 | n_gen = 175, tg = 8.02 t/s, tg_3s = 8.02 t/s 0.38.341.256 I slot print_timing: id 0 | task 0 | n_gen = 199, tg = 8.01 t/s, tg_3s = 7.99 t/s
After:
1.09.141.294 I slot print_timing: id 0 | task 426 | n_gen = 100, tg = 15.38 t/s, tg_3s = 15.54 t/s 1.12.195.428 I slot print_timing: id 0 | task 426 | n_gen = 147, tg = 15.38 t/s, tg_3s = 15.39 t/s 1.15.259.739 I slot print_timing: id 0 | task 426 | n_gen = 194, tg = 15.37 t/s, tg_3s = 15.34 t/s 1.18.269.887 I slot print_timing: id 0 | task 426 | n_gen = 240, tg = 15.35 t/s, tg_3s = 15.28 t/s
Q4_K_M is still faster without the fix.
Qwen3.8-27B-Q4_K_M.gguf:
0.30.634.696 I slot print_timing: id 0 | task 0 | n_gen = 100, tg = 19.74 t/s, tg_3s = 19.94 t/s 0.33.671.013 I slot print_timing: id 0 | task 0 | n_gen = 160, tg = 19.75 t/s, tg_3s = 19.76 t/s 0.36.677.059 I slot print_timing: id 0 | task 0 | n_gen = 219, tg = 19.71 t/s, tg_3s = 19.63 t/s 0.39.689.984 I slot print_timing: id 0 | task 0 | n_gen = 278, tg = 19.69 t/s, tg_3s = 19.58 t/s
|
Great results on B580 for iq3, but q3/q4 appear to have gotten slightly slower. ./llama-bench -t 6 -ngl 99 -ctk q8_0 -ctv q8_0 -fa 1 -p 20000 -n 1000 -b 2048 -ub 2048 -m $M/archive/Qwen3.5-9B-Q4_K_M.gguf,$M/archive/Qwen3.5-9B-Q3_K_M.gguf,$M/archive/Qwen3.5-9B-UD-IQ3_XXS.gguf
|
9a3d138 to
b25268d
Compare
Regarding Q4 being slow, this specfic code chage was done keeping https://huggingface.co/ISTA-DASLab/Qwen3.8-27B-GSQ-RCO-GGUF in mind and not any other model. I tried some tests but he delta seems small.
|
|
Nice
|
|
this is now ready for review. @arthw @ggerganov @Nocturna22 |
b25268d to
9748c5b
Compare
|
rebased to origin and addressed @Titaniumtown comment. |
…fill Add persistent reordered weight layouts for IQ3_S and IQ3_XXS. Weights are reordered once at load time; the reordered MMVQ dot products then walk dense super-blocks with dp4a and SWAR sign expansion instead of gathering bits from the interleaved standard layout. Reorder-aware dequantization feeds the batched prefill GEMMs so prompt processing sees the same benefit. Also harden the oneDNN build check: a missing DNNL package or a CPU-only DNNL build now fails at configure time instead of silently producing a degraded backend. Measured on Intel Arc Pro B70 with Qwen3.8-27B-GSQ-RCO-IQ3_S (MTP), -ngl 999 -b 4096 -ub 1024 -fa on: tg256 @ 0 ctx 12.92 -> 23.54 tok/s (+82%) tg256 @ 9,216 12.33 -> 21.69 tok/s (+76%) tg256 @ 64,000 9.76 -> 14.91 tok/s (+53%) pp8192 833.9 -> 833.6 tok/s (flat) Qwen3.5-9B Q4_K_M / Q3_K_M are unchanged within noise (largest delta -0.5% pp, tg flat), so standard quants are not affected. The MMVQ GLU fusion widening and rms_norm+scale fusion are intentionally not part of this change; master already carries them via ggml-org#28931.
9748c5b to
5b61aee
Compare
Independent verification on Intel Arc Pro B70 (SYCL): speed win confirmed, quality neutralAI usage disclosure: YES. This comment was drafted by an AI agent, and every measurement in it was collected by AI agents operating this machine unattended (with the owner's authorisation) over a single overnight session. All commands, raw JSONL result files and build hashes are retained and can be shared on request. Hardware: Intel Arc Pro B70 (BMG G31, 32 GB, Speed (llama-server, ctx 122880,
K-quant numerics are untouched: Quality — perplexity parity.
So the PR's non-bit-preserving greedy divergence (same prompt, different completion than master, Negative result, so nobody repeats it. In the reordered IQ3_XXS layout the per-block
+0.1% (run-to-run sd ~0.02) for +32 B/block of VRAM, with identical per-chunk perplexity — i.e. Also of note for anyone testing on this card: Methodology note: the table cells above are single runs (temp 0, seed 42, 192 tokens, one server |
|
@anantshri Thank you! |
Union-resolve the reorder-type switch in ggml_backend_sycl_buffer_init_tensor: keep our IQ3_XXS/IQ3_S cases and take upstream's new MXFP4 case.
|
rebased |
|
I have crash with model |
|
@AdamN1 check #30604 in my tests this has sorted the issue. Cause: the fused-dequant GEMM that serves prefill/large batches ( Fix: the reorder flag is now passed through and types without a reordered A-stage decline the fused path, falling back to the reorder-aware conversion route. The reorder and its speedup are fully preserved. Verified on B70 with your exact server command (minus Immediate workaround on current master if you can't build the fix branch: |
ggml_sycl_fused_dequant_gemm (the dense >8-column mul_mat path taken by prefill and large batches) decoded its A stage with the standard block layout unconditionally: fg_fused_run hardcodes fg_visit_type(..., false). After ggml-org#29107 made IQ3_S/IQ3_XXS reorderable, any already-installed tensor routed here was decoded from the reordered SoA bytes as if they were standard blocks -> confidently wrong logits (the upstream dist-sampler assert is the NaN face under MTP). The plain path could never meet a reordered tensor before ggml-org#29107: the only types with SoA decoders (Q8_0/Q4_K/Q5_K/Q6_K) are exactly the ones fg_plain_ok() excludes. Wire the tensor's reorder flag through and let fg_visit_layout decline: for types without an SoA stage (IQ3_S/IQ3_XXS today) the fused path now returns false and the caller falls through to the reorder-aware f16 conversion route, which decodes correctly. Non-reordered tensors and SoA-capable types keep the fused fast path unchanged. Repro/verification (Arc Pro B70, Qwen3.8-27B-GSQ-RCO-IQ3_S-mtp, master 23deec0): every default-config generation turned to garbage; with this patch the same runs are clean and the reordered MMVQ decode speedup is retained.
|
@anantshri work nice, I don't have speedup on pp but tg looks great Master from 20261010 Your branch It's prompt from work |
…own copy of our work Upstream added an IQ3_S / IQ3_XXS weight reorder (ggml-org#29107), a Q8_0 MoE reorder (ggml-org#29337) and wide q4_K / q5_K dequant stores (ggml-org#29696), all of which this branch already carries. The replay kept our side of each conflicting hunk but left upstream's copies next to ours; this removes them. - IQ3: our reorder, MMVQ, MoE GEMV and dequant stay, upstream's go. Upstream's IQ3_S layout puts d before the scales and ours after, so the two must not mix. - Q8_0 MoE: one reorder_qw_q8_0_moe (upstream's, same layout); our MoE reorder GEMV is kept. - dequant: our wide K-quant and q8_0 reorder dequant are kept (they also cover the reordered layouts); upstream's q4_0 reorder fix (ggml-org#30374) stays. It also restores upstream's side where the replay took ours: the f16 src1 pointer in ggml_sycl_op_mul_mat_sycl (ggml-org#29889), SET_ROWS on all threads (ggml-org#30454), and the lilicorr block size and top_k in the DFlash draft (ggml-org#30506). Assisted-by: Claude Opus 5.5
…own copy of our work Upstream added an IQ3_S / IQ3_XXS weight reorder (ggml-org#29107), a Q8_0 MoE reorder (ggml-org#29337) and wide q4_K / q5_K dequant stores (ggml-org#29696), all of which this branch already carries. The replay kept our side of each conflicting hunk but left upstream's copies next to ours; this removes them. - IQ3: our reorder, MMVQ, MoE GEMV and dequant stay, upstream's go. Upstream's IQ3_S layout puts d before the scales and ours after, so the two must not mix. - Q8_0 MoE: one reorder_qw_q8_0_moe (upstream's, same layout); our MoE reorder GEMV is kept. - dequant: our wide K-quant and q8_0 reorder dequant are kept (they also cover the reordered layouts); upstream's q4_0 reorder fix (ggml-org#30374) stays. It also restores upstream's side where the replay took ours: the f16 src1 pointer in ggml_sycl_op_mul_mat_sycl (ggml-org#29889), SET_ROWS on all threads (ggml-org#30454), and the lilicorr block size and top_k in the DFlash draft (ggml-org#30506). Assisted-by: Claude Opus 5.5
* sycl: persistent IQ3_S/IQ3_XXS weight reorder for SYCL decode and prefill Add persistent reordered weight layouts for IQ3_S and IQ3_XXS. Weights are reordered once at load time; the reordered MMVQ dot products then walk dense super-blocks with dp4a and SWAR sign expansion instead of gathering bits from the interleaved standard layout. Reorder-aware dequantization feeds the batched prefill GEMMs so prompt processing sees the same benefit. Also harden the oneDNN build check: a missing DNNL package or a CPU-only DNNL build now fails at configure time instead of silently producing a degraded backend. Measured on Intel Arc Pro B70 with Qwen3.8-27B-GSQ-RCO-IQ3_S (MTP), -ngl 999 -b 4096 -ub 1024 -fa on: tg256 @ 0 ctx 12.92 -> 23.54 tok/s (+82%) tg256 @ 9,216 12.33 -> 21.69 tok/s (+76%) tg256 @ 64,000 9.76 -> 14.91 tok/s (+53%) pp8192 833.9 -> 833.6 tok/s (flat) Qwen3.5-9B Q4_K_M / Q3_K_M are unchanged within noise (largest delta -0.5% pp, tg flat), so standard quants are not affected. The MMVQ GLU fusion widening and rms_norm+scale fusion are intentionally not part of this change; master already carries them via ggml-org#28931. * removing wait as per review request * sycl : fix fusion.cpp line ending
* sycl: persistent IQ3_S/IQ3_XXS weight reorder for SYCL decode and prefill Add persistent reordered weight layouts for IQ3_S and IQ3_XXS. Weights are reordered once at load time; the reordered MMVQ dot products then walk dense super-blocks with dp4a and SWAR sign expansion instead of gathering bits from the interleaved standard layout. Reorder-aware dequantization feeds the batched prefill GEMMs so prompt processing sees the same benefit. Also harden the oneDNN build check: a missing DNNL package or a CPU-only DNNL build now fails at configure time instead of silently producing a degraded backend. Measured on Intel Arc Pro B70 with Qwen3.8-27B-GSQ-RCO-IQ3_S (MTP), -ngl 999 -b 4096 -ub 1024 -fa on: tg256 @ 0 ctx 12.92 -> 23.54 tok/s (+82%) tg256 @ 9,216 12.33 -> 21.69 tok/s (+76%) tg256 @ 64,000 9.76 -> 14.91 tok/s (+53%) pp8192 833.9 -> 833.6 tok/s (flat) Qwen3.5-9B Q4_K_M / Q3_K_M are unchanged within noise (largest delta -0.5% pp, tg flat), so standard quants are not affected. The MMVQ GLU fusion widening and rms_norm+scale fusion are intentionally not part of this change; master already carries them via ggml-org#28931. * removing wait as per review request * sycl : fix fusion.cpp line ending
…own copy of our work Upstream added an IQ3_S / IQ3_XXS weight reorder (ggml-org#29107), a Q8_0 MoE reorder (ggml-org#29337) and wide q4_K / q5_K dequant stores (ggml-org#29696), all of which this branch already carries. The replay kept our side of each conflicting hunk but left upstream's copies next to ours; this removes them. - IQ3: our reorder, MMVQ, MoE GEMV and dequant stay, upstream's go. Upstream's IQ3_S layout puts d before the scales and ours after, so the two must not mix. - Q8_0 MoE: one reorder_qw_q8_0_moe (upstream's, same layout); our MoE reorder GEMV is kept. - dequant: our wide K-quant and q8_0 reorder dequant are kept (they also cover the reordered layouts); upstream's q4_0 reorder fix (ggml-org#30374) stays. It also restores upstream's side where the replay took ours: the f16 src1 pointer in ggml_sycl_op_mul_mat_sycl (ggml-org#29889), SET_ROWS on all threads (ggml-org#30454), and the lilicorr block size and top_k in the DFlash draft (ggml-org#30506). Assisted-by: Claude Opus 5.5
…own copy of our work Upstream added an IQ3_S / IQ3_XXS weight reorder (ggml-org#29107), a Q8_0 MoE reorder (ggml-org#29337) and wide q4_K / q5_K dequant stores (ggml-org#29696), all of which this branch already carries. The replay kept our side of each conflicting hunk but left upstream's copies next to ours; this removes them. - IQ3: our reorder, MMVQ, MoE GEMV and dequant stay, upstream's go. Upstream's IQ3_S layout puts d before the scales and ours after, so the two must not mix. - Q8_0 MoE: one reorder_qw_q8_0_moe (upstream's, same layout); our MoE reorder GEMV is kept. - dequant: our wide K-quant and q8_0 reorder dequant are kept (they also cover the reordered layouts); upstream's q4_0 reorder fix (ggml-org#30374) stays. It also restores upstream's side where the replay took ours: the f16 src1 pointer in ggml_sycl_op_mul_mat_sycl (ggml-org#29889), SET_ROWS on all threads (ggml-org#30454), and the lilicorr block size and top_k in the DFlash draft (ggml-org#30506). Assisted-by: Claude Opus 5.5

Overview
Performance
On Intel Arc Pro B70 with oneAPI 2026.1.1:
Prefill remained effectively unchanged.
Requirements
This PR is created with the help of GPT5.6 Sol. (both in identification and fixing process.)