docs: RDNA4 (gfx1201) in AMD_HIP.md with the validation on the RX 9070 XT and R9700; how to calibrate a hipBLASLt table; README and setup's texts name the RDNA4 cards
AMD_HIP.md: the per-arch ROCm wheels, the system-ROCm rule, the table rule, the arch list and the startup check; an RDNA4 section (ctest 42 pass / 1 skip / 2 non-GPU failures, the arch check, end-to-end 4K/16K numbers on both cards and with setup's TheRock 7.10 wheels, the 9/9 server smoke on each card, why no gfx1201 table is shipped, what is not validated); a Tuning table section with the tune_hipblaslt command at the engine's shapes. setup's no-table message points there.
This commit is contained in:
1 parent
70e24f43e3
commit
dea2b5a3ec
3 files changed
+85
-19
No files matched your search
@@ -84,9 +84,9 @@ one later with `SETUP.bat` (the same as `START-HERE.bat --setup`; on Linux `./se
|
||||
For **OrcaRouter's Flash-Next Uncensored IQ3_XXS**, see the [manual compatibility setup](docs/ORCA.md).
|
||||
It needs an explicit packing conversion and is not an installer menu option.
|
||||
|
||||
An **AMD Radeon RX 7900 XT / XTX on Linux** works too (experimental): `./setup.sh --backend hip`, chosen by itself on
|
||||
a PC with no NVIDIA card Strata can use. It installs ROCm without sudo and compiles the engine (one GPU, no images
|
||||
yet). Details: [AMD HIP](docs/AMD_HIP.md).
|
||||
An **AMD Radeon RX 7900 XT / XTX, RX 9070 / 9070 XT or Radeon AI PRO R9700 on Linux** works too (experimental):
|
||||
`./setup.sh --backend hip`, chosen by itself on a PC with no NVIDIA card Strata can use. It installs ROCm without sudo
|
||||
and compiles the engine (one GPU, no images yet). Details: [AMD HIP](docs/AMD_HIP.md).
|
||||
|
||||
## Install
|
||||
|
||||
|
||||
+78
-12
@@ -1,20 +1,22 @@
|
||||
# Experimental AMD HIP backend (gfx1100)
|
||||
# Experimental AMD HIP backend (gfx1100, gfx1201)
|
||||
|
||||
This is a manual Linux source build for the RX 7900 XTX. It is opt-in; the
|
||||
NVIDIA installer and CUDA build remain the default. Other AMD architectures,
|
||||
wave64, Windows HIP, and mixed AMD/NVIDIA execution are outside this contribution.
|
||||
This is a Linux source build for the RX 7900 XT / XTX (RDNA3, gfx1100) and the
|
||||
RX 9070 / 9070 XT / Radeon AI PRO R9700 (RDNA4, gfx1201; see [RDNA4](#rdna4-gfx1201)).
|
||||
It is opt-in; the NVIDIA installer and CUDA build remain the default. Other AMD
|
||||
architectures, wave64, Windows HIP, and mixed AMD/NVIDIA execution are outside this contribution.
|
||||
|
||||
The backend maps the CUDA-shaped runtime and BLAS calls to HIP/hipBLAS, uses
|
||||
RDNA3's signed integer dot instruction for quantized kernels, and supplies
|
||||
RDNA3/RDNA4's signed integer dot instruction for quantized kernels, and supplies
|
||||
wave32 shuffle/packed-byte operations. CUDA-only QSA matrix instructions have
|
||||
an ordered FP32 fallback. Prefill supports both dequantization plus hipBLAS GEMM and opt-in HIP ggml MMQ.
|
||||
An optional, calibrated hipBLASLt path accelerates dense projections on gfx1100.
|
||||
An optional, calibrated hipBLASLt path accelerates dense projections (per-architecture tables in `tools/hip`).
|
||||
This does not claim bit-identical model answers across backends. See
|
||||
[performance settings and evidence](AMD_HIP_PERFORMANCE.md).
|
||||
|
||||
## Install with setup (recommended)
|
||||
|
||||
On Linux with an RX 7900 XT / XTX and the kernel's amdgpu driver (no ROCm install needed):
|
||||
On Linux with an RX 7900 XT / XTX or an RX 9070 / 9070 XT / Radeon AI PRO R9700 and the kernel's amdgpu driver
|
||||
(no ROCm install needed):
|
||||
|
||||
```sh
|
||||
./setup.sh --backend hip
|
||||
@@ -22,11 +24,17 @@ On Linux with an RX 7900 XT / XTX and the kernel's amdgpu driver (no ROCm instal
|
||||
|
||||
- **Detection:** setup finds the card through the kernel's KFD topology. Integrated Radeon GPUs are listed as not
|
||||
supported. On a PC without an NVIDIA card Strata can use, `--backend hip` is chosen automatically.
|
||||
- **ROCm:** installed into `.venv` from AMD's TheRock wheels (~10 GB, no sudo), pinned to the version this backend was
|
||||
tested with (`STRATA_ROCM_VERSION` / `STRATA_ROCM_INDEX` override it). A system ROCm in `/opt/rocm` (or
|
||||
`$ROCM_PATH`) with hipcc and hipBLAS is used instead when present.
|
||||
- **Engine:** compiled on your PC (10-20 minutes, once; again after a `git pull` that changes it). This needs a C++
|
||||
compiler and git (`sudo apt install build-essential git`).
|
||||
- **ROCm:** a system ROCm 7 in `/opt/rocm` (or `$ROCM_PATH`) with hipcc and hipBLAS is used when present. Otherwise
|
||||
(or when it is older than 7.0) ROCm is installed into `.venv` from AMD's TheRock wheels (~10 GB, no sudo), pinned
|
||||
to the version this backend was tested with, from the card family's index: `gfx110X-dgpu` for gfx1100,
|
||||
`gfx120X-all` for gfx1201 (`STRATA_ROCM_VERSION` / `STRATA_ROCM_INDEX` override them).
|
||||
- **Engine:** compiled on your PC for the card's architecture (10-20 minutes, once; again after a `git pull` that
|
||||
changes it, or when you pick a card of another architecture). This needs a C++ compiler and git
|
||||
(`sudo apt install build-essential git`).
|
||||
- **hipBLASLt tuning table:** setup uses `tools/hip/<arch>-hipblaslt-<version>.txt` only when it matches both the
|
||||
card's architecture and the installed hipBLASLt version (read from `hipblaslt-version.h`; 1.2.0 is `100200`).
|
||||
Otherwise it says so and the prompt's dense matrix products use plain hipBLAS (slower prompts, same answers).
|
||||
A table's solution ids are valid only for that pair, and the engine refuses any other table.
|
||||
- **Limits for now:** one GPU, no images, no calibration. The Monitor shows no GPU statistics.
|
||||
|
||||
The rest of setup is the same as on NVIDIA: the model download, the start script, the server.
|
||||
@@ -46,6 +54,13 @@ cmake -S . -B build-hip \
|
||||
cmake --build build-hip --target strata -j2
|
||||
```
|
||||
|
||||
`CMAKE_HIP_ARCHITECTURES` is `gfx1100`, `gfx1201`, or a list such as `"gfx1100;gfx1201"` (one binary for both).
|
||||
gfx1101, gfx1102 and gfx1200 (the same wave32, 64 KiB LDS and dot4 instruction) build with a warning: they have
|
||||
not been validated on a real card here. At startup the engine and `strata-device` compare each GPU they use
|
||||
(`gcnArchName` up to the `:` feature suffix) with the architectures the binary was compiled for, and require
|
||||
wave32. A binary carried to another card stops with the card's name, its architecture and the build's list,
|
||||
instead of failing later with "invalid device function".
|
||||
|
||||
If CMake cannot find the HIP compiler, add
|
||||
`-DCMAKE_HIP_COMPILER=/path/to/rocm/llvm/bin/clang++`. On the Fedora-family test
|
||||
host this was `/usr/lib64/rocm/llvm/bin/clang++`. Use the compiler and libraries
|
||||
@@ -101,6 +116,57 @@ sizes itself automatically and leaves 1 GiB of VRAM headroom.
|
||||
The installer supports this backend (see "Install with setup" above). The vision helper and multi-GPU layer
|
||||
splits are NVIDIA-only for now.
|
||||
|
||||
## RDNA4 (gfx1201)
|
||||
|
||||
The RX 9070 / 9070 XT and the Radeon AI PRO R9700 run the same kernels as gfx1100: wave32, 64 KiB of LDS per
|
||||
workgroup, the signed dot4 instruction (`v_dot4_i32_iu8` through `__builtin_amdgcn_sudot4`) and a 100 MHz wall
|
||||
clock. The first report and patch came from doplxyz (#178). Validated on 2026-09-30 on doplxyz's test machine:
|
||||
an RX 9070 XT 16 GB and a Radeon AI PRO R9700 32 GB (both gfx1201), a Ryzen 9 3900X (16 threads, no AVX-512),
|
||||
47 GB RAM, Ubuntu 24.04 in a KVM/VFIO guest.
|
||||
|
||||
- **Build:** complete HIP build with tests (`-DCMAKE_HIP_ARCHITECTURES=gfx1201 -DSTRATA_BUILD_TESTS=ON
|
||||
-DSTRATA_PREFILL_MMQ=ON`), with the system ROCm 7.14 (hipBLASLt 1.4.1) and with setup's own path: TheRock
|
||||
7.10.0a20251120 wheels from `gfx120X-all` (hipBLASLt 1.2.0) and `build_engine_hip`.
|
||||
- **ctest** (all 45 registered tests, R9700): 42 pass, `hip_prefill_hipblaslt_gemm` skips (no table), and two
|
||||
fail for reasons outside the GPU: `ple_parity` needs the Q2_0 model fixture, `expert_multi_test` needs an
|
||||
AVX-512 CPU. `hip_handoff` needed the volatile ring store: on gfx1201 a plain store to mapped pinned memory
|
||||
stays in the GPU's L2 until the stream is synchronized.
|
||||
- **Arch check:** a gfx1100-only build stops on the gfx1201 card at startup with the message above (engine and
|
||||
`strata-device`).
|
||||
- **End to end** (Coder IQ1_M, setup's arguments: `--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5`,
|
||||
MTP, `--kv int8`, `--max-context 32768`; 128 greedy tokens, system ROCm 7.14, no hipBLASLt table). The answers
|
||||
are coherent and the same on both cards. The live server smoke (`serve/server.py`: web page, models, props,
|
||||
chat, prefix reuse, streaming, the Anthropic endpoint, a sampled code answer) passed 9/9 on each card.
|
||||
|
||||
| card | expert cache | peak VRAM | 4K prompt | 4K decode | 16K prompt | 16K decode |
|
||||
|---|---|---|---|---|---|---|
|
||||
| Radeon AI PRO R9700 32 GB | 12,288 slots, 23.4 GiB | 29.7 GiB | 982 tok/s | 45.5 tok/s | 1,402 tok/s | 48.3 tok/s |
|
||||
| RX 9070 XT 16 GB | 4,931 slots, 9.4 GiB | 15.6 GiB | 782 tok/s | 30.8 tok/s | 1,235 tok/s | 35.4 tok/s |
|
||||
| R9700, TheRock 7.10 wheels | 12,288 slots | | 957 tok/s | 44.2 tok/s | 1,284 tok/s | 43.9 tok/s |
|
||||
|
||||
The engine's resident memory was about 26 GB in every run.
|
||||
- **hipBLASLt:** there is no gfx1201 table in `tools/hip`. A table calibrated on the R9700 at the engine's shapes
|
||||
(hipBLASLt 1.4.1; 0.98-1.76x per GEMM over hipBLAS) changed the end-to-end prompt speed by 0-3%, within noise,
|
||||
so none is shipped: on gfx1201 the plain hipBLAS path is already close.
|
||||
- **Not validated:** gfx1200 (RX 9060 XT; a community report is #176), both cards in one run (layer split),
|
||||
images, long contexts beyond 16K, answer-quality benchmarks.
|
||||
|
||||
## Tuning table
|
||||
|
||||
A hipBLASLt table holds solution ids that are valid only for one GPU architecture and one hipBLASLt version, so it
|
||||
is calibrated on the card with the ROCm the engine runs with. The shipped gfx1100 table's rows are the engine's
|
||||
dense GEMM shapes; to calibrate them for another card or version (a few minutes):
|
||||
|
||||
```sh
|
||||
cmake --build build-hip --target tune_hipblaslt
|
||||
CASES=$(awk 'NR>2 {printf " --case %s,%s,%s,%s,%s", $1, $5, $2, $3, $4}' tools/hip/gfx1100-hipblaslt-100200.txt)
|
||||
./build-hip/tune_hipblaslt $CASES --tuning-out table.txt
|
||||
```
|
||||
|
||||
The file's second line names the architecture and version (`STRATA_HIPBLASLT_TUNING_V1 gfx1201 100401`); save it
|
||||
as `tools/hip/<arch>-hipblaslt-<version>.txt` for setup, or point `STRATA_HIPBLASLT_TUNING` at it. Compare the
|
||||
prompt speed with and without it before keeping it.
|
||||
|
||||
## Original backend validation (PR #94)
|
||||
|
||||
The following is historical validation of the original backend, not a fresh
|
||||
|
||||
@@ -833,8 +833,8 @@ def hipblaslt_table(arch, lib_dirs):
|
||||
have = sorted(p.name for p in (ROOT / "tools" / "hip").glob(f"{arch}-hipblaslt-*.txt"))
|
||||
warn(f"no hipBLASLt tuning table for {arch} with hipBLASLt {ver or '(version unknown)'}"
|
||||
+ (f" (have: {', '.join(have)})" if have else "")
|
||||
+ ": the prompt's dense matrix products use plain hipBLAS (tools/hip/tune_hipblaslt makes a table, "
|
||||
"docs/AMD_HIP_PERFORMANCE.md)")
|
||||
+ ": the prompt's dense matrix products use plain hipBLAS (tools/hip/tune_hipblaslt makes a table: "
|
||||
"docs/AMD_HIP.md, Tuning table)")
|
||||
return None
|
||||
|
||||
|
||||
@@ -1690,7 +1690,7 @@ def main() -> int:
|
||||
help="map the model's experts from its folder instead of copying them into RAM (for a PC with a big "
|
||||
"GPU and little RAM); auto: when the experts would not fit the RAM")
|
||||
ap.add_argument("--backend", choices=["cuda", "hip"],
|
||||
help="cuda = NVIDIA (default), hip = AMD RX 7900 XT/XTX on Linux (experimental; chosen by itself "
|
||||
help="cuda = NVIDIA (default), hip = AMD RX 7900 XT/XTX or RX 9070 / AI PRO R9700 on Linux (experimental; chosen by itself "
|
||||
"when the PC has no NVIDIA card Strata can use)")
|
||||
ap.add_argument("--skip-build", action="store_true", help=argparse.SUPPRESS)
|
||||
a = ap.parse_args()
|
||||
@@ -1805,7 +1805,7 @@ def main() -> int:
|
||||
if not found:
|
||||
fail("no NVIDIA GPU found (nvidia-smi did not answer)",
|
||||
"install the NVIDIA driver from https://www.nvidia.com/drivers and restart the PC"
|
||||
+ ("; an AMD RX 7900 XT/XTX: --backend hip" if amd else ""))
|
||||
+ ("; an AMD RX 7900 XT/XTX or RX 9070 / AI PRO R9700: --backend hip" if amd else ""))
|
||||
if len(found) > 1 or gpu_problem(found[0]) is not None:
|
||||
gpu_table(found)
|
||||
sel = choose_gpus(a, found) # asked when two or more cards can share the model
|
||||
|
||||
Reference in new issue
Block a user