mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #892] Linux + RTX 50 (sm_120): an engine compiled with CUDA 13.2 answers garbage (IQ1_S/IQ2_S/IQ3_S miscompile); CUDA 13.0 works #389
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#389
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 @Thanh-Huy1104 on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/892
What happens
On Linux, setup finds no ready-made engine and compiles one with whatever toolkit is installed. With CUDA 13.2 on an RTX 5070 Ti, the engine loads and serves normally, but every answer is wrong:
4+4=8.8.Good morningprimary colors are primary colors are ...).There are no errors in the log. The benchmark script's warm-up fails with
no text received.Environment
6f32ec0(engine 0.1.39),./setup.sh --yes --family qwen --model IQ2_XS --no-start/usr/local/cuda-13.2/bin/nvcc(13.2.51)Isolation
--pcie-frac,--expert-cache 0, 4K or 64K context)3cf0325(Strata's pinned commit), CUDA 13.2, GPU offload, same GGUF-ngl 0 --device none(CPU only)test-backend-ops -b CUDA0, CUDA 13.2MUL_MAT44 FAIL,MUL_MAT_ID22 FAIL: onlyiq1_s,iq2_s,iq3_s(ERR 0.4-0.66); every other type OKnvidia-cuda-nvcc==13.0.88), nothing else changedThis matches the known nvcc 13.2 / sm_120 miscompile of the byte reads in the IQ1_S/IQ2_S/IQ3_S kernels (ggml-org/llama.cpp#21255, #28581; the fix PR ggml-org/llama.cpp#28784 was closed unmerged). Strata's own
src/kernels/cuda/iq_kernels.cuuses the same pattern (const uint8_t* qs = (const uint8_t*) &qs_packed;thenqs[l]intoiq2s_grid/iq3s_grid/iq1s_grid_gpu, e.g. lines 156, 215, 242, 658, 719, 753). I have not tested which of Strata's kernels and ggml's kernels are affected separately.A PTX-only build (
120-virtual) with 13.2 is not a workaround on driver 580:the provided PTX was compiled with an unsupported toolchain.Results with the CUDA 13.0 engine (for reference)
bench/results/2026-09-30-community-rtx-5090/benchmark.py, 3 runs, 256 output tokens, 0 reused:Suggestions
nvidia-cuda-nvcc==13.0.88(plusnvidia-cuda-cccl,nvidia-nvvm,nvidia-cuda-crt, and the runtime/cuBLAS wheels setup already pins). That works without sudo.uint8_t*byte indexing with__byte_perm/ shifts in the IQ*_S paths (what ggml-org/llama.cpp#28784 did).@arisogmbh commented on GitHub (Oct 6, 2026):
Independent confirmation on a second sm_120 card, same commit, same quant — and the kernel pattern your issue cites is present verbatim in this tree.
Our environment
compute_cap 12.0(sm_120), driver 595.71.05, Linux6f32ec0(2026-10-04), built with-DSTRATA_GGML_DIR=/home/ariso/Strata/third_party/llama.cpp -DCMAKE_CUDA_ARCHITECTURES=120Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S, IQ3_S native pack (tools/iq_pack.py, index v3, 1079 tensors)engine/strata.cuda132→cuda_13.2.r13.2/compiler.37434383_0engine/strata→cuda_13.0.r13.0/compiler.36260728_0So this is the same commit and the same quantisation family as your report, on a different card and a different driver branch.
The kernel pattern is here exactly as you describe it
src/kernels/cuda/iq_kernels.cu, theuint8_t*byte-indexing-into-a-packed-value pattern:Your cited line numbers (156, 215, 242, 658, 719, 753) match this checkout exactly, plus two more instances at 2072 and 2139.
What we saw before the rebuild
Symptoms identical to yours: answers wrong with no errors in the log, and — the part I'd underline for anyone debugging — the same prompt gave three different answers inside one server process. That nondeterminism is what made this look like a sampling or cache bug rather than a miscompile.
The decisive control was the same GGUF in plain llama.cpp: 21/21 correct on CPU (
-ngl 0 --device none), garbage on GPU with the 13.2 build. Model file proven intact by sha256 against the published HuggingFace LFS etags. That localises it to the CUDA kernels, exactly as yourtest-backend-opstable does.After rebuilding against CUDA 13.0
nvcc release 13.0, V13.0.48,Build cuda_13.0.r13.0/compiler.36260728_0, installed from the official runfile (cuda_13.0.0_580.65.06_linux.run --silent --toolkit --toolkitpath=/usr/local/cuda-13.0 --override); build 225/225 targets, zero ptxas errors.Four independent engine starts, 21/21 each round, byte-identical output every round. Under 13.2 the same battery scored 0/7–4/7 on most starts.
Engine-reported after the fix: prefill 2026–2034 tok/s at 16K/32K, decode median 93.8 tok/s, MTP draft acceptance 208–221 of 364–386.
The battery is seven probes at
temperature 0.0, checking the reply for an expected substring: capital of France → Paris, capital of Japan → Tokyo,12 plus 30→ 42,7 times 6→ 42, who wrote Hamlet → Shakespeare, "Say hello." → hello, colour of a clear daytime sky → blue. Seven probes × three rounds per start = 21.Two additions to your suggestions
1.
setup.shpicks the newest toolkit it finds. With both 13.0 and 13.2 installed,find_nvcc()selects 13.2 — so a user who has already installed a good toolkit is silently rebuilt against the bad one. Forcing it works:A warning naming the toolkit and the arch when nvcc is 13.2 and the card is sm_120 would prevent this class of report entirely.
2. The pip-wheel route in your suggestion 1 does not link, at least not as-is. We tried
nvidia-cuda-nvcc==13.0.88plus the companion wheels: CMake configures fine (identifiesNVIDIA 13.0.88, arch 120) but the build dies at 42/225 withThe split wheels do not provide a coherent CCCL device library. The runfile toolkit works and needs no sudo changes beyond the install itself. Worth correcting in the issue so nobody spends an hour on the wheel path.
3. Your suggestion 3 (a post-start self-check) is the single highest-value change here. We now run one line after every engine change — "capital of France" must contain "Paris". It costs one request and would have caught this immediately. Given the nondeterminism, it should run twice and compare: a single correct answer can still come from a broken build.
One thing we could not do, stated plainly
We could not re-run the 13.2 binary against a freshly packed model to produce a clean A/B on this card, because the pack is bound to the compiler that produced it — repacking with the 13.2 toolchain would bake the defect into the pack and make the comparison meaningless. A clean second-card reproduction needs the full ~84 GB model on another sm_120 machine. So our contribution is the configuration match plus the four-start determinism result, not a new controlled experiment.
@Niko1221 commented on GitHub (Oct 7, 2026):
Reproduced on our RTX 5070 (sm_120) with the same source built with nvcc 13.2.51 and 13.0.88. With 13.2 the IQ3_S MMVQ product (iq_multi_parity) and the IQ2_S / IQ3_S MMQ prompt path (prefill_fused_iq_test) are wrong (relative error 0.5 to 1.0); IQ2_XXS, IQ2_XS, IQ3_XXS and IQ4_NL stay bitwise equal, and 13.0 is right. In 0.1.40.2 setup takes an installed CUDA 13.0 / 13.1 over 13.2 for an sm_120 card (STRATA_NVCC still wins) and otherwise warns and says what to install. The ready-made engines are built with 13.0 and are not affected. We have not rewritten the byte-indexed reads, so a 13.2 source build stays at your own risk.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
@SimonShenhw commented on GitHub (Nov 6, 2026):
Still reproducible on engine 0.1.56 (Strata v0.2.10,
ffa80d7) with a CUDA 13.2 build for sm_120, but the broken type has moved: in our build IQ3_XXS answers garbage while IQ3_S is correct, the reverse of the split in your comment above.Setup
setup.sh, so its 13.2 guard never ran:-DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=OFF -DSTRATA_Q6K_EXPERTS=ON -DSTRATA_MMQ_KQUANTS=ON -DCMAKE_CUDA_ARCHITECTURES=120 -DSTRATA_GGML_DIR=third_party/llama.cpp, targetstrata.cuda_13.2.r13.2/compiler.37434383_0in bothstrataandlibstrata_kq.socuda_12.8.r12.8/compiler.35404655_0ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUFated59f92, IQ3_XXS and IQ3_S, sha256-checked, packed once withtools/iq_pack.py. Both builds loaded the same pack directories, so the compiler is the only difference.--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp <dir> --max-context 131072 --kv int8 --kv-resident 32768, one slot.Check: eight fixed requests, greedy (temperature 0, top_k 1): 47×86, 93×78, write and run a factorial function, the capital of Australia, a Chinese-to-English translation, and three steps replayed from a recorded coding-agent session (prompts of 1.7K, 30K and 60K tokens).
STRATA_PF_FUSED=0STRATA_PF_FUSED=0( 1as cor E( 6d -「 S 316 11 6 9中心.unsloth/Qwen3.8-Flash-Next-GGUFUD-Q4_K_XL (81.7%) and the GSQ-RCO Coder IQ1_M pack (78.1%) looked normal.Two suggestions
setup.sh: warn or stop when the CUDA compiler is 13.2 and the architectures include 120. Anyone who builds with CMake directly (we did, on a cluster whose newest CUDA module is 13.2) gets no warning today.Not tried: CUDA 13.0, 13.3 or 13.4 on this card, and your parity tests (
iq_multi_parity,prefill_fused_iq_test), so we can't say which kernel is wrong for IQ3_XXS. Related open report: #4879.Engine log of the 13.2 IQ3_XXS run, up to the version line (paths shortened)