Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

docs: gfx906 (Instinct MI50 / MI60, Radeon VII) build, kernels and measurements in AMD_HIP.md

JeanP00l8e8e6412454b
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index f77328357..343c7c480 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -5,7 +5,8 @@ covers the build on Linux (on Windows a ready-made engine, see [Windows](#window
RX 9070 / 9070 XT / Radeon AI PRO R9700 (RDNA4, gfx1201; see [RDNA4](#rdna4-gfx1201)). The RX 7800 XT / 7700 XT
(gfx1101) and the RX 9060 XT (gfx1200) were validated by their owners (see [Community-validated
cards](#community-validated-cards)); the RX 6800 / 6900 series (RDNA2, gfx1030) builds and runs too, reported by a community machine and not yet validated by the maintainers (see [RDNA2](#rdna2-gfx1030)). Setup chooses it by itself on a PC with no NVIDIA card Strata can use (`--backend hip` on a PC with both); the
-install steps for users are in [INSTALL.md](INSTALL.md#amd-cards). Other AMD architectures, wave64, and mixed
+install steps for users are in [INSTALL.md](INSTALL.md#amd-cards). gfx906 (Instinct MI50 / MI60, Radeon VII; wave64) has a separate
+opt-in build, see [gfx906](#gfx906-instinct-mi50--mi60-radeon-vii-wave64-built-from-source). Other AMD architectures and mixed
AMD/NVIDIA execution in one run are not supported.
The backend maps the CUDA-shaped runtime and BLAS calls to HIP/hipBLAS, uses
@@ -350,6 +351,65 @@ run it; the report below is from a community machine: an RX 6900 XT 16 GB (gfx10
- **Not validated:** gfx1031 / gfx1032 (the same `dp4a` path, no hardware report), setup's own build path and the
`gfx103X-all` wheels on gfx1030, images, answer-quality benchmarks.
+## gfx906 (Instinct MI50 / MI60, Radeon VII): wave64, built from source
+
+gfx906 is wave64 and has no WMMA and no packed byte arithmetic, so the wave32 backend above refuses it. A separate opt-in build compiles the CUDA sources as HIP through a small compat layer
+(`include/strata/platform/hip_compat/`), with a CUDA warp mapped to a logical half of the 64-lane wavefront
+(32-wide shuffles, a ballot of its own half). The hot kernels have wave64 layouts of their own (below). Setup does
+not build it yet: build by hand, and run `serve/server.py` with a config as on any other card.
+
+**ROCm.** AMD's current ROCm releases no longer ship gfx906 libraries. The build and the measurements below used
+HIP 7.14 from the community image [`mixa3607/rocm-gfx906:7.14-complete`](https://hub.docker.com/r/mixa3607/rocm-gfx906)
+(rocBLAS/hipBLAS with gfx906 kernels), on the kernel's amdgpu driver (Ubuntu 24.04, kernel 6.8). hipBLASLt is not
+used.
+
+```sh
+# inside the image, with this checkout at /src and llama.cpp at the pinned commit in third_party/llama.cpp
+apt-get update && apt-get install -y cmake ninja-build git python3 build-essential
+cmake -S . -B build-906 -G Ninja -DSTRATA_HIP_GFX906=ON -DCMAKE_HIP_ARCHITECTURES=gfx906 \
+ -DSTRATA_GGML_DIR=/src/third_party/llama.cpp \
+ -DCMAKE_C_COMPILER=/opt/rocm/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/rocm/llvm/bin/clang++
+ninja -C build-906 strata
+```
+
+`STRATA_HIP_GFX906` turns on the CUDA targets and refuses `STRATA_ENABLE_HIP` (one HIP build at a time). Run the
+container with `--device=/dev/kfd --device=/dev/dri --group-add video --ipc=host --ulimit memlock=-1`; on some boards
+`HSA_OVERRIDE_GFX_VERSION=9.0.6` is needed for the runtime to accept the card.
+
+**What differs from the CUDA build** (all under `STRATA_HIP_GFX906`; each A/B switch restores the CUDA layout):
+
+| | gfx906 | switch |
+|---|---|---|
+| grouped native experts | mode 7: signs as `dp4a(g ^ m, u) - dp4a(m, u)` (no byte SIMD), grids and activations in LDS, one weight load per group | `STRATA_EXP_MODE=2` (previous AMD layout) |
+| MMVQ | one wavefront per row, 64-lane butterfly, no LDS | `STRATA_MMVQ_WAVE=0` |
+| router top-10 | one wavefront, register argmax | - |
+| `gr_down_multi` | split along K (8 rows x 5 slices of 2048) | `STRATA_GR_SPLIT=0` |
+| hyper-connection read | norm loads in flight, 8 lanes per row for `up` | `STRATA_GR_FAST=0` |
+| IQ4 table lookup | llama.cpp's `v_perm_b32` sequence (HIP's `__byte_perm` is a scratch array) | - |
+| QSA prompt attention | the FP32 kernel (no tensor cores / WMMA) | - |
+
+Every switch above was checked bitwise against the layout it replaces: the parity tests on synthetic data,
+`native_expert_bench` on real GGUF rows (one mode against another), and the greedy text of a fixed request.
+
+**Measured** on 2x Instinct MI50 16 GB (85 W power limit each, PCIe 3.0 x16 both, peer access between them),
+Xeon E5-2666 v3 (10 cores, AVX2), 32 GB DDR4, SATA SSD; Coder IQ1_M (`--native` pack), 131,072-token context,
+`--kv int8 --kv-resident 32768`, `--layer-split 27`, `--prefill 4096`, MTP `--spec 4 --spec-min-p 0.5`,
+`--pcie-frac 0`, `STRATA_ARENA_MMAP=1`. Measured on the port this build was cut from (builds on the 0.1.30 and 0.1.33 bases, the same
+kernels, plus the layer-split weight trim and the mapped arena, which are separate pull requests):
+
+- all 12,288 experts held in VRAM across the two cards;
+- a 17,043-token agent prompt (Claude Code's first request, tools included) read in 43.5 s (392 tok/s), decode
+ on it 57.7-59.3 tok/s;
+- 25 GB of the 32 GB RAM available while serving;
+- six repeats of that request with a 6,000-token output cap and a 900-second two-client load test run six times
+ (407 requests, 202,940 tokens): no stalls, no errors, no GPU faults.
+
+For comparison on the same machine: llama.cpp (3cf0325, ROCm) on the same Coder IQ1_M measured 26.9 tok/s `tg128`.
+
+**Not done:** setup.py detection and an automatic build, Windows, images (`--vision`), MI60 and Radeon VII (the
+same gfx906 ISA; not run), a single-card run, the tensor-split experiment (the halves of every layer on two cards;
+it works but is not part of this build).
+
## Tuning table
A hipBLASLt table holds solution ids that are valid only for one GPU architecture and one hipBLASLt version, so it
diff --git a/tests.list b/tests.list
new file mode 100644
index 000000000..cff33600c
--- /dev/null
+++ b/tests.list
@@ -0,0 +1,33 @@
+file_expert_source_test file_expert_source_test
+expert_profile_save_test expert_profile_save_test
+dequant_s2_parity dequant_s2_parity --selftest
+s2_gemv_parity s2_gemv_parity --selftest
+mmvq_multi_parity mmvq_multi_parity
+iq_multi_parity iq_multi_parity
+native_grouped_parity native_grouped_parity
+shared_expert_parity shared_expert_parity --selftest
+gr_parity gr_parity --selftest
+gdn_parity gdn_parity --selftest
+s2_gemv_q8_parity s2_gemv_q8_parity --selftest
+sampler_parity sampler_parity --selftest
+sampler_parity_one_block sampler_parity --selftest
+sampler_parity_old sampler_parity --selftest
+decode_cluster_parity decode_cluster_parity --selftest
+rope_parity rope_parity --selftest
+quantize_act_parity quantize_act_parity --selftest
+router_top10_parity router_top10_parity --selftest
+s_gemv_parity s_gemv_parity --selftest
+elementwise_parity elementwise_parity --selftest
+bf16_gemv_parity bf16_gemv_parity --selftest
+s_gemv_q8k_parity s_gemv_q8k_parity --selftest
+qsa_parity qsa_parity --selftest
+kv_q8_parity kv_q8_parity
+kv_stream_parity kv_stream_parity
+kv_hybrid_parity kv_hybrid_parity
+kv_q4_parity kv_q4_parity
+cvec_parity cvec_parity
+s2_expert_grouped_parity s2_expert_grouped_parity --selftest
+platform_memory_test platform_memory_test
+pinned_shared_test pinned_shared_test
+ple_reader_selftest ple_reader_test --selftest
+cuda_device_selftest strata-device --selftest