[PR #2437] [Engine] sycl: the IQ4_XS expert dot reads its codebook from registers #4045

Open
opened 2026-11-07 15:32:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2437
Author: @deriknel
Created: 10/14/2026
Status: 🔄 Open

Base: main ← Head: pr/sycl-iq4xs-codebook-registers


📝 Commits (1)

  • dbc834b sycl: the IQ4_XS expert dot reads its codebook from registers

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 sycl/src/kernels/cuda/iq_kernels.dp.cpp (+4 -0)

📄 Description

Problem and result

vec_dot_iq4_xs_q8_1, the dot the expert gate/up lane kernels use for IQ4_XS, looks each 4-bit value up with get_int_from_table_16, which reads kvalues_iq4nl from global memory on every lookup. vec_dot_iq4_nl_q8_1 and IQ4_XS's split kernel already get the same ints from iq4nl_pair, which keeps the codebook in registers. With this change the IQ4_XS dot does the same, with the same output. The gain scales with how many expert layers are IQ4_XS.

Haxi52 measured it on Swift 1.5 IQ4_XS, where every routed expert's gate/up rows are IQ4_XS, on three Arc Pro B70s with 0.1.44 (comment below): decode 51.1 -> 66.0 tok/s chat, 49.5 -> 65.0 agent (+29% / +31%), prompt reading unchanged, parity suites passing. No scope agreement needed: a focused fix.

Approach

sycl/src/kernels/cuda/iq_kernels.dp.cpp, vec_dot_iq4_xs_q8_1: iq4nl_pair(aux_q4) in place of get_int_from_table_16(aux_q4, kvalues_iq4nl), under the existing compile-time STRATA_IQ4NL_FAST switch (on by default; -DSTRATA_IQ4NL_FAST=0 keeps the old lookup). Both return the same ints. The branch still merges cleanly into main.

Validation

Setup for every run: main e88ee39d built for SYCL (AOT bmg-g31, oneAPI 2026.1, Compute Runtime 26.35.39758.10, IGC 2.41.5) in a container; host CachyOS, kernel 7.2.11, xe. 2x Intel Arc Pro B70 32 GB, layer split 26, Swift 1.5 Flash-Next IQ3_S with every expert in VRAM, --max-context 262144, int8 KV, --spec 4 --spec-min-p 0.6, --prefill 4096. Each build has only this PR's commit on top of main. Greedy check: 5 fixed prompts (prose, code, maths, an edit, a story), temperature 0, 400 tokens, thinking off, compared character by character. Swift IQ3_S has IQ4_XS on one expert layer of 48, so the gain here is small. Pipeline windows off; main and this PR alternated on fresh engines, two runs each.

Passed:

  • Decode, bench medians: main 83.2 / 82.8 (prose), 106.6 / 106.6 (code); this PR 83.9 / 84.0 and 107.4 / 107.7 (+1.1% / +0.9%).
  • Greedy text on the 5 prompts identical to main's, both runs.
  • ctest on both cards: the same 3 failures as on main; iq_parity with fixtures, 0 failures.
  • Kernel time on 0.1.44.1 (unitrace, IQ4_XS gate/up kernel, 633 launches): 378.0 -> 171.4 us per launch; not re-traced on 0.2.0.

Failed:

  • none observed.

Not run:

  • CUDA, HIP and Metal builds: the change is in sycl/ only.
  • An IQ4_XS-heavy model on our cards (Haxi52's run above covers it on 0.1.44).

Limits

The grouped gate/up path (native_gu_multi_kernel) is not changed; Haxi52 found its cost is elsewhere (lane layout and loads).

We investigated (myself and Claude Opus 5.5 in Claude Code) and I reviewed the findings and ran every test on my two Arc Pro B70s on my CachyOS machine.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2437 **Author:** [@deriknel](https://github.com/deriknel) **Created:** 10/14/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/sycl-iq4xs-codebook-registers` --- ### 📝 Commits (1) - [`dbc834b`](https://github.com/Niko1221/Strata/commit/dbc834b9ba438cb196af14f8aaa84625f2bb4fd0) sycl: the IQ4_XS expert dot reads its codebook from registers ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `sycl/src/kernels/cuda/iq_kernels.dp.cpp` (+4 -0) </details> ### 📄 Description ## Problem and result `vec_dot_iq4_xs_q8_1`, the dot the expert gate/up lane kernels use for IQ4_XS, looks each 4-bit value up with `get_int_from_table_16`, which reads `kvalues_iq4nl` from global memory on every lookup. `vec_dot_iq4_nl_q8_1` and IQ4_XS's split kernel already get the same ints from `iq4nl_pair`, which keeps the codebook in registers. With this change the IQ4_XS dot does the same, with the same output. The gain scales with how many expert layers are IQ4_XS. ## Related discussion Haxi52 measured it on Swift 1.5 IQ4_XS, where every routed expert's gate/up rows are IQ4_XS, on three Arc Pro B70s with 0.1.44 (comment below): decode 51.1 -> 66.0 tok/s chat, 49.5 -> 65.0 agent (+29% / +31%), prompt reading unchanged, parity suites passing. No scope agreement needed: a focused fix. ## Approach `sycl/src/kernels/cuda/iq_kernels.dp.cpp`, `vec_dot_iq4_xs_q8_1`: `iq4nl_pair(aux_q4)` in place of `get_int_from_table_16(aux_q4, kvalues_iq4nl)`, under the existing compile-time `STRATA_IQ4NL_FAST` switch (on by default; `-DSTRATA_IQ4NL_FAST=0` keeps the old lookup). Both return the same ints. The branch still merges cleanly into `main`. ## Validation Setup for every run: `main` e88ee39d built for SYCL (AOT `bmg-g31`, oneAPI 2026.1, Compute Runtime 26.35.39758.10, IGC 2.41.5) in a container; host CachyOS, kernel 7.2.11, `xe`. 2x Intel Arc Pro B70 32 GB, layer split 26, Swift 1.5 Flash-Next IQ3_S with every expert in VRAM, `--max-context 262144`, int8 KV, `--spec 4 --spec-min-p 0.6`, `--prefill 4096`. Each build has only this PR's commit on top of `main`. Greedy check: 5 fixed prompts (prose, code, maths, an edit, a story), temperature 0, 400 tokens, thinking off, compared character by character. Swift IQ3_S has IQ4_XS on one expert layer of 48, so the gain here is small. Pipeline windows off; `main` and this PR alternated on fresh engines, two runs each. **Passed:** - Decode, bench medians: `main` 83.2 / 82.8 (prose), 106.6 / 106.6 (code); this PR 83.9 / 84.0 and 107.4 / 107.7 (+1.1% / +0.9%). - Greedy text on the 5 prompts identical to `main`'s, both runs. - `ctest` on both cards: the same 3 failures as on `main`; `iq_parity` with fixtures, 0 failures. - Kernel time on 0.1.44.1 (unitrace, IQ4_XS gate/up kernel, 633 launches): 378.0 -> 171.4 us per launch; not re-traced on 0.2.0. **Failed:** - none observed. **Not run:** - CUDA, HIP and Metal builds: the change is in `sycl/` only. - An IQ4_XS-heavy model on our cards (Haxi52's run above covers it on 0.1.44). ## Limits The grouped gate/up path (`native_gu_multi_kernel`) is not changed; Haxi52 found its cost is elsewhere (lane layout and loads). We investigated (myself and Claude Opus 5.5 in Claude Code) and I reviewed the findings and ran every test on my two Arc Pro B70s on my CachyOS machine. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4045
No description provided.