mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2806] [Engine] sycl: decode QSA selection and attention in fewer, shorter launches (opt-in, bitwise) #4274
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4274
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2806
Author: @hotschmoe
Created: 10/16/2026
Status: 🔄 Open
Base:
main← Head:pr/sycl-decode-attn📝 Commits (1)
1c501b0sycl: decode QSA selection and attention in fewer, shorter launches (opt-in, bitwise)📊 Changes
7 files changed (+1008 additions, -0 deletions)
View changed files
📝
docs/INTEL.md(+31 -0)📝
sycl/CMakeLists.txt(+12 -0)➕
sycl/include/strata/qsa_decode_attn_multi.hpp(+24 -0)📝
sycl/src/core/verify.cpp(+37 -0)📝
sycl/src/kernels/cuda/qsa_decode_attn.dp.cpp(+220 -0)📝
sycl/src/kernels/cuda/qsa_select.dp.cpp(+166 -0)➕
sycl/src/kernels/qsa_verify_batch_parity.cpp(+518 -0)📄 Description
Problem and result
On an Arc Pro B70 the QSA selection (block scores, top-k) and attention of a decode window are small, latency-bound launches, and a batch window (
--batch) ran them one row at a time. This adds four opt-in switches that do the same arithmetic in fewer launches or with less serial work. Each gives exactly the bits of the path it replaces; all are off by default, and each is a branch in front of the existing code that tests its flag first.STRATA_BATCH_QSA_ATTN=1STRATA_QSA_TOPK_SCAN=1STRATA_QSA_SCORES_TRANSPOSED=1STRATA_ATTN_MERGE_ACTIVE=1Result on 0.2.0-beta, two B70s, all four on, outputs bitwise identical in every arm: two streams in one window +1.9% aggregate (54.7 / 61.4 -> 55.7 / 62.6 tok/s), one stream +0.3%. A small engine gain at these contexts; the kernels themselves are 1.3-2.6x faster (table under Validation), and the gain grows with context.
Related discussion
Feature issue #2805 (closed in the 0.2.0 tracker reset). No maintainer agreement on scope yet. If four switches are too many for the gain,
STRATA_BATCH_QSA_ATTNalone carries most of the two-stream effect and I can split it out.Approach
sycl/src/core/verify.cpp:STRATA_BATCH_QSA_ATTN; inrecord_window's QSA branch, a branch before the per-row batch loop runs the scores per slot, oneqsa_block_topkand oneqsa_decode_attn_multifor the window.sycl/include/strata/qsa_decode_attn_multi.hpp(new) andsycl/src/kernels/cuda/qsa_decode_attn.dp.cpp:qsa_decode_attn_multi(qsa_decode_attn_batchover up to four pool sets per launch; mixed KV formats orSTRATA_ATTN_LANECELL=1fall back per set),attn_merge_active_kernel.sycl/src/kernels/cuda/qsa_select.dp.cpp:block_topk_wide_kernel<bool SCAN = false>(only the new launch instantiates the scan; the existing launch compiles the same code),block_scores_multi_t_kernel<NQ>.sycl/src/kernels/qsa_verify_batch_parity.cpp(new), two ctest entries: without switches it checks the batch form against per-row calls (2x1, 2x2, 4x2, 6x1, 1x4 windows at 1K / 16K / 64K), selections againstqsa_block_topk_ref, attention againstqsa_decode_attn_step, 1-8-query scores against one call per query, the MTP drafter call, and writes a hash of each of 45 outputs; the second entry repeats with the three kernel switches and requires the same hashes. No tolerance anywhere.docs/INTEL.md: a short section.Left alone: the default path, the prompt path,
qsa_decode_attn_step(decode without MTP), K/V and indexer appends, streamed-K/V batch windows, CUDA and HIP.Validation
Setup: 0.2.0-beta
maine88ee39dagainst 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:
qsa_verify_batch_parity --selftest --write-ref(0.2.0-beta + this branch, head1c501b02, one B70), then withSTRATA_QSA_TOPK_SCAN=1 STRATA_QSA_SCORES_TRANSPOSED=1 STRATA_ATTN_MERGE_ACTIVE=1 --selftest --ref: bothqsa_verify_batch_parity: PASS (0 failures), the second against the first run's hashes.e88ee39d"parallel": 2,--batch-groups 1,--max-context 16384 --vram-reserve-mib 512; a layer split runs no MTP drafts in the slots), aggregate tok/s, 2 runs: unset 54.68 / 61.44, switches 55.73 / 62.55 (+1.9% / +1.8%); per-stream output SHAs identical between the arms. The engine log showsSTRATA_BATCH_QSA_ATTN=1andbatch windows of up to 2 sequenceson both stages.Failed: none observed.
Not run: the kernel bench on 0.2.0 (unchanged code; on 0.1.x, us at 1K / 16K / 64K: batch 2x1 selection + attention 102.8 / 184.0 / 252.6 -> 62.3 / 107.9 / 156.2, 2x2 183.6 / 365.0 / 498.2 -> 78.3 / 138.2 / 205.0, top-k scan 16K / 64K 36.3 / 57.9 -> 19.5 / 42.1, transposed scores 5.5 / 18.7 / 63.1 -> 4.6 / 14.1 / 43.2, MTP merge 86.9 / 223.7 / 460.9 -> 41.0 / 157.2 / 335.9);
STRATA_QSA_TOPK_SCANin the engine (the wide top-k is only used above ~135K cells, and--max-context 200000does not fit every expert on a plain two-card layer split),--batch-mtpwindows of 2 rows per slot (refused on a layer split), CUDA/HIP (not touched).Limits
docs/INTEL.mdsection quotes the 0.1.x measurement (main296b59d2); I can swap in the 0.2.0 numbers.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.