mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3941] [Engine] sycl: QSA block scores on XMX (joint_matrix) - 128K prefill -10.5% TTFT on a B70 #4841
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#4841
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/3941
Author: @kennyko2002
Created: 10/24/2026
Status: 🔄 Open
Base:
main← Head:pr-qsa-xmx📝 Commits (2)
f0f3985sycl: QSA block scores on XMX (joint_matrix) for Battlemage - 128K prefill -11.7% TTFTc2493b4sycl: STRATA_VERIFY_TRACE=1 dumps the device breadcrumbs at the end of a run📊 Changes
3 files changed (+201 additions, -1 deletions)
View changed files
📝
sycl/CMakeLists.txt(+5 -0)📝
sycl/src/kernels/cuda/qsa_select.dp.cpp(+191 -1)📝
sycl/src/program/generate.cpp(+5 -0)📄 Description
Ports the SYCL branch of
qsa_block_scores_tc()tojoint_matrix, and registers theqsa_select_benchthat upstream wrote but never added to the build.qsa_block_scores_tc()returnedfalseon SYCL ("SYCL: the tensor-core kernel is not ported yet; the caller takes the older kernel"), so the prompt's QSA selection ran the warp kernel: one warp per (query, block), four 128-wide dots with five shuffles each. It was 6.40 ms per 256 queries x 32,769 blocks (1.34 TFLOPS) and 23.0 s of the 95.0 s 128K prefill on an Arc Pro B70.block_scores_xmx()implements the CUDA kernel's tiling (16 queries x 16 blocks per C tile, K = 128, the four indexer heads relu'd and summed in head order) with the same B-operand packing idiom asiq_kernels'xmx_gemm_iq. Both operands are split into an FP16 hi and lo part and multiplied three ways (lo*hi,hi*lo,hi*hi- the CUDA TF32 kernel's order), which keeps FP32-level scores. The tail blockn_bid(thedeadkey, +1e9) still comes fromblock_scores_tail_kernel, as on CUDA.Measured (Arc Pro B70 / bmg-g31, Qwen3.8-Flash-Next IQ3_XXS,
--prefill 32768, 128,000-token prompt, greedy 256 tokens):STRATA_SELECT_XMX=0)8183c6b6+ #3934)011c9e60earlierqsa selectphaseqsa_select_bench(256 queries x 32,769 blocks, 131k context): 6.40 ms -> 4.63 ms (1.4x), score max error 1e-7 of the scale against FP64 (the warp kernel's own is 1.2e-7), 256/256 selections identical to the warp kernel.Not bitwise, as the CUDA TC path is not: the summation order differs, so an exact tie can select differently - at 8k the greedy continuation leaves the warp kernel's at token 27, at 128k at token 231 (deterministic; two runs are byte-identical).
STRATA_SELECT_XMX=0(new) orSTRATA_QSA_WARP=1(existing) keeps the warp kernel.This needs #3934 to build on current
main: without itsrc/kernels/cpu/iq_avx512.cppfails with_pdep_u64 requires target feature 'bmi2'. The numbers above were measured with #3934 cherry-picked on top; that fix is not part of this PR.Two smaller notes:
grf_size<256>) is faster in the worst-case benchmark (3.97 vs 4.63 ms) but slower in the engine (14.1 vs 11.3 s - half the work-groups, and the engine'sreachis causal, so the grid matters more), soXNTstays 1 with the measurement in the comment.Open: the teacher-forced KL gate has not been run.
STRATA_FOLLOWis only read on the serve request path, and the serve path cannot be fed raw token ids, so upstream's--tokens-filerecipe does not run on SYCL yet. The expectation is the 1e-5 nats range (score error 1e-7 of the scale, selections bit-identical at 131k).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.