mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4876] [Engine] STRATA_GDN_TC=2: the tensor-core GDN recurrence on Turing (sm_75), 2.2x faster #5225
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#5225
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/4876
Author: @xrip
Created: 11/1/2026
Status: 🔄 Open
Base:
main← Head:pr/gdn-tc-sm75📝 Commits (1)
5f53320prefill: STRATA_GDN_TC=2 runs the tensor-core GDN scan on sm_75 (Turing)📊 Changes
4 files changed (+71 additions, -27 deletions)
View changed files
📝
docs/DETAILS.md(+1 -0)📝
docs/GDN_CONTRACT.md(+2 -1)📝
src/prefill/gdn_tc.cuh(+43 -16)📝
src/prefill/kernels.cu(+25 -10)📄 Description
Problem and result
On Turing cards (sm_75), the prompt's DeltaNet (GDN) recurrence always runs on the old CUDA-core kernel,
gdn_rec_cols_pipe_kernel. The tensor-core scan behindSTRATA_GDN_TC=1needs sm_80 (mma m16n8k16,cp.async) and 98-125 KB of shared memory per block. Turing has only 64 KB.With this PR,
STRATA_GDN_TC=2runs the same scan on sm_75. On a CMP 50HX (sm_75, 56 SMs), the time for one layer's recurrence:pipe)STRATA_GDN_TC=2That is 1.9x faster at 300 tokens and about 2.2x faster from 1,024 tokens up. The default path does not change:
=1(the 0.2.9 server default on Linux CUDA) still leaves sm_75 on the old kernels, and sm_80+ cards run the same code as before.Related discussion
None. This takes the existing opt-in
STRATA_GDN_TCto sm_75 and does not change the default path (see Validation), so I opened the PR directly. If you want to agree on the scope in an issue first, I can do that.Approach
Three things in the scan need sm_80. Each one has a Turing form:
mma.sync m16n8k16becomes twom16n8k8steps on the same registers: k 0-7 witha0, a1, b0, then k 8-15 witha2, a3, b1.ldmatrixalready exists on sm_75.cp.asyncbecomes the plain-copy fallback thatgdn_cp_*already has below sm_80.redux.syncbecomes the existing shuffle max.ONE(gdn_tc_scan_kernel<false, true, 3, 1, true>), keeps every buffer single. That is 62,480 B, inside the 64 KB opt-in. With no second buffer, the next chunk is loaded after this chunk's state update, so the load does not overlap the products.gdn_rec_tctakesONEon cc 7.5 only when the dispatch asks for it (STRATA_GDN_TC=2). With=1it returns "not supported" there, as before. The split variants are not supported on sm_75. The prep kernel does not change. The output has the same rounding as=1(f16x3 split products), so it is not bit-identical to the old kernel.Validation
Revision
5f533205, onc62d5e3a(0.2.9).Passed:
nvidia/cuda13.3 devel, Ubuntu 24.04), Release:CMAKE_CUDA_ARCHITECTURES=75(targetsstrataandgdn_harness) and=120(targetgdn_harness, which links the prefill and kernel libraries). No errors.gdn_harness's FP64 reference: CMP 50HX, driver 610.43.03, Ubuntu 24.04,CUDA_VISIBLE_DEVICES=2.gdn_harness --T 8192 --chunk 8192 --paths pipe,tc --ref-heads 0,17,47:pipePASS-bitwise,tcPASS (output error to the referenceref_y2.27e-4,pipe2.28e-4; stateref_state5.8e-7,pipe1.4e-7). 0 failed verdicts.gdn_harness --T 3000 --chunk 1500 --stress --paths pipe,tc --ref-heads 0,17,47: all 10 cases PASS, 0 failed verdicts.STRATA_GDN_TC=1 gdn_harness --T 5000 --chunk 2500 --cuts 37 --paths auto,pipe --ref-heads 0,17,47:autorunspipeand gives the same hash aspipe(h=5218a839), PASS-bitwise. So sm_75 with=1is unchanged.STRATA_GDN_TC=2:autorunstcfor the long calls andpipefor the 37-token call. PASS.STRATA_GDN_TC=1 gdn_harness --T 3000 --chunk 1500 --any-sms --ref-heads 0,17,47. Upstreamc62d5e3aand this PR give the same verdicts and the same hashes on every path:auto/tcsd031486f,keyhead/pipe8dc3ae4f,chunked475fd185.#if !defined(__HIPCC__), andgdn_tc.cuhis included only from inside that block.g++ -x c++ -E -P -undef -D__HIPCC__ofsrc/prefill/kernels.cu(with the#includelines removed) gives the same output before and after this PR (2,034 lines, md5 d4471402). Without-D__HIPCC__, the outputs differ, as they should.gdn_harness --T N --chunk N --paths pipe|tc --bench --no-ref --reps 15 --warmup 30, withpipeandtctaking turns. Each cell gives the median of the 15 repeats, for each of the two rounds.=1on cc 7.5; samegdn_tc.cuh). Over 1,300 requests in about 13 hours, the log shows no errors. Prompt reads of 4K-46K new tokens after a cached 10K-token start took 6.0 % +- 5.6 % less time than on 0.2.8 (6 reads against 28). This compares two releases, so it is not a measurement of this change alone. The recurrence is about 7 % of a prompt read on this box (STRATA_PREFILL_TIMING=1on 0.2.0: 201-205 ms of a 2.9-3.0 s GPU timeline per 8,192-token chunk), so I expect prompt reads to be about 3-4 % faster.Failed: none observed.
Not run:
sycl/src/prefill/kernels.dp.cpp), and Metal does not build this file.=2on Turing. The rounding was checked only against the harness reference.=0against=2, same build): the box is in daily use.Limits
=1, it needs 48+ SMs (one block per value head). Smaller Turing cards keep the old kernels.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.