mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #124] [CLOSED] Pascal (sm_60): bring the engine up on compute capability 6.0 #2471
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#2471
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/124
Author: @ruibeikaa
Created: 9/29/2026
Status: ❌ Closed
Base:
main← Head:pascal-sm60📝 Commits (1)
5bed6e7Pascal (sm_60): bring the engine up on compute capability 6.0📊 Changes
8 files changed (+98 additions, -33 deletions)
View changed files
📝
CMakeLists.txt(+7 -2)➕
include/strata/kernels/dp4a.hpp(+42 -0)📝
src/kernels/cuda/elementwise.cu(+2 -1)📝
src/kernels/cuda/fused_gr.cu(+14 -1)📝
src/kernels/cuda/iq_kernels.cu(+2 -1)📝
src/kernels/cuda/native_mmvq.cu(+22 -21)📝
src/kernels/cuda/s2_expert_grouped.cu(+6 -5)📝
src/kernels/cuda/verify_kernels.cu(+3 -2)📄 Description
What this does
Runs the engine on compute capability 6.0 (Pascal, GP100-class) cards. Two build gates stand in the way, plus
one attribute the card does not honour - and none of them needs the kernels rewritten:
CMakeLists.txtrefuses to configure below sm_75;__dp4a(6.1+) appears 29 times in the i-quant kernels (native_mmvq.cu,s2_expert_grouped.cu,iq_kernels.cu), and__nanosleep(7.0+) in the three doorbell waits (elementwise.cu,verify_kernels.cu);fused_gr_read_multi's slice fromcudaDevAttrMaxSharedMemoryPerBlockOptin, which onan sm_60 answers 65536 - while that card's launch validator enforces the 49152 B per-block limit. The
capacity comes out 6 tokens and every 6- or 8-token window fails the launch with
invalid argument.The changes
include/strata/kernels/dp4a.hpp(new) -STRATA_DP4Aandstrata_spin_pause(). The dp4a fallback isllama.cpp's own (
ggml/src/ggml-cuda/common.cuh): both operands read as SIGNED bytes, accumulated into int32,which is what
__dp4adoes for exactly these call sites - the kernels here are transcribed fromvecdotq.cuh/mmvq.cu, so the fallback is bit-exact, not approximate. The nanosleep sites only pacesingle-thread doorbell waits, so on sm_6x the loop simply spins.
CMakeLists.txt--DSTRATA_EXPERIMENTAL_SM60=ONrelaxes the architecture gate, and the refusal messagenames it.
fused_gr.cu- below sm_70 the slice capacity comes fromcudaDevAttrMaxSharedMemoryPerBlock(49152 B -> 4 tokens) instead of the opt-in, which is the limit the launch validator actually enforces.
What the HIP review asked for
fused_gr.cu's#if defined(__HIPCC__)tile (1280 against gfx1100's 64 KiB LDS) isupstream's, untouched. The 0.1.21 form of this patch carried a
kFusedGrTileconstant and a window clamp forthe same shared-memory problem; both are gone, so no tile value is overridden anywhere.
strata_spin_pause()is a no-op only under__CUDA_ARCH__ < 700; every othertarget - HIP included - calls
__nanosleep, so AMD keepship_compat's__builtin_amdgcn_s_sleep(1)and does not busy-spin.STRATA_DP4Aon HIP is likewisehip_compat's__dp4a(the gfx1100sudot4path), because__CUDA_ARCH__is undefined there.fused_gr_max_windowis gone, and what remains of the shared-memory work infused_gr.cuis HIP-guarded:the HIP branch keeps the exact expression it had (
optin > 0 ? optin : 48 * 1024).CMakeLists.txt.Rebased onto 0.1.27
0.1.21 -> 0.1.24 -> 0.1.27. Two things came out of the last rebase:
STRATA_EXPERIMENTAL_SM75is gone (Turing is supported now), so the gate reads_base LESS 75 AND NOT STRATA_EXPERIMENTAL_SM60and keeps the current wording.fused_gr_read_multinow slices an oversized batch itself. That is a better fix than the window clamp thispatch used to carry, so the clamp, its
fused_gr_max_windowhelper and the twogenerate.cppcall sites weredropped in favour of correcting the one number the slicing is computed from. The full window now runs here:
Behaviour on supported cards
A no-op, by construction: from sm_70 the opt-in is honoured, so the slice capacity is the value it already was
(and the clamp never applied there anyway);
STRATA_DP4Aandstrata_spin_pause()compile to__dp4aand__nanosleepexactly as before; a HIP build takes neither branch. Only the 6.0 path was exercised on hardware,so the sm_70+/HIP paths here are reasoned rather than measured.
Notes for a Pascal build
compute_60.CMAKE_CUDA_STANDARDhas to stay 17 for that combination: nvcc 12.9 refuses-std=c++20when the hostcompiler is VS2019's
cland silently falls back to C++14, which rejects the nestednamespace strata::kernels {declarations everywhere.CMAKE_CUDA_RUNTIME_LIBRARY=Sharedif the local CUDA keepscudart.libas a DLL import library (CUDA 13 madeit static); the default
-cudart staticthen collides with the project'sCUDA::cudart(LNK2005).cublas64_12.dllat runtime (the prefill GEMM). CUDA 12.9's cuBLAS does serve theBF16
cublasGemmExthose kernels ask for on sm_60 - verified by reading prompts on hardware, not assumed.qsa_select.cuandnative_qsa_score.cucompile theirmma/ldmatrixblocks only at__CUDA_ARCH__ >= 800(with the portable fp32-FMA fallback the Turing portadded) and
qsa_prompt_attn.cukeeps the older kernel. Nothing extra was needed for them.Measured (6.0 card, GP100-class, four dies through the layer split, IQ3_XXS)
883-token prompt, 256 generated tokens, the shipped
--spec 4and--expert-cache auto. Both rows weremeasured in the same session on the same machine with the same load, so the difference between them is the
engine:
The 0.1.21 row is this port's original base, whose fused GR read could not launch a 6-token window at all and
therefore ran with the MTP window at 2 and the verify window at 4. With the slicing corrected, the windows are
the shipped ones and decode is ~19% faster (warm prefill ~7% faster); cold prefill is unchanged. Earlier in
this PR I reported a decode drop between the 0.1.21 and 0.1.24 bases - that was measured with the clamp
still in place, and it no longer reproduces.
So this is about fitting, not speed: with every expert resident the wall is Pascal's per-layer arithmetic
(no
__dp4a, 140 W caps), not capacity and not memory. If the maintainer would rather not carry the extra#ifbranches for a configuration this slow, that is a fair call - the alternative is that these cards cannotrun the engine at all.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.