[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

Closed
opened 2026-11-04 01:42:55 +07:00 by bsakaguchi · 7 comments
Owner

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=0 fixes 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

  • Engine 0.1.39, source build from main 6f32ec0 by setup (BUILD.json: archs [86, 120], CUDA 13.2), STRATA_MMQ_KQUANTS=OFF (setup's default)
  • RTX 5090 32 GB (sm_120) + RTX 3090 24 GB (sm_86), driver 580.119.02, Ryzen 9 9900X, 128 GB, Linux 6.18
  • --family unsloth --model UD-IQ4_XS --gguf-dir on the three shards (SHA-256s match the table in docs/UNSLOTH_Q4.md), packed by setup with --compat-bf16
  • Config as setup wrote it: --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp ... --max-context 32768 --kv int8, no images

Repro

Any passage plus a question about it, temperature 0, thinking off:

txt=$(head -c 1200 docs/MULTI_GPU.md | tr '\n' ' ')
curl -s http://127.0.0.1:8080/v1/chat/completions -H 'Content-Type: application/json' -d "$(jq -n --arg f "$txt" \
  '{model:"x",messages:[{role:"user",content:("Here is a passage:\n\n"+$f+"\n\nIn one sentence, what is this passage about? Then quote its first five words exactly.")}],max_tokens:100,temperature:0,reasoning_effort:"none"}')" \
  | jq -r .choices[0].message.content

5090, MMQ on (default), 344-token prompt:

The text provided is a corrupted or nonsensical string that appears to be a mix of: 1. Technical jargon (e.g., "GPU," "CUDA," ...

5090 with STRATA_PREFILL_MMQ=0, and the 3090 with MMQ on, same prompt:

This passage explains how Strata implements pipeline parallelism to run a single model across multiple NVIDIA GPUs by splitting layers and managing expert caches. Strata on two or three GPUs

What I measured

GPU MMQ 113 tok 344 tok 19,440-token needle (a passphrase planted mid-file)
5090 on "your message was cut off" "a corrupted or nonsensical string" missed: "incomplete or corrupted"
5090 + 3090 split (auto, K=47) on "a prompt injection attempt" "your message was cut off" missed: "corrupted or fragmented"
5090 off correct correct found
3090 on correct correct found
  • Prompts of 29-41 tokens come out right on the split with MMQ on, so the break sits somewhere between 41 and 113 tokens.
  • Prompt speed with MMQ off is the same as with it on: 690 vs 695 tok/s on the same 19K prompt on the 5090.
  • Decode with MMQ off: 121 tok/s on a 1,500-token code answer, MTP accepting 1,024 of 1,291 drafts.

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"} in strata-<model>.json, or the variable in the server's environment.

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=0` fixes 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 - Engine 0.1.39, source build from `main` 6f32ec0 by setup (`BUILD.json`: archs `[86, 120]`, CUDA 13.2), `STRATA_MMQ_KQUANTS=OFF` (setup's default) - RTX 5090 32 GB (sm_120) + RTX 3090 24 GB (sm_86), driver 580.119.02, Ryzen 9 9900X, 128 GB, Linux 6.18 - `--family unsloth --model UD-IQ4_XS --gguf-dir` on the three shards (SHA-256s match the table in `docs/UNSLOTH_Q4.md`), packed by setup with `--compat-bf16` - Config as setup wrote it: `--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp ... --max-context 32768 --kv int8`, no images ## Repro Any passage plus a question about it, temperature 0, thinking off: ```sh txt=$(head -c 1200 docs/MULTI_GPU.md | tr '\n' ' ') curl -s http://127.0.0.1:8080/v1/chat/completions -H 'Content-Type: application/json' -d "$(jq -n --arg f "$txt" \ '{model:"x",messages:[{role:"user",content:("Here is a passage:\n\n"+$f+"\n\nIn one sentence, what is this passage about? Then quote its first five words exactly.")}],max_tokens:100,temperature:0,reasoning_effort:"none"}')" \ | jq -r .choices[0].message.content ``` 5090, MMQ on (default), 344-token prompt: > The text provided is a **corrupted or nonsensical string** that appears to be a mix of: 1. **Technical jargon** (e.g., "GPU," "CUDA," ... 5090 with `STRATA_PREFILL_MMQ=0`, and the 3090 with MMQ on, same prompt: > This passage explains how Strata implements pipeline parallelism to run a single model across multiple NVIDIA GPUs by splitting layers and managing expert caches. Strata on two or three GPUs ## What I measured | GPU | MMQ | 113 tok | 344 tok | 19,440-token needle (a passphrase planted mid-file) | | --- | --- | --- | --- | --- | | 5090 | on | "your message was cut off" | "a corrupted or nonsensical string" | missed: "incomplete or corrupted" | | 5090 + 3090 split (auto, K=47) | on | "a prompt injection attempt" | "your message was cut off" | missed: "corrupted or fragmented" | | 5090 | off | correct | correct | found | | 3090 | on | correct | correct | found | - Prompts of 29-41 tokens come out right on the split with MMQ on, so the break sits somewhere between 41 and 113 tokens. - Prompt speed with MMQ off is the same as with it on: 690 vs 695 tok/s on the same 19K prompt on the 5090. - Decode with MMQ off: 121 tok/s on a 1,500-token code answer, MTP accepting 1,024 of 1,291 drafts. 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"}` in `strata-<model>.json`, or the variable in the server's environment.
Author
Owner

@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.

<!-- gh-comment-id:6010954395 --> @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.
Author
Owner

@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=1 reports 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 below STRATA_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):

MMQ layers formats (gate/up, down) RTX 5090 (sm_120) RTX 3090 (sm_86)
0-47 all 3.55 (cos 0.06) 0.082 (cos 0.997)
0 IQ3_S, IQ4_NL 0.220 0.073
2 IQ4_XS, Q8_0 0.063 0.070
4 IQ3_S, Q8_0 0.227 0.068
10 IQ3_S, IQ4_NL 0.252 0.056
30 IQ3_S, Q8_0 0.394 0.015
40 IQ3_S, IQ4_NL 0.424 0.002
47 IQ3_S, Q8_0 0.338 0.001

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.

<!-- gh-comment-id:6018649187 --> @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=1` reports 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 below `STRATA_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): | MMQ layers | formats (gate/up, down) | RTX 5090 (sm_120) | RTX 3090 (sm_86) | | --- | --- | ---: | ---: | | 0-47 | all | 3.55 (cos 0.06) | 0.082 (cos 0.997) | | 0 | IQ3_S, IQ4_NL | 0.220 | 0.073 | | 2 | IQ4_XS, Q8_0 | 0.063 | 0.070 | | 4 | IQ3_S, Q8_0 | 0.227 | 0.068 | | 10 | IQ3_S, IQ4_NL | 0.252 | 0.056 | | 30 | IQ3_S, Q8_0 | 0.394 | 0.015 | | 40 | IQ3_S, IQ4_NL | 0.424 | 0.002 | | 47 | IQ3_S, Q8_0 | 0.338 | 0.001 | 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.
Author
Owner

