[GH-ISSUE #5151] [Engine] gfx103x: make the prompt's FP16 GEMMs the default (the default path gives non-finite logits on some ROCm builds) #3062

Open
opened 2026-11-07 14:37:45 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @cloud4t0r on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5151

Summary

On gfx103x the prompt path's 16-bit GEMMs can run in FP16 in and out (prompt_f16(), #835), which is opt-in today (STRATA_HIP_PROMPT_F16=1) because it changes the prompt path's numbers. This is a scope request to flip that default on gfx103x (STRATA_HIP_PROMPT_F16=0 to keep the old bytes) — not a PR. Two reasons, one of which is not a preference:

  1. On some gfx103x/ROCm builds the default (non-FP16) prompt path produces non-finite logits for every batched prompt. That is #1208, closed by the tracker-cleanup rule: Fedora 44, ROCm 7.1.1 / rocBLAS 5.7.0, RX 6800 (gfx1030) + RX 9070, Qwen3.8-Flash-Next GSQ-RCO IQ3_S, --kv int8 --spec 4 --mtp — "any prompt part > 64 tokens gives 248320/248320 non-finite logits". It still reproduces on 0.1.56; I added the details to #1208. A default that ends the request is worse than a default that rounds.
  2. FP16 is the fast path there anyway: ~2x on the prompt, measured in #835 and in docs/AMD_HIP.md (2x RX 6900 XT, GSQ-RCO IQ3_S: 9.4K / 34.7K / 105.8K prompts at 744 / 915 / 926 tok/s instead of 439 / 466 / 461, decode unchanged).

Proposed behaviour

prompt_f16() returns true on a gfx103x device unless STRATA_HIP_PROMPT_F16=0; every other card and every other switch keeps today's default. With that, the tip line the engine prints on gfx103x ("STRATA_HIP_PROMPT_F16=1 reads long prompts about 2x faster here") becomes the default and disappears.

Evidence on 0.1.56 (this box)

RX 9070 (gfx1201) as stage 0, RX 6800 (gfx1030) as stage 1, Swift-Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S (qwen4exp, 512 experts / top 10), --spec 4 --spec-min-p 0.5 --mtp --kv int8 --kv-resident 32768 --max-context 131072 --layer-split auto, engine 0.1.56 (5571819a), HIP build.

setting result
default, --short-read 0 (prompt fully batched), 56 tokens non-finite logits, request ends
default, --short-read 64, 56 tokens OK (windows only)
default, --short-read 64, 71 tokens non-finite (7 tokens reach the batched path)
default, --short-read 8192 (windows only), 1109 tokens OK, 106.9 tok/s prompt
STRATA_HIP_PROMPT_F16=1, 56 / 71 / 1109 tokens OK, 1109 read at 420.3 tok/s, answered at 62.6 tok/s

Not the FP16 range, on a clean run of the 1109-token prompt (STRATA_F16_RANGE=1, no STRATA_DBG_NAN):

strata f16 range: 1104 tokens: activation images max |x| 73.4 (0 beyond 65504 or NaN),
  BF16 weights max |w| 8.562 (0), FP16 GEMM outputs max |y| 345.8 (0 not finite)

So the outputs sit a factor ~190 below FP16's 65504 on this model, with no saturated or non-finite value. That is one pack and one prompt; it is not a proof for every pack.

Ruled out here, all still non-finite on the default path: STRATA_PREFILL_MMQ=0, --kv fp16, STRATA_ROUTE_TAIL_SKIP=0, STRATA_HC_Q8=0, --prompt-cache 0 --conversation-cache-mib 0, --max-context 32768, --gpu 0 alone. One difference from the 0.1.40.1 report: here the RX 9070 alone also produces the NaN on the batched path, so on 0.1.56 it is not only the gfx1030.

Tradeoffs

  • Numbers change for everyone on gfx103x: each 16-bit GEMM's output is rounded to FP16 instead of FP32 (the engine says "not bit-identical to the default"). Greedy answers can differ; the bench in docs/AMD_HIP.md (2026-10-04-rdna2-fp16-prompt) is the reference for how much.
  • Speed is not uniformly better: docs/AMD_HIP.md records one case where it was 1-3% slower (RX 6900 XT, UD-Q4_K_XL, rocBLAS 5.4.0). And #1208 reports a 2×RX 6900 XT box on ROCm 10.0 / rocBLAS 5.6.0 where the default path is finite, i.e. a default flip changes that box's numbers for a bug it does not have.
  • STRATA_RDNA2_SGEMM=1 (FP32 exact) still exists for anyone who wants exactness at FP16-route speed.

Alternatives, if you prefer a narrower change

  • (a) Keep opt-in, improve the signal only: after the first batched prompt comes out non-finite, print the tip with STRATA_HIP_PROMPT_F16=1 named as the fix. Smallest change, does not fix the first request.
  • (b) Gate on the rocBLAS build: turn FP16 on only for the builds that regress (5.7.0 so far). Narrower, but it needs a version check in prompt_f16() and the evidence is two boxes.
  • (c) Runtime fallback: if the first batched prompt is non-finite, redo it with FP16. prompt_f16() is cached per device and the prompt graphs are captured, so this needs more plumbing than it looks.
  • (d) What I propose: opt-out default on gfx103x only.

What I would need from you

An agreement on (d) or (b), and whether the numbers change is acceptable for a default (the other option is to keep (a) and treat #1208 as a ROCm bug to be worked around by the person hitting it).

I can implement and test whichever you pick on this box: one gfx1030 (RX 6800) + one gfx1201 (RX 9070), Fedora 44, /opt/rocm with libamdhip64.so.7.16.26385 and rocBLAS 5.7.0 (the version in the tuning-file name the engine looks for). I cannot test the ROCm 10.0 box where the default is already fine, so (d) cannot be validated there by me.

Related: #1208 (the bug), #835 (the original opt-in), #5147 / #5149 (an unrelated --pipeline-windows 2 deadlock found in the same session).

Originally created by @cloud4t0r on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5151 ## Summary On gfx103x the prompt path's 16-bit GEMMs can run in FP16 in and out (`prompt_f16()`, #835), which is opt-in today (`STRATA_HIP_PROMPT_F16=1`) because it changes the prompt path's numbers. This is a **scope request** to flip that default on gfx103x (`STRATA_HIP_PROMPT_F16=0` to keep the old bytes) — not a PR. Two reasons, one of which is not a preference: 1. **On some gfx103x/ROCm builds the default (non-FP16) prompt path produces non-finite logits for every batched prompt.** That is #1208, closed by the tracker-cleanup rule: Fedora 44, ROCm 7.1.1 / rocBLAS 5.7.0, RX 6800 (gfx1030) + RX 9070, `Qwen3.8-Flash-Next GSQ-RCO IQ3_S`, `--kv int8 --spec 4 --mtp` — "any prompt part > 64 tokens gives 248320/248320 non-finite logits". It still reproduces on **0.1.56**; I added the details to [#1208](https://github.com/Niko1221/Strata/issues/1208#issuecomment-6613940494). A default that ends the request is worse than a default that rounds. 2. **FP16 is the fast path there anyway**: ~2x on the prompt, measured in #835 and in `docs/AMD_HIP.md` (2x RX 6900 XT, GSQ-RCO IQ3_S: 9.4K / 34.7K / 105.8K prompts at 744 / 915 / 926 tok/s instead of 439 / 466 / 461, decode unchanged). ## Proposed behaviour `prompt_f16()` returns true on a gfx103x device unless `STRATA_HIP_PROMPT_F16=0`; every other card and every other switch keeps today's default. With that, the tip line the engine prints on gfx103x ("`STRATA_HIP_PROMPT_F16=1` reads long prompts about 2x faster here") becomes the default and disappears. ## Evidence on 0.1.56 (this box) RX 9070 (gfx1201) as stage 0, RX 6800 (gfx1030) as stage 1, `Swift-Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S` (qwen4exp, 512 experts / top 10), `--spec 4 --spec-min-p 0.5 --mtp --kv int8 --kv-resident 32768 --max-context 131072 --layer-split auto`, engine 0.1.56 (`5571819a`), HIP build. | setting | result | |---|---| | default, `--short-read 0` (prompt fully batched), 56 tokens | non-finite logits, request ends | | default, `--short-read 64`, 56 tokens | OK (windows only) | | default, `--short-read 64`, 71 tokens | **non-finite** (7 tokens reach the batched path) | | default, `--short-read 8192` (windows only), 1109 tokens | OK, 106.9 tok/s prompt | | `STRATA_HIP_PROMPT_F16=1`, 56 / 71 / 1109 tokens | OK, 1109 read at **420.3 tok/s**, answered at 62.6 tok/s | Not the FP16 range, on a clean run of the 1109-token prompt (`STRATA_F16_RANGE=1`, no `STRATA_DBG_NAN`): ``` strata f16 range: 1104 tokens: activation images max |x| 73.4 (0 beyond 65504 or NaN), BF16 weights max |w| 8.562 (0), FP16 GEMM outputs max |y| 345.8 (0 not finite) ``` So the outputs sit a factor ~190 below FP16's 65504 on this model, with no saturated or non-finite value. That is one pack and one prompt; it is not a proof for every pack. Ruled out here, all still non-finite on the default path: `STRATA_PREFILL_MMQ=0`, `--kv fp16`, `STRATA_ROUTE_TAIL_SKIP=0`, `STRATA_HC_Q8=0`, `--prompt-cache 0 --conversation-cache-mib 0`, `--max-context 32768`, `--gpu 0` alone. One difference from the 0.1.40.1 report: here the **RX 9070 alone** also produces the NaN on the batched path, so on 0.1.56 it is not only the gfx1030. ## Tradeoffs - Numbers change for everyone on gfx103x: each 16-bit GEMM's output is rounded to FP16 instead of FP32 (the engine says "not bit-identical to the default"). Greedy answers can differ; the bench in `docs/AMD_HIP.md` (2026-10-04-rdna2-fp16-prompt) is the reference for how much. - Speed is not uniformly better: `docs/AMD_HIP.md` records one case where it was 1-3% **slower** (RX 6900 XT, UD-Q4_K_XL, rocBLAS 5.4.0). And #1208 reports a 2×RX 6900 XT box on ROCm 10.0 / rocBLAS 5.6.0 where the default path is finite, i.e. a default flip changes that box's numbers for a bug it does not have. - `STRATA_RDNA2_SGEMM=1` (FP32 exact) still exists for anyone who wants exactness at FP16-route speed. ## Alternatives, if you prefer a narrower change - **(a) Keep opt-in, improve the signal only**: after the first batched prompt comes out non-finite, print the tip with `STRATA_HIP_PROMPT_F16=1` named as the fix. Smallest change, does not fix the first request. - **(b) Gate on the rocBLAS build**: turn FP16 on only for the builds that regress (5.7.0 so far). Narrower, but it needs a version check in `prompt_f16()` and the evidence is two boxes. - **(c) Runtime fallback**: if the first batched prompt is non-finite, redo it with FP16. `prompt_f16()` is cached per device and the prompt graphs are captured, so this needs more plumbing than it looks. - **(d) What I propose**: opt-out default on gfx103x only. ## What I would need from you An agreement on (d) or (b), and whether the numbers change is acceptable for a default (the other option is to keep (a) and treat #1208 as a ROCm bug to be worked around by the person hitting it). I can implement and test whichever you pick on this box: one gfx1030 (RX 6800) + one gfx1201 (RX 9070), Fedora 44, `/opt/rocm` with `libamdhip64.so.7.16.26385` and rocBLAS 5.7.0 (the version in the tuning-file name the engine looks for). I cannot test the ROCm 10.0 box where the default is already fine, so (d) cannot be validated there by me. Related: #1208 (the bug), #835 (the original opt-in), #5147 / #5149 (an unrelated `--pipeline-windows 2` deadlock found in the same session).
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#3062
No description provided.