mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2019] [CLOSED] prefill: q's split, norm and rope as one kernel (opt-in STRATA_QPREP=1, the same bits) #3811
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#3811
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/2019
Author: @libratechw
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:pr/prefill-fusions📝 Commits (1)
d61666eprefill: q's split, norm and rope as one kernel (opt-in STRATA_QPREP=1, the same bits)📊 Changes
5 files changed (+144 additions, -3 deletions)
View changed files
📝
CMakeLists.txt(+4 -0)📝
include/strata/prefill/kernels.hpp(+4 -0)📝
src/prefill/kernels.cu(+62 -0)📝
src/prefill/prefill.cpp(+9 -3)➕
tests/hip/prefill_q_prep.cpp(+65 -0)📄 Description
Title
Issue: none
Summary
On the full-attention layers' prompt path,
split_q,rms_rowsover the 24 q heads androperun as one kernel(
q_prep), one block per (token, head) row, with the same bits as the three kernels. The gain is small (+0.6% on a 32Kprompt), so it is opt-in. Say if you would rather not carry it. (This PR first also carried the gated attention epilogue;
that is now its own PR, #2588.)
What changed
src/prefill/kernels.cu,include/strata/prefill/kernels.hpp:q_prep. It keepsrms_rows_kernel's andrope_kernel'sloop shapes and expressions (a register version with a constant 256 differed in ~5% of the rows by one ulp; the cause was
not isolated).
src/prefill/prefill.cpp:STRATA_QPREP=1calls it in place of the three kernels; without it they run as before.tests/hip/prefill_q_prep.cpp,CMakeLists.txt:hip_prefill_q_prepcomparesq_prepwith the three kernels bitwisefor 1, 5, 64, 1,000 and 4,089 tokens from positions 0 / 4,089 / 100,000, with the default RoPE scaling: 0 values differ
on gfx1151.
Ryzen AI Max+ 395 (gfx1151, ROCm 7.14.1, Linux), on
296b59d2, the branch's binary without and withSTRATA_QPREP=1,UD-Q4_K_XL,
--serve --prefill 16384 --spec 4, the section-5 switches ofdocs/STRIX_HALO.mdwithSTRATA_PF_SWITCH_MIN_T=2048andSTRATA_PF_FUSED_KQ=1, a 32K chat request, fresh servers alternating, 7 pairs (of 8, one dropped for page migration or reclaim during a prompt): 1,249 -> 1,257 tok/s(median), the median of the pair ratios +0.6%, 6 of 7 pairs faster.
The records and scripts are in libratechw/Strata@686de2e9,
2019q/.A wider check outside ctest (a local copy of the test, in the records): 72 combinations of none / linear / YaRN scaling,
the angle table on / off, MRoPE on / off, 1 / 65 / 513 tokens and start positions 0 / 8,190 (across the table's end at
8,192) give the same bits.
Builds and tests on this branch:
hip_prefill_q_prepamong them), 5 skip, and the same three fail as on296b59d2(
ple_parity,expert_parity,pool_test).strata_kernels,strata_prefillandstrata_mmqcompile for gfx1012, gfx1030, gfx1100, gfx1103, gfx1150, gfx1151,gfx1200 and gfx1201.
ple_parityfails as on296b59d2.kernelsandprefill.cpp).Not run:
STRATA_QPREP=1on CUDA (the bitwise test is HIP's), other GPUs, UD-IQ4_XS.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.