mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2682] [Engine] fail the test build when a release-engine CUDA kernel spills or uses local memory #1067
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#1067
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?
Originally created by @Avicennasis on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2682
Area
[Engine] (speed, kernels, models, the server and API)
What do you want to do?
Re-filing #1758, which the 2026-10-13 sweep closed as older than three days. The ask is unchanged; the difference is that the PR is filed right behind this issue and names it (
Resolves #…), so both exist inside the three-day window.A build-time check that fails
STRATA_BUILD_TESTSwhen a CUDA kernel in the release engine spills registers to local memory or keeps a per-thread array there, per architecture inCMAKE_CUDA_ARCHITECTURES.Why. Strata carries per-architecture kernel tables and has found two defects that were compiler-output facts rather than source facts: #1522 (
gdn_l2_kernelcompiles without the fma the fused kernel spells out on CUDA 13.3 / sm_120) and #1469 (Pascal decode regression). A register spill is the same kind of fact: it shows up in the compiler's resource report and nowhere in the source, it varies by toolkit andsm_, and it costs decode throughput silently. Nothing in the tree reads that report today.Shape (what the PR does).
tools/check_cuda_spills.pyreads the built kernel libraries withcuobjdump --dump-resource-usageand fails when a kernel's STACK or LOCAL bytes exceed what an exceptions table in the script allows for that (kernel,sm_) pair; the message names the kernel, thesm_and the two numbers. It is registered as the CTestcuda_spill_guardunderSTRATA_ENABLE_CUDA AND STRATA_BUILD_TESTS(not under HIP, where there is nocuobjdump), skips with 77 wherecuobjdumpor Python is missing, and mirrorstools/check_isa_guard.pyin shape. No build-flag change: it reads the objects that were built anyway, and it needs no GPU at test time. The vendored llama.cpp ggml kernels (mul_mat_q,quantize_*) are skipped — they are the only kernels with no namespace, and they are llama.cpp's to gate. This is how DeepGEMM gates its kernels (DG_JIT_CHECK_NO_SPILLS/DG_JIT_CHECK_NO_LOCAL_MEMORY).Measured on
296b59d2with CUDA 13.1 (nvcc V13.1.80), Release,sm_86andsm_120: 1351 Strata kernels (359 once template instantiations are collapsed) across the eight kernel libraries; 150 (kernel,sm_) entries carry a stack frame — 61 are register spills in 21 distinct kernels (the largestblock_topk_reg_kernel, 196 B of spill stores / 284 B of loads on sm_120 at the 64-register cap of its launch bounds; thennative_mmvq_il_kernel60/60 B andnative_gu_multi_kernel56/64 B) and 89 are spill-free per-thread arrays (attn_chunk_kernel's 384-byte score tile the largest). LOCAL is 0 everywhere: on CUDA 13.1 both arrays and spills land in STACK. The exceptions table carries exactly those numbers — 37 entries, 53 (kernel,sm_) allowances, one line each saying what the array is or what spilled — so the first run documents the current state rather than failing on it; a later change that adds a spill or grows a local array is a red test naming the kernel. The spills themselves are findings, not fixed in the PR.Not measured: sm_75 and sm_89 (the table is per-
sm_; entries for them come from the first build on such a box), HIP and Windows, any timing or GPU behaviour, and why ptxas settles on different register counts per arch (e.g.gr_down_q8_kernel<7>: 128 registers + spills on sm_86, 206 registers and clean on sm_120).If you would rather have the capture elsewhere (a CMake option, a CI step over the build log), say so on the PR and I will move it.
@Niko1221 commented on GitHub (Oct 19, 2026):
Thanks for taking the time to report this.
We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.
@Avicennasis commented on GitHub (Oct 20, 2026):
Re-tested on
cbfd5b92(main, v0.2.1 + 55) — not fixed; the tree still reads none of the compiler's resource report, and the state has moved since the first measurement.What I see. Building the eight CUDA kernel libraries for sm_86 + sm_120 (CUDA 13.1, nvcc/cuobjdump V13.1.80, cmake 3.28.3 + ninja 1.11.1, Release) and reading them with
cuobjdump --dump-resource-usage: 1804 Strata kernels (412 once template instantiations collapse), 3608 (kernel,sm_) entries, 270 with a stack frame — 136 register spills in 30 distinct kernels and 134 spill-free per-thread arrays. At296b59d2it was 150 framed entries, 61 spills in 21 kernels. 13 kernels with a frame are new since then (expdec_down_kernelis now the largest spill in the tree: 428 B of spill stores / 600 B of loads on sm_86 at the 64-register cap of__launch_bounds__(256, STRATA_EXPDEC_MINB = 4)), 3 moved (block_topk_reg_kernel,gr_down_staged_kernel,dequant_kernel's Q6_K vectorised instantiation), 1 lost its sm_120 frame (gdn_step_norm_multi_kernel). LOCAL is 0 everywhere on this toolkit; spills and local arrays both land in STACK.Strata version:
cbfd5b92(main, 55 commits past v0.2.1). Graphics card / memory: none used — this is a compiler-output measurement in an Ubuntu 24.04.3 CUDA 13.1 devel container with no GPU, so no throughput claim is made here. System: Ubuntu 24.04.3 container on a Linux host, 16 cores.The PR (#2683) is rebased on this revision with the allowance table re-measured and the gate green on it; its validation section carries the commands and the output.
@Avicennasis commented on GitHub (Oct 20, 2026):
/reopen
@github-actions[bot] commented on GitHub (Oct 20, 2026):
Not reopened yet. Still missing:
Edit the issue and comment
/reopenagain. Details: CONTRIBUTING.md@Avicennasis commented on GitHub (Oct 20, 2026):
/reopen
@github-actions[bot] commented on GitHub (Oct 20, 2026):
Reopened, thank you. A maintainer will pick it up from here.
@Niko1221 commented on GitHub (Oct 26, 2026):
This is the tracking issue for #2683, which implements it (cuda_spill_guard with an exceptions table). We will handle both together on that pull request; the allowance table will need re-measuring on the current tree and the CUDA toolkit we ship, and a CMake option or CI step is fine if you prefer. Please follow #2683.
@Niko1221 commented on GitHub (Oct 27, 2026):
Thank you. Fixed in 0.2.7: Cuda_spill_guard fails the CUDA test build when a Strata kernel spills or keeps a per-thread array in local memory (#2683, #2682). Your name is on the commit.
Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7
__dp4afalls back to a 4-iteration loop although gfx906 has v_dot4_i32_i8 #3006__dp4afalls back to a 4-iteration loop although gfx906 has v_dot4_i32_i8 #3012