[GH-ISSUE #106] HIP/ROCm (gfx1100) port: the full IQ3_S model builds, runs and serves on an RX 7900 XTX — findings and what we would like to send #56

Closed
opened 2026-11-04 01:39:22 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @xyzzing on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/106

What this is

A working HIP/ROCm port of the engine, built from your sources at a pinned tag (Strata/ untouched — the port is a hash-recorded patch step over a generated tree) and used daily on:

GPU Radeon RX 7900 XTX (gfx1100, Navi 31), 24 GB
Stack Fedora 44, ROCm 7.1.1 (Fedora RPMs), HIP 7.1, ROCm clang 20, CMake 4.3, Ryzen 9 7900X, 96 GB
Model Qwen3.8-Flash-Next IQ3_S (the pack you support), MTP draft resident, int8 streaming KV

It is not a fork of your CUDA code with the device kernels rewritten: no device kernel needed a math change. What the port needed was a handful of targeted patches (target gate, portable QSA scorer, MMQ arch id, an LDS-limit fix, a file-backed expert source for IQ packs, an opt-in rocWMMA fast path) plus a serving layer.

What works, measured

  • Kernel parity suite on the card: 41 passed, 0 failed, 2 skipped (both weight-gated). All 8 MMQ prompt types verified on gfx1100 against independently-derived bounds (worst case IQ2 at 0.001 of its bound).
  • First inference (one-shot, 4K context, greedy, --spec 2): "The capital of France is" → " Paris. The capital of Germany is Berlin", 8 tokens at 32.35 tok/s, TTFT 524 ms.
  • Web UI + OpenAI API on loopback: "Name the capital of France in one word." → "Paris", finish=stop. Prompt cache, MTP/speculation, expert-cache tier, tool-calling all in use.
  • Rates at 65k context (--kv int8 --kv-resident 32768, --prefill 8192):
    • prompt read 496 tok/s on 8,211-token prompts (holdout 574); 356–366 tok/s on 32,774-token prompts (~95 s wall)
    • decode 36.7–38.1 tok/s in the tuning cycle's per-slot medians (--spec-split +5.7%, holdout-confirmed); warm short chat 39–48 tok/s
  • Against llama.cpp (mainline b10723) on identical weights, prompts and GPU: 38.8–43.3 vs 18.7 tok/s decode (2.1–2.3×) and 47–55 vs 33 tok/s prompt read, at 65k vs its 32k context. (Your architecture's expert cache/arena design is where that comes from; llama.cpp's PR #27861 was not in that build, and we say so.)
  • Honest state dependence: the same one-shot command that measured 32.35 tok/s with a warm page cache measured 1.52 tok/s cold (experts coming from disk); the resident server's 19-minute, ~13k-context answer averaged 11.5 tok/s while a warm short prompt on the same config measures 30–35 tok/s right now. Long context is not free, and a starved expert tier (VRAM free at engine start) costs 2–3×.

Not verified: no same-weights logit reference exists on this machine (your 27B/dense variants would not coexist in 96 GB RAM alongside the 84 GB-resident model), so correctness rests on the kernel-level parity suite plus same-weights output comparison with llama.cpp.

Upstream defects found while porting

  1. fused_gr_read_multi stages 80 KB of dynamic shared memory (8 * 2560 * 4), past RDNA3's 64 KB workgroup limit. Here the attribute call failed silently and the launch returned hipErrorInvalidValue, which killed the first prompt pass. Fix: TILE 2560 → 1024 (tile-loop arithmetic unchanged, no math change) — or at least printing the guard values when the launch fails.
  2. native_moe_combine contradicts its own header under the project's -ffp-contract=off: the file documents FMA accumulation for experts 1..k-1, but they rounded separately — bit-for-bit visible to a test that computes two exact fp32 simulations (35–280 of 256–512 elements differed). Fix: explicit __fmaf_rn.
  3. The MMQ path derives the device arch id with CUDA's 100*major + 10*minor encoding instead of ggml's own parser (src/prefill/ggml_cuda_host.cu). It happens to be right on CUDA and was invalid here, so every MMQ launch aborted.
  4. The web UI's live tok/s is a mean, not a rate (generated / (now - first_token)): five-digit numbers at the first sample of every answer, then undershooting. Fixed in #104.
  5. The Monitor is NVML-only, so on ROCm every GPU card is empty and About says "not readable (NVML)"; with no psutil the disk rate is empty too. Fixed in #105.
  6. --mmap-experts is Q2_0-only: FileExpertSource wants uniform BLOB-sized experts while iq_pack --experts-bin writes the per-layer layout, so IQ packs have no file-backed source and the engine pins a 47.9 GiB hipHostRegister arena (that arena is also what OOM-killed us once under coexistence). We wrote the file-backed source for the IQ layout.
  7. The QSA scorer is inline-PTX-only. We have both a portable reference path and an opt-in WMMA path (rocWMMA 7.1.1, wave32, 16x16x16 fp16→fp32), the latter validated against a float64 model within ~1 f32 ulp.

What we would like to send

  • #104 (live rate) and #105 (AMD telemetry) are up now — platform-independent, tested, and each needs no GPU to review.
  • A HIP backend series, if you want one: the patches above, one PR each, each carrying the parity test that proves it (target gate, portable scorer, rocWMMA scorer, file-backed IQ experts, the LDS fix + diagnostics, MMQ arch id). Or a single "add a HIP backend" PR if you prefer one review.
  • If you would rather keep the port out-of-tree, that is fine too — tell us and we will only send fixes like #104/#105. The patch set as it stands (10 declared patches, each with a prose header explaining what and why) is readable here: https://github.com/xyzzing/Strata/tree/rocm-port — note that branch is a documentation/tooling snapshot, not a proposed merge.
  • Also happy to contribute an AMD row for the measured-rates table if useful; today it compares against the RTX 5070 numbers.

Anything in here you would like reproduced on your side, or a smaller first step? We are happy to cut the series down to whatever you are comfortable reviewing.

Originally created by @xyzzing on GitHub (Sep 29, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/106 ### What this is A working **HIP/ROCm port** of the engine, built from your sources at a pinned tag (`Strata/` untouched — the port is a hash-recorded patch step over a generated tree) and used daily on: | | | | --- | --- | | GPU | **Radeon RX 7900 XTX** (`gfx1100`, Navi 31), 24 GB | | Stack | Fedora 44, ROCm 7.1.1 (Fedora RPMs), HIP 7.1, ROCm clang 20, CMake 4.3, Ryzen 9 7900X, 96 GB | | Model | Qwen3.8-Flash-Next IQ3_S (the pack you support), MTP draft resident, int8 streaming KV | It is not a fork of your CUDA code with the device kernels rewritten: **no device kernel needed a math change**. What the port needed was a handful of targeted patches (target gate, portable QSA scorer, MMQ arch id, an LDS-limit fix, a file-backed expert source for IQ packs, an opt-in rocWMMA fast path) plus a serving layer. ### What works, measured - **Kernel parity suite on the card: 41 passed, 0 failed, 2 skipped** (both weight-gated). All **8 MMQ prompt types** verified on gfx1100 against independently-derived bounds (worst case IQ2 at 0.001 of its bound). - **First inference** (one-shot, 4K context, greedy, `--spec 2`): *"The capital of France is" → " Paris. The capital of Germany is Berlin"*, 8 tokens at 32.35 tok/s, TTFT 524 ms. - **Web UI + OpenAI API on loopback**: *"Name the capital of France in one word." → "Paris"*, `finish=stop`. Prompt cache, MTP/speculation, expert-cache tier, tool-calling all in use. - **Rates at 65k context** (`--kv int8 --kv-resident 32768`, `--prefill 8192`): - prompt read **496 tok/s** on 8,211-token prompts (holdout 574); **356–366 tok/s** on 32,774-token prompts (~95 s wall) - decode **36.7–38.1 tok/s** in the tuning cycle's per-slot medians (`--spec-split` +5.7%, holdout-confirmed); warm short chat 39–48 tok/s - **Against llama.cpp (mainline b10723) on identical weights, prompts and GPU**: **38.8–43.3 vs 18.7 tok/s** decode (2.1–2.3×) and 47–55 vs 33 tok/s prompt read, at 65k vs its 32k context. (Your architecture's expert cache/arena design is where that comes from; llama.cpp's PR #27861 was not in that build, and we say so.) - **Honest state dependence**: the same one-shot command that measured 32.35 tok/s with a warm page cache measured **1.52 tok/s cold** (experts coming from disk); the resident server's 19-minute, ~13k-context answer averaged **11.5 tok/s** while a warm short prompt on the same config measures **30–35 tok/s** right now. Long context is not free, and a starved expert tier (VRAM free at engine start) costs 2–3×. Not verified: no same-weights logit reference exists on this machine (your 27B/dense variants would not coexist in 96 GB RAM alongside the 84 GB-resident model), so correctness rests on the kernel-level parity suite plus same-weights output comparison with llama.cpp. ### Upstream defects found while porting 1. **`fused_gr_read_multi` stages 80 KB of dynamic shared memory** (`8 * 2560 * 4`), past RDNA3's 64 KB workgroup limit. Here the attribute call failed silently and the launch returned `hipErrorInvalidValue`, which killed the first prompt pass. Fix: `TILE 2560 → 1024` (tile-loop arithmetic unchanged, no math change) — or at least printing the guard values when the launch fails. 2. **`native_moe_combine` contradicts its own header** under the project's `-ffp-contract=off`: the file documents FMA accumulation for experts `1..k-1`, but they rounded separately — bit-for-bit visible to a test that computes two exact fp32 simulations (35–280 of 256–512 elements differed). Fix: explicit `__fmaf_rn`. 3. **The MMQ path derives the device arch id with CUDA's `100*major + 10*minor` encoding** instead of ggml's own parser (`src/prefill/ggml_cuda_host.cu`). It happens to be right on CUDA and was invalid here, so every MMQ launch aborted. 4. **The web UI's live tok/s is a mean, not a rate** (`generated / (now - first_token)`): five-digit numbers at the first sample of every answer, then undershooting. Fixed in **#104**. 5. **The Monitor is NVML-only**, so on ROCm every GPU card is empty and About says "not readable (NVML)"; with no `psutil` the disk rate is empty too. Fixed in **#105**. 6. **`--mmap-experts` is Q2_0-only**: `FileExpertSource` wants uniform BLOB-sized experts while `iq_pack --experts-bin` writes the per-layer layout, so IQ packs have no file-backed source and the engine pins a **47.9 GiB** `hipHostRegister` arena (that arena is also what OOM-killed us once under coexistence). We wrote the file-backed source for the IQ layout. 7. **The QSA scorer is inline-PTX-only.** We have both a portable reference path and an opt-in WMMA path (rocWMMA 7.1.1, wave32, `16x16x16` fp16→fp32), the latter validated against a float64 model within ~1 f32 ulp. ### What we would like to send - **#104** (live rate) and **#105** (AMD telemetry) are up now — platform-independent, tested, and each needs no GPU to review. - **A HIP backend series, if you want one**: the patches above, one PR each, each carrying the parity test that proves it (target gate, portable scorer, rocWMMA scorer, file-backed IQ experts, the LDS fix + diagnostics, MMQ arch id). Or a single "add a HIP backend" PR if you prefer one review. - If you would rather **keep the port out-of-tree**, that is fine too — tell us and we will only send fixes like #104/#105. The patch set as it stands (10 declared patches, each with a prose header explaining what and why) is readable here: <https://github.com/xyzzing/Strata/tree/rocm-port> — note that branch is a documentation/tooling snapshot, not a proposed merge. - Also happy to contribute an **AMD row** for the measured-rates table if useful; today it compares against the RTX 5070 numbers. Anything in here you would like reproduced on your side, or a smaller first step? We are happy to cut the series down to whatever you are comfortable reviewing.
Author
Owner

@qwased commented on GitHub (Sep 29, 2026):

https://github.com/Headmaster218/MoE4All
There is vulkan engine

<!-- gh-comment-id:5884927385 --> @qwased commented on GitHub (Sep 29, 2026): https://github.com/Headmaster218/MoE4All There is vulkan engine
Author
Owner

@2jztricks commented on GitHub (Sep 29, 2026):

https://github.com/Niko1221/Strata/pull/121

<!-- gh-comment-id:5886994539 --> @2jztricks commented on GitHub (Sep 29, 2026): https://github.com/Niko1221/Strata/pull/121
Author
Owner

@Niko1221 commented on GitHub (Sep 29, 2026):

Thanks @xyzzing. Most of your list landed with the HIP backend in 0.1.25 (the fused_gr LDS tile, the MMQ arch id) and 0.1.26 (--mmap-experts for IQ packs); #104 is merged and #105 is under review. A rocWMMA scorer PR with parity and speed numbers, and an AMD row for the rates table, would both be welcome. Closing this as done.

<!-- gh-comment-id:5898166461 --> @Niko1221 commented on GitHub (Sep 29, 2026): Thanks @xyzzing. Most of your list landed with the HIP backend in 0.1.25 (the fused_gr LDS tile, the MMQ arch id) and 0.1.26 (`--mmap-experts` for IQ packs); #104 is merged and #105 is under review. A rocWMMA scorer PR with parity and speed numbers, and an AMD row for the rates table, would both be welcome. Closing this as done.
Author
Owner

@xyzzing commented on GitHub (Oct 1, 2026):

Refresh on this thread — much of what it proposed is now upstream, and the port has moved:

  • Both platform patches landed: the live tok/s rate fix (#104) and the amdgpu-sysfs telemetry backend (#105) are merged — thank you. The remaining patch-table in this issue's original list is accordingly shorter.
  • The port now runs engine 0.1.31 (9259cad) on the RX 7900 XTX / gfx1100, single card, IQ3_S. Measured on the card (median of 3 clean one-shot cells per tier, greedy, 256 tokens): decode 64.2 / 59.1 / 60.5 / 56.8 / 59.0 tok/s at 1K/4K/32K/64K/128K, prompt 850–1,565 tok/s. Details and per-cell records are in the #319 thread — short version: your +20% decode from the #262 intrinsics reads confirmed on gfx1100 (+13–27% depending on tier), and the 32K prompt dip we saw on the 0.1.30-era build is gone on 0.1.31.
  • The rocWMMA QSA-select arm was rebased as requested — it is #368, built on top of #337's arch-dispatching qsa_block_scores_tc (gfx12 first, gfx1100 FP16 arm under STRATA_SELECT_WMMA=1, warp fallback; the arm that ran is printed once). Parity 5/5 incl. the adversarial fixtures and failing negative control; kernel 11.64x at 128K on this branch's own 0.1.31 build.
  • Two environment notes from the 0.1.31 bump that may matter for other AMD users (not defects): split-GGUF loading now requires the full -NNNNN-of-MMMMM shard set by name, and --native/--ple-gguf must name the same shard set or the loader reports a duplicate shard; and 0.1.31's ple_parity hard-fails without the model's PLE table rather than skipping, which surprised our harness (we classify it as the declared weight-gated skip it is).
<!-- gh-comment-id:5932429115 --> @xyzzing commented on GitHub (Oct 1, 2026): Refresh on this thread — much of what it proposed is now upstream, and the port has moved: - **Both platform patches landed**: the live tok/s rate fix (#104) and the amdgpu-sysfs telemetry backend (#105) are merged — thank you. The remaining patch-table in this issue's original list is accordingly shorter. - **The port now runs engine 0.1.31** (`9259cad`) on the RX 7900 XTX / gfx1100, single card, IQ3_S. Measured on the card (median of 3 clean one-shot cells per tier, greedy, 256 tokens): decode 64.2 / 59.1 / 60.5 / 56.8 / 59.0 tok/s at 1K/4K/32K/64K/128K, prompt 850–1,565 tok/s. Details and per-cell records are in the #319 thread — short version: your +20% decode from the #262 intrinsics reads confirmed on gfx1100 (+13–27% depending on tier), and the 32K prompt dip we saw on the 0.1.30-era build is gone on 0.1.31. - **The rocWMMA QSA-select arm was rebased as requested** — it is #368, built on top of #337's arch-dispatching `qsa_block_scores_tc` (gfx12 first, gfx1100 FP16 arm under `STRATA_SELECT_WMMA=1`, warp fallback; the arm that ran is printed once). Parity 5/5 incl. the adversarial fixtures and failing negative control; kernel 11.64x at 128K on this branch's own 0.1.31 build. - Two environment notes from the 0.1.31 bump that may matter for other AMD users (not defects): split-GGUF loading now requires the full `-NNNNN-of-MMMMM` shard set by name, and `--native`/`--ple-gguf` must name the same shard set or the loader reports a duplicate shard; and 0.1.31's `ple_parity` hard-fails without the model's PLE table rather than skipping, which surprised our harness (we classify it as the declared weight-gated skip it is).
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#56
No description provided.