mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3073] [Engine] STRATA_SELECT_SIMT=2 takes the simt2 scorer on HIP too (it silently fell back to the warp kernel); 119K prompt -6.5% on gfx1030 #4435
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#4435
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/3073
Author: @Vop3p
Created: 10/18/2026
Status: 🔄 Open
Base:
main← Head:hip-simt2📝 Commits (1)
5dcc80chip: STRATA_SELECT_SIMT=2 takes block_scores_simt2_kernel on HIP too (it was CUDA-only; =2 fell back to the warp kernel)📊 Changes
1 file changed (+18 additions, -5 deletions)
View changed files
📝
src/kernels/cuda/qsa_select.cu(+18 -5)📄 Description
Problem and result
qsa_block_scores_tc's HIP branch read onlySTRATA_SELECT_SIMT=1, so=2(#2071'sblock_scores_simt2_kernel, 32 x 128 tiles with the next K chunk in registers) silently kept the warp scorer on AMD cards while CUDA ran it. With this change=2launchesblock_scores_simt2_kernel<32, 128>(and the tail kernel) on HIP as the CUDA branch does; the confirmation line names it.Result on 2x RX 6900 XT (below): prompt time -1.35% at 31K and -6.53% at 119K tokens, 10 of 10 interleaved cold-start pairs each; the selection scorer's share grows with the context. Without the variable the default path is byte-identical; with it, two runs are bit-identical to each other on this card.
Related discussion
Closed in the 0.2.0-beta tracker reset; this is the same change rebased on main and re-measured on 0.2.0-beta as asked. petski3 reported run-to-run differences with
STRATA_SELECT_SIMT=1on gfx906 in the earlier thread; item 3 below is the gfx1030 data point for that.Approach
One file (
src/kernels/cuda/qsa_select.cu, +18/-5): the HIP branch parses0/1/2like the CUDA branch;=2takes the simt2 kernel with the same grid guard (grid.y > 65535returns false, the caller keeps its path);=1and unset are unchanged. Opt-in; CUDA unchanged.Validation
Environment: 2x RX 6900 XT (gfx1030, 16 GB, PCIe 4.0 x8 each), Ryzen 5 5600X, 128 GB DDR4-3200, Ubuntu 26.04 (kernel 7.0.0), ROCm 10.0.0. Revision: main
e88ee39d(v0.2.0-beta + 12 commits) and this branch on it; the branch merges cleanly with today's main9ae93f7b(the 0.2.1 candidate), which was not re-measured. Built with setup.py's HIP options (-DSTRATA_PREFILL_MMQ=ON -DSTRATA_Q6K_EXPERTS=ON -DSTRATA_MMQ_KQUANTS=ON, gfx1030, the pinned ggml, Release). Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_S, layer split over both cards, int8 KV.Passed:
ctest(STRATA_BUILD_TESTS=ON): 137 tests, 131 passed, includingqsa_select_bench,qsa_select_bench_fp32_tiledandhip_native_qsa_score. The 6 failures are the same 6 on main built the same way:ple_parity(needs a Q2_0 GGUF this machine does not have),hip_prefill_mmq_parity(SEGFAULT on main too),native_hadamard_test,tq_cpu_parity,tq_cpu_parity_avx2("this ggml has no trellis types"),isa_guard_check(tq_rows_avx512not listed).Default path byte-identical: deterministic config (
parallel1, no pipeline windows,--short-read 640 --adapt-every 100000,STRATA_PREFILL_CPU_SHARE=0,STRATA_LOGPOStop-256 log-probabilities), 8 chats of real text (first message 6K-105K tokens through the prompt path, ~580 continuation tokens scored), 4,067 positions: main and this branch without the variablecmpidentical.Determinism with
=2, same harness: two runscmpidentical (4,067 positions). So on gfx1030 the simt2 scorer itself does not make runs differ; in the serving configuration (CPU share, adaptive expert cache) outputs differ between starts with or without it.Quality, same harness: mean KL over the 8 chats to a local FP64-attention reference build (scores, softmax and sums of the QSA attention in double; not part of this PR): main 0.0334 (argmax agreement 94.81%),
=20.0220 (95.75%); KL(main ||=2) 0.0256. Not worse - the scorer only changes the summation order of the block scores.Speed: production-like config (
parallel2,--pipeline-windows 2 --batch-mtp,--kv-resident 32768,STRATA_PREFILL_CPU_SHARE=auto,STRATA_HC_PERSIST=1,STRATA_HIP_PROMPT_F16=1,STRATA_SH_STREAM=1,STRATA_PREFILL_STREAM_MIN=2048, a rocBLAS table viaSTRATA_ROCBLAS_TUNING), the same binary without and withSTRATA_SELECT_SIMT=2, 20 cold starts alternating A B A B, each reading two real-text prompts with max_tokens 1,prompt_msfrom /metrics, 0 tokens reused:=2(median, range)The
=2arms all printedqsa select: FP32 tiled scorer (STRATA_SELECT_SIMT=2), tiles simt2 32x128 (#2071), the others no tiled-scorer line; 0 stalls.CUDA compile only (no NVIDIA GPU here): CUDA 13.2.2 (nvcc 13.2.86), GCC 15.2,
-DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=ON -DCMAKE_CUDA_ARCHITECTURES=86: the engine and the tests build (the file's CUDA branch is unchanged).Failed: none observed.
Not run: gfx906 (petski3's card), gfx11 / gfx12 (
=2there still yields to the gfx12 WMMA scorer when that is on), other gfx103x cards, Windows; CUDA execution; SYCL and Metal (they do not compile this file).Community measurements (not mine)
=2run vs repeat run 6 of 6 identical texts and draft counts (=1and unset likewise);=2equals=1bit for bit; prompt 64K +2.5%, 128K +4.5% against unset, same as=1; decode within noise; 0 stalls. So=2reachesblock_scores_simt2_kernelon gfx906 and is deterministic there too.Limits
=2on HIP changes.Developed with an AI coding assistant; every number above was measured on the machine described here.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.