@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:

5090 (sm_120) 3090 (sm_86)
pin, MUL_MAT iq3_s / iq2_s / iq1_s 0/14, 0/14, 0/14 pass 14/14 each
pin, MUL_MAT_ID iq3_s 0/12 (ERR 0.84-0.92) 12/12
pin + #28784 (__byte_perm), MUL_MAT / MUL_MAT_ID / GGML_CUDA_FORCE_MMQ=1, all three types all pass all pass
iq2_xxs, iq2_xs, iq3_xxs, iq1_m, iq4_xs, iq4_nl, q8_0 (pin) pass pass

Then 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:

  • carry #28784's patch (6 one-line __byte_perm changes in mmq-load-tiles.cuh and vecdotq.cuh) on the pinned llama.cpp setup downloads, or bump the pin once upstream takes a fix
  • have setup refuse, or warn about, nvcc 13.2.0 / 13.2.1 when it compiles for an sm_120 card (13.2.2+ and 13.3+ are fine per #28581)
  • route IQ1_S / IQ2_S / IQ3_S layers to the FP16 prompt path when the engine was built with a bad toolkit for cc >= 1200

Worth a look while you're there: Strata's own src/kernels/cuda/iq_kernels.cu uses the same (const uint8_t*) &qs_packed byte 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.

<!-- gh-comment-id:6019102278 --> @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: | | 5090 (sm_120) | 3090 (sm_86) | | --- | --- | --- | | pin, MUL_MAT iq3_s / iq2_s / iq1_s | 0/14, 0/14, 0/14 pass | 14/14 each | | pin, MUL_MAT_ID iq3_s | 0/12 (ERR 0.84-0.92) | 12/12 | | pin + #28784 (`__byte_perm`), MUL_MAT / MUL_MAT_ID / `GGML_CUDA_FORCE_MMQ=1`, all three types | all pass | all pass | | iq2_xxs, iq2_xs, iq3_xxs, iq1_m, iq4_xs, iq4_nl, q8_0 (pin) | pass | pass | Then 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: - carry #28784's patch (6 one-line `__byte_perm` changes in `mmq-load-tiles.cuh` and `vecdotq.cuh`) on the pinned llama.cpp setup downloads, or bump the pin once upstream takes a fix - have setup refuse, or warn about, nvcc 13.2.0 / 13.2.1 when it compiles for an sm_120 card (13.2.2+ and 13.3+ are fine per #28581) - route IQ1_S / IQ2_S / IQ3_S layers to the FP16 prompt path when the engine was built with a bad toolkit for cc >= 1200 Worth a look while you're there: Strata's own `src/kernels/cuda/iq_kernels.cu` uses the same `(const uint8_t*) &qs_packed` byte 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.
Author
Owner

@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.

  • pinned llama.cpp test-backend-ops on the 5090: MUL_MAT / MUL_MAT_ID for iq1_s, iq2_s, iq3_s all pass, also with GGML_CUDA_FORCE_MMQ=1 (all failed on 13.2.0)
  • Strata 0.1.39 engine rebuilt the same way, MMQ on: the repro prompts read correctly and the 19,440-token needle is found, 766 tok/s prompt

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=0 is the workaround until then.

<!-- gh-comment-id:6020311117 --> @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. - pinned llama.cpp `test-backend-ops` on the 5090: MUL_MAT / MUL_MAT_ID for iq1_s, iq2_s, iq3_s all pass, also with `GGML_CUDA_FORCE_MMQ=1` (all failed on 13.2.0) - Strata 0.1.39 engine rebuilt the same way, MMQ on: the repro prompts read correctly and the 19,440-token needle is found, 766 tok/s prompt 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=0` is the workaround until then.
Author
Owner

@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?

<!-- gh-comment-id:6037917780 --> @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=<its nvcc>) and tell us if the garbage prompts go away?
Author
Owner

@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-ops cases pass. I didn't try 13.0. Fine to close from my side.

<!-- gh-comment-id:6039763486 --> @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-ops` cases pass. I didn't try 13.0. Fine to close from my side.
Author
Owner

@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.

<!-- gh-comment-id:6156000832 --> @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](https://github.com/Niko1221/Strata/releases/tag/v0.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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#422
No description provided.