Repository navigation
Conversation
…ODE_FAST=1, opt-in, bitwise) The lane kernels that read the routed experts are ALU-bound on the B70: 280-480 instructions per 32-weight part for 8 dp4a, most of it the dpct per-byte emulation of byte_level_permute (Q2_0), the cmp/sel codebook lookup (IQ4_NL), the popcount/multiply ksigns unpacking and 64-bit address products. With the flag the seven IQ expert formats take kernels that give the same bits with less of that: table ksigns masks (IQ2_XXS/IQ2_XS), the signed grid byte as (g ^ m) + (m & 0x01010101), Q2_0 fields spread by shifts and masks, the IQ4_NL codebook through position tables, a block-pointer loop, two rows per lane in 16-lane sub-groups, and a multi-entry form for IQ2_XXS. Opt-in: nothing changes without STRATA_IQ_DECODE_FAST=1 (the hook is the first statement of launch_gu_port / launch_down_port and returns at once). native_grouped_parity --iq (ctest native_grouped_parity_iq_decode) compares the new kernels with the current ones bit for bit on random blobs, every IQ gate/up format with both IQ down formats, at 512 x 256 and 2560 x 640. SYCL only: iq_kernels.dp.cpp, the new iq_decode_tables.inc, the parity test, its ctest line and docs/INTEL.md; no shared header or src/ file touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the pull request. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to review properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes:
The rules are in CONTRIBUTING.md. |
|
/reopen Rebased on 0.2.0-beta ( |
|
Reopened, thank you. A maintainer will pick it up from here. If it conflicts with main, rebase it first; that speeds up review. |
19c93c8 to
7035777
Compare
|
Tested on 2x Arc Pro B70 (CachyOS, kernel 7.2.11, xe) with Swift 1.5 Flash-Next IQ2_XS: layer split 26, every expert in VRAM, int8 KV, MTP spec 4, 262144 context. The image is v0.2.0-beta (3d1fb48) plus our SYCL patches, including #2804 (
That is +3.1%, with every prompt between +2.8% and +3.2%. The second round matched within 0.2 tok/s. The text was identical on all 5 prompts in both rounds, and the MTP acceptance rates did not move. Prompt reads at ~1K, ~4.5K, ~33K and ~148K tokens were unchanged, as expected for a decode-only change. With #3248 and #2810 also on, the flag still adds its share: the three together give 136.7 tok/s mean (+11.2%). No xe resets or page faults over the whole run. The kernel suite passes (39 tests, the 1 failure is We carry this as a local patch with the flag on until it merges. 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. |
…ault on the B70 The IqFast gate/up and down kernels (Niko1221#2802-Niko1221#2812 community work, opt-in until now) produce the same bits as the default lane kernels (native_grouped_parity --iq). This pack's experts are IQ2_S / IQ2_XXS gate/up with Q2_0 down, all covered. They are now the default on a Battlemage card; STRATA_IQ_DECODE_FAST=0 turns them off (strata-sycl.sh must pass that 0 on: the b70 branch's wrapper change does). Their launches no longer ask for use_root_sync: the kernels have no root-group barrier. B70, Flash-Next IQ2_XS, greedy standard-v1 prompts (thinking on, 512 tokens), BFFB, decode tok/s per request r1/r2/r3: short B 65.7 65.2 65.7 | 65.5 62.9 64.7 F 69.7 66.8 69.1 | 70.2 68.9 69.3 (+6%) 4k B 55.1 56.6 61.6 | 53.8 54.8 58.9 F 58.1 58.6 63.6 | 57.5 57.6 64.7 (+5%) 16k B 55.2 60.7 53.7 | 53.7 56.7 52.4 F 57.9 63.2 56.6 | 56.0 64.7 54.0 (+4%) Greedy outputs byte-identical in all four runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem and result
The SYCL lane kernels that read the routed experts (
native_gu_kernel/native_down_kernel, 8 lanes a row) are ALU-bound on an Arc Pro B70, not memory-bound: 280-480 instructions per 32-weight part for its 8 dp4a, reading the experts at 19-44% of DRAM bandwidth. Most of it is the dpct per-byte emulation ofbyte_level_permutein the Q2_0 dot, the compare/select chain of the IQ4_NL codebook lookup, the popcount/multiply ksigns unpacking, and 64-bitkbx * sizeof(block)products every iteration.STRATA_IQ_DECODE_FAST=1switches the seven IQ expert formats (IQ2_XXS, IQ2_XS, IQ3_XXS, IQ3_S, IQ2_S gate/up; IQ4_NL, Q2_0 down) to kernels that produce the same bits with fewer instructions. Off by default; without the flag the engine runs exactly the code it ran before.Result on 0.2.0-beta, two B70s, one stream: decode 70.5 / 73.7 -> 76.7 / 80.1 tok/s (+8.7%), with output tokens and draft counts identical, so the gain is kernel time alone (verify window 39.5 / 40.2 -> 36.3 / 36.9 ms). Prompt reading unchanged.
Related discussion
Feature issue #2801 (closed in the 0.2.0 tracker reset). No maintainer agreement on scope yet; opt-in and SYCL-only so the default path stays byte-identical. Happy to change the switch name or drop formats.
Approach
sycl/src/kernels/cuda/iq_kernels.dp.cpp:IqFast<TY>decode traits whoseprepyields the same integers asMulti<TY>::prep/ thevec_dot_*_q8_1dot and reuses the sameactsandfinish; ksigns masks from a 2 KB table, the IQ4_NL codebook through four 256-entry position tables, Q2_0 fields spread with shifts and masks, aligned 8-byte loads.rows_dot_fastkeeps the k order, per-entry float sum order andlanes_sumof the current dots, so the bits cannot move. Two rows per lane in 16-lane sub-groups. One hook line at the top oflaunch_gu_port/launch_down_portthat returns at once when the latched flag is off.STRATA_IQ_DECODE_FAST_FMTS=<ggml ids>restricts it for an A/B.sycl/src/kernels/cuda/iq_decode_tables.inc(new): the two tables with the formulas that generate them.sycl/src/kernels/native_grouped_parity.cpp:--iqmode, fast against current, bitwise, every IQ gate/up format with both IQ down formats, groups of 1..6 entries, scattered destinations, stale scratch, rows a call must not write.sycl/CMakeLists.txt: ctestnative_grouped_parity_iq_decode.docs/INTEL.md: a section on the flag.Left alone:
include/,src/, CUDA and HIP, every kernel the default path runs, the K-quant / Q5_1 / Q8_0 expert formats, the prompt path.Validation
Setup: 0.2.0-beta
maine88ee39 against this branch rebased on it. 2x Intel Arc Pro B70 32 GB, kernel 7.1, Compute Runtime 26.22.38646.4 at run time; built with the repository dev image (sycl/tools/Dockerfileon the currentllama-sycl-b70:stable, IGC 2.41.5; an older cached base with IGC 2.36.3 cannot build 0.2.0, see #3219), AOTbmg-g31. Model Qwen3.8-Flash-Next ISTA GSQ-RCO IQ3_XXS,--layer-split 30 --prefill 8192 --max-context 65536 --kv int8 --spec 4 --mtp <BF16 draft layer> --mtp-max-t 4 --spec-min-p 0 --stream-experts --expert-cache auto, one slot, greedy, two fixed coding prompts with 512-token replies, a fresh engine per arm, then fresh 4K and 32K prompts. Coherence check and per-card health after every stop.Passed:
native_grouped_parity --iq(0.2.0-beta + this branch, head 7035777, one B70):0 failures, every case bitwise equal. Plainnative_grouped_parity:0 failures.STRATA_IQ_DECODE_FAST=1Failed: none observed.
Not run: two concurrent streams (main refuses
--batch-mtpon a layer split),--max-context 200000(a plain two-card layer split does not fit all 24,576 experts), CUDA/HIP/Metal builds (no file touched), Arc A-series cards,ctestas a whole (the parity binaries were run directly).Limits
STRATA_GU_LANES/STRATA_DOWN_LANESkeep the current kernels.docs/INTEL.mdsection quotes the earlier measurement on 0.1.xmain296b59d (79.5 -> 85.6 tok/s); I can swap in the 0.2.0 numbers above if you prefer.🤖 Generated with Claude Code