mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #883] [CLOSED] sm_60: PTX vmad for the __dp4a fallback (bit-exact, ~2.2x in isolation) #2893
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#2893
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/883
Author: @willowmerestudios
Created: 10/5/2026
Status: ❌ Closed
Base:
main← Head:sm60-vmad-dp4a📝 Commits (10+)
749d957setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446)5a30024calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447)9f60d13serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448)eb8da1d/metrics: each request's speculative draft counts, and their sums in the totals (#457)6a09387setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)d6a91e2docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)d8d4ad3Merge branch 'f-135-eng' into rel-0.1.357b600d5Merge branch 'f-135-small' into rel-0.1.35d9ab843Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it57bd713sycl: pipeline the expert cache's profile fill (model load 3-4x faster)📊 Changes
1 file changed (+95 additions, -0 deletions)
View changed files
➕
tools/sm60_dp4a_check.cu(+95 -0)📄 Description
sm_60: PTX
vmadfor the__dp4afallback (bit-exact, ~2.2-2.3x in isolation)What
On compute capability 6.0 (Tesla P100 / GP100) there is no
__dp4a, soSTRATA_DP4Afalls back tostrata_dp4a()ininclude/strata/kernels/dp4a.hpp. Today that is the byte-wise C form: four sign-extendedbyte extractions and four multiplies. This PR replaces the body with four PTX
vmad.s32.s32.s32instructionsusing byte selectors (
%1.b0…%1.b3), which do the signed-byte multiply-accumulate directly:cuobjdump -sassshows four
VMAD.S8.S8per call and no byte extraction.Scope
Only the
__CUDA_ARCH__ < 610branch changes. sm_61+ still uses hardware__dp4a; HIP builds never takethis branch (
__CUDA_ARCH__undefined). No call sites change.Proof of bit-exactness
New
tools/sm60_dp4a_check.cuincludes the committed header and comparesSTRATA_DP4Aagainst the byte-wisereference over 1,073,741,824
(a, b, c)triples (exit 1 on any mismatch or CUDA error):aandb;abyte,bbyte) combination, 4 × 256 × 256, with random other lanes;No CMake target; build by hand:
Output on a Tesla P100-PCIE-16GB (CUDA 12.4), 3 runs:
STRATA_DP4A(Sanity check of the checker: with the reference deliberately off by one it reports 1,073,741,824 mismatches, exit 1.)
End-to-end
Measured on v0.1.38 (
99f3dbd), not re-run on this branch's base (v0.1.39); the commit applies to both unchanged.Same tree built twice, with and without this change. 3 interleaved arms each on one P100,
Qwen3.8-Flash-Next Coder IQ1_M, temperature 0, 512-token decode ×3 + 8K-token prefill ×3 per arm.
Honest read: on this model the end-to-end difference (+2% decode, prefill flat) is inside run-to-run noise, so
the gain here is kernel-level, not a headline tok/s number. The useful end-to-end result is correctness: for each
of the 6 temperature-0 requests per arm (two prompts × 3 runs), the sha256 of the output text (compared on the first
12 hex digits) is the same in all six arms, stock and vmad. Workloads that
spend a larger share of time in
STRATA_DP4Awould see more of it (not measured here).Build check
Full engine build at this branch with
-DCMAKE_CUDA_ARCHITECTURES=60 -DSTRATA_EXPERIMENTAL_SM60=ON -DSTRATA_ENABLE_CUDA=ON, nvcc 12.4: exit 0, no errors.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.