mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4301] [Engine] strata-dsv41: build with -Xptxas -dlcm=ca in the experimental sm_60/sm_70 build (Pascal decode 1.66 -> 3.50 tok/s) #4991
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#4991
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/4301
Author: @orlyandico
Created: 10/27/2026
Status: 🔄 Open
Base:
main← Head:sm61-dsv41-dlcm📝 Commits (1)
81ff0c5DeepSeek engine: build with -Xptxas -dlcm=ca in the experimental sm_60 / sm_70 build, as Maya's Pascal build: the Q5_K dense GEMV's plain loads were L2-only on a P40 (attention 278 -> 34 ms a token, same output; #4174)📊 Changes
1 file changed (+6 additions, -0 deletions)
View changed files
📝
CMakeLists.txt(+6 -0)📄 Description
Problem and result
On Pascal, plain global loads are cached in L2 only. In
strata-dsv41the Q5_K dense GEMV (iq::mv_kernel<13, 1>, the attention and routing stages' weights) reads its 5.3 GB throughJobsstruct pointers, withoutconst __restrict__, so it getsLDG.Erather thanLDG.E.CI. nvprof put it at 44.9% of GPU time on a P40, at about 14 GB/s (about 4% of the card's 347 GB/s). Building with-Xptxas -dlcm=ca, as Maya's Pascal build does, caches those loads in L1. On 2× P40 the GPU's share of a decode token falls from 585 to 283 ms (attention 278 → 27 ms) and decode goes from 1.66 to 3.50 tok/s, with the same output.Related discussion
Fixes #4174. Depends on #4173 (PR #4300) for an sm_61 build to exist at all.
Approach
-Xptxas=-dlcm=caonstrata-dsv41andstrata_dsv41_kernels, only whenSTRATA_ENABLE_CUDA AND STRATA_EXPERIMENTAL_SM60. The ready-made engines are not SM60 builds, so they compile exactly as before. In an SM60 build that also targets sm_70, the flag reaches the Volta pass too, where global loads are already cached in L1 by default. Other targets (the Qwen engine) are unchanged: their kernels already take the read-only path (#1469), and a Qwen engine built with the flag gave the same decode here (40.4 against 40.5 tok/s).A flag rather than kernel edits: it covers every kernel in the engine at once. Giving
mv_kernelconst __restrict__pointers would be the narrower fix, but the flag needs no change to vendored code.Validation
Environment: x9srl, 2× Tesla P40 24 GB (sm_61), Xeon E5-2651 v2 (AVX, no AVX2), 128 GB, Ubuntu 24.04, CUDA 12.3, g++-12. Model: ISTA-DASLab DeepSeek-V4.1-Flash-1017-GSQ-RCO IQ2_XXS (pack
deepseek-v4.1-flash-ist-das-2.00bpw).An sm_61 build needs #4173's fix, so both builds below include it: "before" is the #4173 branch (
b007a36d); "after" is this branch (81ff0c57) with that commit applied on top, not committed here.Passed:
Build with the command from #4173's PR (no
CMAKE_CUDA_FLAGS) →strata-dsv41 0.1.51 build 81ff0c57c;-Xptxas=-dlcm=caappears inCMakeFiles/strata-dsv41.dir/flags.make.Decode on both P40s, 96 greedy tokens after a 20-token coding question, page cache warm in both runs:
The CPU lane (SSD reads for experts not in RAM, then AVX-only arithmetic) is now nearly all of the token. Its wait rises because the GPU no longer hides it.
Output: the "after" run's 96 token ids are identical to a "before" run's (cold cache, 1.17 tok/s). Two "before" runs differ from each other from token 59: the ids follow where the expert cache places experts, not this flag.
Multi-arch SM60 compile (
-DCMAKE_CUDA_ARCHITECTURES="61;70;86", with #4300 applied) of the engine'sds4_gguf.cu.oand
ds4_iq.cu.o: no errors.-Xptxas=-dlcm=cais instrata-dsv41'sflags.makeand ptxas accepts it for all threearches.
Failed: none observed.
Not run:
$<COMPILE_LANGUAGE:CUDA>, so only nvcc sees it.Limits
Measured on one machine and one model. The gain is in the GPU stages. How much of it reaches tok/s depends on how much of the token the CPU lane takes: on this box with 128 GB of RAM it is the remaining limit.
🤖 Generated with Claude Code
https://claude.ai/code/session_01X1cLqPe2PZ4sDqfHSEgfLr
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.