mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #968] 0.1.39: UD-IQ4_XS prompts read as garbage on an RTX 5090 (sm_120) through the MMQ prompt path; STRATA_PREFILL_MMQ=0 or an sm_86 card reads them correctly #422
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#422
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 @signalnine on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/968
On an RTX 5090, any prompt longer than a few dozen tokens comes out garbled for the model when Strata reads it through the MMQ prompt path with Unsloth's UD-IQ4_XS. The model calls the input "corrupted or fragmented", misses a planted fact, and summarizes code as the wrong kind of program. Decoding is fine: 1,500-token answers to short prompts are coherent and correct.
STRATA_PREFILL_MMQ=0fixes it at the same prompt speed, and the same binary on an RTX 3090 (sm_86) reads the same prompts correctly with MMQ on.Setup
main6f32ec0by setup (BUILD.json: archs[86, 120], CUDA 13.2),STRATA_MMQ_KQUANTS=OFF(setup's default)--family unsloth --model UD-IQ4_XS --gguf-diron the three shards (SHA-256s match the table indocs/UNSLOTH_Q4.md), packed by setup with--compat-bf16--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp ... --max-context 32768 --kv int8, no imagesRepro
Any passage plus a question about it, temperature 0, thinking off:
5090, MMQ on (default), 344-token prompt:
5090 with
STRATA_PREFILL_MMQ=0, and the 3090 with MMQ on, same prompt:What I measured
The pack's experts are IQ3_S gate/up (IQ4_XS in one layer) with IQ4_NL down (Q8_0 in five layers). I only have this pack, so I can't say whether the native IQ packs hit it too. #402 ran UD-IQ4_XS on an sm_120 card at 0.1.31, but its needle check covered UD-Q4_K_XL only. #420 and #954 are other sm_120 problems in the MMQ prompt path.
Workaround:
"env": {"STRATA_PREFILL_MMQ": "0"}instrata-<model>.json, or the variable in the server's environment.@Niko1221 commented on GitHub (Oct 6, 2026):
Looks tied to the fused int8 prompt-experts / #583 ring in #954 on sm_120. STRATA_PREFILL_MMQ=0 is the right workaround for now. Needs a 5090 to reproduce; asking the reporter for the first bad layer with STRATA_DBG_NAN=1.
@signalnine commented on GitHub (Oct 6, 2026):
Ran it on today's
main(v0.1.40,82f46a8, built for sm_86 + sm_120): still broken on the 5090 and fine on the 3090.STRATA_DBG_NAN=1reports nothing: zero non-finite values anywhere, prompt-end residual/PLE/GDN all finite with normal magnitudes. So there's no NaN to point at; the numbers are finite and wrong.It's also not the fused / #583 ring path from #954. This pack is native IQ, so the fused kernels are off unless
STRATA_PF_FUSED=1(I never set it), and the 113-token prompt that breaks is belowSTRATA_PREFILL_STREAM_MIN(1024), so it never takes the streamed walk.To find the layer I added a local debug mask that picks which layers take MMQ, re-read per request so one engine can bisect, and dumped the final residuals with
STRATA_PREFILL_DUMP_R(--prompt-cache 0, the same 19,440-token prompt every time). Each row is MMQ on only those layers vs the FP16 path, relative error of the final residual (median over 304 positions):Every layer with IQ3_S gate/up is wrong on sm_120 by itself (layer 47 alone: 0.34 vs 0.001 on the 3090, and its MoE output feeds the final residual directly). The IQ4_XS gate/up layer matches the 3090, and so do the Q8_0 / IQ4_NL downs next to IQ3_S on the 3090. So it looks like the IQ3_S MMQ path on sm_120. The same binary is fine on sm_86, so it's arch-specific code, not the pack. No single layer breaks the answer; 12+ of them do (0-23 or 24-47 alone still read correctly at 358 tokens, all 48 never do).
Anything in the native IQ3_S packs (qwen IQ3_S, Coder?) with IQ3_S gate/up on a 50-series card would be the same path; I only have the Unsloth file to test.
@signalnine commented on GitHub (Oct 6, 2026):
Root cause: nvcc 13.2.0 / 13.2.1 miscompile ggml's IQ1_S / IQ2_S / IQ3_S kernels for sm_120. It's upstream, known (ggml-org/llama.cpp#28581), and fixed by NVIDIA in CUDA 13.2.2. The source workaround, ggml-org/llama.cpp#28784, was closed without merging, so Strata's pinned llama.cpp (3cf03257) still has the code the bad compilers break.
My engine was built by setup with the system toolkit, nvcc 13.2.51 (= CUDA 13.2.0). The kernels read single bytes out of a packed int via
(const uint8_t *) &qs_packed, and for sm_120 nvcc drops the byte mask, so the grid-table index runs out of range. It hits both the MMQ tile loaders and the vec_dot path, which is why short prompts mostly survive and longer ones don't.Checked on this box with the pinned llama.cpp's own
test-backend-ops, same nvcc 13.2.51:__byte_perm), MUL_MAT / MUL_MAT_ID /GGML_CUDA_FORCE_MMQ=1, all three typesThen end to end: v0.1.40 built with the same nvcc 13.2.51 against the patched ggml, MMQ on (no
STRATA_PREFILL_MMQ=0), on the 5090: the probes from the report read correctly, the 19,440-token needle is found, prompts read at 697 tok/s. Without the patch the same build garbles them.Ways to fix it on Strata's side, any one is enough:
__byte_permchanges inmmq-load-tiles.cuhandvecdotq.cuh) on the pinned llama.cpp setup downloads, or bump the pin once upstream takes a fixWorth a look while you're there: Strata's own
src/kernels/cuda/iq_kernels.cuuses the same(const uint8_t*) &qs_packedbyte reads in about a dozen places. Decode on the 5090 is coherent here, so nvcc apparently doesn't break them all, but running the IQ parity tests on an sm_120 card built with 13.2.0/13.2.1 would settle it.This also accounts for #954's "sm_120 only" flavour if that reporter's toolkit is 13.2.0/13.2.1, though I haven't checked their setup.
@signalnine commented on GitHub (Oct 6, 2026):
Confirmed the toolkit fix here: upgraded CUDA 13.2.0 -> 13.2.2 (nvcc 13.2.51 -> 13.2.86, driver unchanged at 580.119.02) and rebuilt from unmodified source, no #28784 patch.
test-backend-opson the 5090: MUL_MAT / MUL_MAT_ID for iq1_s, iq2_s, iq3_s all pass, also withGGML_CUDA_FORCE_MMQ=1(all failed on 13.2.0)So for anyone hitting this: check
nvcc --version, and if it says 13.2.51 or 13.2.78, upgrade to 13.2.2+ and rebuild the engine.STRATA_PREFILL_MMQ=0is the workaround until then.@Niko1221 commented on GitHub (Oct 7, 2026):
Thanks, signalnine, for the root cause. It matches the CUDA 13.2 miscompile in #892: on our RTX 5070 the IQ2_S / IQ3_S MMQ and MMVQ paths are wrong with nvcc 13.2.51 and right with 13.0.88 (we did not run the K-quant MMQ path on 13.2, so that part is not confirmed). In 0.1.40.2 setup warns about nvcc 13.2.0 and 13.2.1 only and accepts 13.2.2 (build 13.2.86) without a warning; it recommends and never forces, and it takes an older 13.x when one is installed and no compiler was named. The ready-made engines are built with CUDA 13.0. Could you rebuild with CUDA 13.0 or 13.2.2 (STRATA_NVCC=) and tell us if the garbage prompts go away?
@signalnine commented on GitHub (Oct 7, 2026):
Yes, already done, see https://github.com/Niko1221/Strata/issues/968#issuecomment-6020311117: rebuilt with CUDA 13.2.2 (nvcc 13.2.86) from unmodified source, and the garbage prompts are gone on the 5090 with MMQ on. The repro prompts read correctly, the 19,440-token needle is found, and the iq1_s / iq2_s / iq3_s
test-backend-opscases pass. I didn't try 13.0. Fine to close from my side.@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.