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++

setup: write the gfx1103 exact speed switches for the opt-in install

Niko1221d3c4a6de77a0
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index 155c54acc..473273802 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -66,7 +66,7 @@ On a PC with no NVIDIA card Strata can use, the AMD card is chosen by itself; wi
Adrenalin Edition](https://www.amd.com/en/support/download/drivers.html)). Nothing else: no ROCm or HIP SDK
install, no compiler, no admin rights.
- **Detection:** setup reads the display adapters Windows lists (their PCI ids; the VRAM size from the display
- driver's registry entry). An integrated Radeon is listed as not supported, except the Ryzen AI Max "Strix Halo" (Radeon 8060S / 8050S / 8040S, gfx1151: [STRIX_HALO.md](STRIX_HALO.md)); a Strix Point (890M / 880M, gfx1150), Krackan (860M / 840M, gfx1152) or Phoenix / Hawk Point (780M / 760M, gfx1103) Radeon is named as what it is and not supported.
+ driver's registry entry). An integrated Radeon is listed as not supported, except the Ryzen AI Max "Strix Halo" (Radeon 8060S / 8050S / 8040S, gfx1151: [STRIX_HALO.md](STRIX_HALO.md)); a Strix Point (890M / 880M, gfx1150), Krackan (860M / 840M, gfx1152) or Phoenix / Hawk Point (780M / 760M, gfx1103) Radeon is named as what it is and not supported (on Linux the 780M / 760M has an opt-in build: [RADEON_780M.md](RADEON_780M.md)).
- **Engine:** the ready-made `strata-windows-x64-hip.zip` from the release (built by `tools\hip\build_windows.bat`
for gfx1100, gfx1101, gfx1102, gfx1200, gfx1201, gfx1030 and, from 0.1.40, gfx1151 (Strix Halo, unvalidated on Windows)) goes into `engine\`. It carries the ROCm libraries the
engine loads (`engine\rocm\bin`: the HIP runtime, hipBLAS / rocBLAS / hipBLASLt with their kernels for these cards,
diff --git a/docs/RADEON_780M.md b/docs/RADEON_780M.md
new file mode 100644
index 000000000..bc10836ec
--- /dev/null
+++ b/docs/RADEON_780M.md
@@ -0,0 +1,132 @@
+# Radeon 780M / 760M (Ryzen 7040 / 8040, gfx1103): build from source on Linux
+
+The Radeon 780M (Phoenix / Hawk Point, RDNA3, `gfx1103`) runs Strata through the same HIP backend as the Radeon
+cards in [AMD_HIP.md](AMD_HIP.md). **Status: experimental and opt-in** (`STRATA_EXPERIMENTAL_GFX1103=1`): the port
+is measured on one machine (the numbers below), the maintainers have not run one, and the chip is not Strix Halo.
+Everything here was measured on a Ryzen 7 8745HS (8 cores, AVX-512), Radeon 780M (12 CUs), 60 GB DDR5, GTT at
+50 GiB, Ubuntu kernel 7.0.0-38, `cwsr_enable=0`, engine 0.1.43 built from this tree by hand, Qwen3.8-Flash-Next
+GSQ-RCO Q2_0 with the MTP draft layer, 32K context, Int8 KV.
+
+## 1. What the port changed
+
+- **Native dot4.** gfx1103 was outside the `dp4a` guard in `hip_compat/intrinsics.hpp`, so every quantized dot
+ product ran a four-step byte loop instead of `v_dot4_i32_iu8`. gfx1103 now compiles the native instruction
+ (decode +55% measured: 8.70 -> 13.44 tok/s at a 32K prompt, same greedy token ids as before).
+- **gfx11 WMMA kernels.** gfx1103 was outside the `__gfx11xx__` list of the prompt attention, block scorer,
+ prompt GEMMs and prompt experts, so those fell back to hipBLAS / portable kernels. It is now in the list and
+ the parity tests run on it (`hip_prefill_wmma_gemm_parity`, `hip_prompt_attn_wmma`, `hip_prefill_fused_moe`,
+ `hip_prefill_fused_iq`, `qsa_*`, `hip_gemm_f16_io_parity`, `hip_prefill_mmq_parity`).
+- **A hipBLASLt table** for gfx1103 + hipBLASLt `100401`: `tools/hip/gfx1103-hipblaslt-100401.txt` (section 3).
+- **The gfx1103 exact speed switches** (section 4), written into the config's `env` by setup for the opt-in install
+ (the engine keeps gfx1103 out of its arch defaults, as it does for gfx1150). Whether the chip leaves the
+ `STRATA_EXPERIMENTAL_GFX1103=1` opt-in is the maintainers' call; the numbers here are what they need to make it.
+
+## 2. Toolchain and build
+
+ROCm 10.1 (`rocm/dev-ubuntu-24.04:10.1.0-full`) is what this build and the table were tested with: HIP
+7.16.26385, hipBLASLt 1.4.1 (`100401`), clang 24. Its hipBLASLt carries gfx1103 kernels. setup's TheRock index
+for `gfx110X-all` has no 10.x (its newest is 7.14.0a20260612); the gfx1103 opt-in keeps setup's nightly pin, and
+the wheel route was not exercised by the numbers below - they come from a hand build.
+
+By hand, the steps of [STRIX_HALO.md](STRIX_HALO.md) with the architecture and the paths changed:
+
+```sh
+cmake -S . -B build-780m -G Ninja -DCMAKE_BUILD_TYPE=Release \
+ -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_PREFILL_MMQ=ON \
+ -DCMAKE_HIP_ARCHITECTURES=gfx1103 \
+ -DCMAKE_HIP_COMPILER=/opt/rocm/lib/llvm/bin/clang++ -DCMAKE_HIP_COMPILER_ROCM_ROOT=/opt/rocm \
+ -DCMAKE_PREFIX_PATH=/opt/rocm \
+ "-DCMAKE_HIP_FLAGS=--rocm-path=/opt/rocm --rocm-device-lib-path=/opt/rocm/lib/llvm/amdgcn/bitcode"
+cmake --build build-780m -j 12
+ctest --test-dir build-780m
+```
+
+`ctest` on this machine: 57 passed, 2 skipped (`hip_prefill_hcd_exact_parity`, `hip_prefill_hipblaslt_gemm` -
+they run and pass with the table set), 2 environmental failures (`ple_parity` needs the `bench/micro` fixtures,
+`platform_memory_test` needs a memlock limit above 8 MiB; this host's hard limit is 8 MiB).
+
+The model: a GSQ-RCO Q2_0 pack (`tools/iq_pack.py`, the experts read from the GGUF in place), the PLE table on
+the SSD (`--ple-io direct`), `--mmap-experts --expert-cache 24576`, `--prefill auto`, MTP from
+`tools/mtp_fetch.py` + `mtp_pack.py` + `mtp_rt.py`. GTT must be raised for this model (`ttm.pages_limit`; setup
+changes no host setting).
+
+## 3. The hipBLASLt table
+
+```sh
+export STRATA_HIPBLASLT_TUNING=$PWD/tools/hip/gfx1103-hipblaslt-100401.txt
+```
+
+setup hands it over automatically when the installed hipBLASLt reports 1.4.1. It was calibrated with
+`tools/hip/tune_hipblaslt` over the gfx1150 table's 144 GEMM cases at T = 64..16384 (the same case list the 890M
+run used), two passes, 32 MiB workspace, each row the solution with the lowest median of all six repetitions: 143
+rows (the `bf16 N=1 K=2560 T=64` shape has no candidate faster than plain hipBLAS and is left out), 1.05-23.30x per
+GEMM, geometric mean 4.95x. `hip_prefill_hipblaslt_gemm` reports `fallbacks=0`; `hip_prefill_hcd_exact_parity`
+skips because the table picks no 1176 / 1177 for the HC down GEMM (the gfx1150 table gets the same skip).
+
+## 4. The exact speed switches
+
+With `STRATA_EXPERIMENTAL_GFX1103=1` setup writes the 17 exact switches below into the config's `env`, the same way
+it writes the hipBLASLt table; turning the opt-in off takes them out again. The engine keeps gfx1103 out of its
+arch defaults (`arch_default_env("gfx1103")` stays empty, checked by `arch_defaults_test`). Measured on the 780M:
++13% to +15% prompt with the table (183-186 -> 211-212 tok/s at 4K) and +3.2% decode (16.63 -> 17.17 tok/s, 640
+greedy tokens, 3 of 3 pairs), with the greedy token ids unchanged. They are the gfx1151 table less
+`STRATA_HCD_EXACT` (which needs hipBLASLt solutions 1176 / 1177; the gfx1103 table picks others).
+
+| Switch | What it does |
+|---|---|
+| `STRATA_GDN_HEAD`, `STRATA_GDN_PP=2`, `STRATA_GDN_CONVL2`, `STRATA_GDN_NOY`, `STRATA_CVEC_FUSE` | the prompt's gated-delta-net recurrence and the steered layer's fused write |
+| `STRATA_PF_PAD` | padded GEMM row strides (acts with `STRATA_PF_GEMM`; inert without it) |
+| `STRATA_Q8_PACKED`, `STRATA_Q6_PACKED`, `STRATA_MMVF_ROWS`, `STRATA_ATTN_LANECELL` | decode layouts and kernels (packed Q8_0 / Q6_K weights, 4-row BF16 GEMV, one-cell-per-thread attention scores) |
+| `STRATA_EXPERT_V2`, `STRATA_TSUM`, `STRATA_LFUSE`, `STRATA_GDN_SPLIT`, `STRATA_QFUSE`, `STRATA_PLE_BATCH`, `STRATA_SH_STREAM` | grouped decode experts, butterfly warp sums, fewer launches, the GDN step over four blocks per head, producer-written activation images, batched PLE projections, the shared expert on its own stream |
+
+## 5. Opt-in switches (they change bits)
+
+Opt-in, and the measured wins are below. The prompt levers need the table to pay: with the table, the WMMA set
+read 248 tok/s at 4K against 186 without it, and at 32K 272 against 178. No KL was measured on this chip.
+
+```sh
+export STRATA_HIP_WMMA=1 # prompt attention on matrix cores
+export STRATA_PF_GEMM=1 # the prompt's FP16 projections on the WMMA GEMM
+export STRATA_PA_FAST=1 # prompt attention with single FP16 q and p
+export STRATA_SELECT_WMMA=1 # the block scorer on matrix cores
+export STRATA_PF_FUSED=1 # the prompt experts on matrix cores (neutral at 4K here: 246 vs 248)
+export STRATA_HC_UPMIX=1 # the hyper-connection up projection with its epilogue
+```
+
+## 6. Engine flags
+
+`--spec 2` is the best MTP window on this chip: 15.65 tok/s decode at a 4K prompt against 14.18 at `--spec 4` and
+11.16 at `--spec 6` (greedy, 256 tokens, medians of three interleaved restarts). `--lookup-chain 4` adds +2.3% (3
+of 3 pairs, byte-identical greedy answers) and setup's `--spec-min-p 0.5` is 4.5% slower here than the default;
+`--mtp-q4` is neutral and `--mtp-window 4096` measured +2% at 32K in two pairs (weak). The raw runs are in the
+results folder.
+
+## 7. Measured
+
+bench/bench_vs_llama.py, 256 tokens out, temperature 0 and 0.7, interleaved; each cell one round (medians need
+more rounds - treat these as one-machine samples):
+
+| arm | cell | prompt tok/s | decode tok/s | TTFT s |
+| --- | --- | ---: | ---: | ---: |
+| plain (no table, no opt-ins) | 4K | 90 | 13.1 | 44.9 |
+| plain (no table, no opt-ins) | 32K | 90 | 13.1 | 351 |
+| table + all opt-ins | 4K | 277 | 13.9 | 14.6 |
+| table + WMMA set | 32K | 272 | 14.3 | 118 |
+
+A context ladder on the shipping configuration (131K context, `--spec 2 --lookup-chain 4`) with fresh prompts from
+this checkout's own documentation, 128 greedy tokens each: prefill holds ~310 tok/s to 32K (276.7 at 4K, 314.3 /
+314.6 at 8K / 16K, 308.7 at 32K), then 258.2 at 64K, 215.5 at 96K and 198.5-221.4 at 128K across two runs - that is
+the average over the full read, and the last ~14K tokens at 128K depth read at ~206 tok/s with the prefix cached.
+Decode holds ~16 tok/s to 32K, then 12.1 at 64K and 9.8-9.9 at 96-128K (draft acceptance stays ~70%, so it is
+context cost, not the drafter). Memory stays flat: 38.1 of 50 GiB GTT at 131K. Raw:
+[bench/results/2026-10-12-community-gfx1103](../bench/results/2026-10-12-community-gfx1103/README.md).
+
+## 8. Not tested
+
+- The TheRock-wheel install for gfx1103 (the hand build above is what was measured).
+- The opt-in set beyond one round; KL of any bit-changing switch; other models; contexts past 131K.
+- CUDA and SYCL were not built here (no toolchains on this box); the added gfx1103 macros are undefined for them.
+- Reset stability looks good but is one machine: a 2 h 07 m soak (`tools/serve_load.py`, 924 requests) and the
+ reset-prone combination from 7.10 (partial expert cache + `STRATA_IO_PREFETCH=1` + the adaptive tier) both ran
+ with zero `amdgpu` resets in the kernel log. The known 780M issue ([DETAILS.md](DETAILS.md)) was seen on ROCm
+ 7.10; with `cwsr_enable=0` and this stack it did not reproduce.
diff --git a/setup.py b/setup.py
index 8bb6ef9b2..4ceb60b3a 100644
--- a/setup.py
+++ b/setup.py
@@ -2091,9 +2091,26 @@ ROCM_VERSION_OVERRIDE = os.environ.get("STRATA_ROCM_VERSION") or None
ROCM_VERSION = ROCM_VERSION_OVERRIDE or ROCM_VERSION_DEFAULT # kept for callers that read one version
ROCM_SYSTEM_MIN = (7, 0) # an older system ROCm is passed over for the wheels (gfx1201 needs ROCm 6.4 or newer)
# STRATA_EXPERIMENTAL_GFX1103=1 (opt-in, unsupported): the Radeon 780M / 760M / 740M iGPU (Ryzen 7040 / 8040, gfx1103) is taken
-# as a unified-memory AMD card like Strix Halo, with the portable kernels (no WMMA) (measured on one machine: Ryzen 7 255). Unset: unchanged.
+# as a unified-memory AMD card like Strix Halo, with the native dot4 and gfx11 WMMA kernels, the gfx1103 exact speed switches
+# and a hipBLASLt table when one matches (measured on one machine: Ryzen 7 8745HS). Unset: unchanged.
GFX1103_OPT_IN = os.environ.get("STRATA_EXPERIMENTAL_GFX1103") == "1"
AMD_ARCHS = ("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201", "gfx1030", "gfx1031", "gfx1151") + (("gfx1103",) if GFX1103_OPT_IN else ())
+# The exact (bit-identical) speed switches the engine turns on by default on gfx1151 (src/core/arch_defaults.cpp), less
+# STRATA_HCD_EXACT: that one copies the gfx1151 hipBLASLt table's solutions 1176 / 1177, and the gfx1103 table
+# (tools/hip/gfx1103-hipblaslt-100401.txt) picks others, so it would only report that it cannot run. A gfx1103 install
+# takes them from here (setup writes them into the config's "env"), the same way the table is written: one 780M measured
+# the same greedy answers with all 17 on and with all 17 off, +13% to +15% prompt and decode +3.2% (the decode half
+# alone). The engine keeps gfx1103 out of its own arch defaults (src/core/arch_defaults_test.cpp asserts it stays
+# empty), so this keeps the default path byte-identical.
+GFX1103_SWITCHES = {
+ # prompt
+ "STRATA_GDN_HEAD": "1", "STRATA_GDN_PP": "2", "STRATA_GDN_CONVL2": "1", "STRATA_GDN_NOY": "1",
+ "STRATA_CVEC_FUSE": "1", "STRATA_PF_PAD": "1",
+ # decode
+ "STRATA_Q8_PACKED": "1", "STRATA_Q6_PACKED": "1", "STRATA_MMVF_ROWS": "1", "STRATA_ATTN_LANECELL": "1",
+ "STRATA_EXPERT_V2": "1", "STRATA_TSUM": "1", "STRATA_LFUSE": "1", "STRATA_GDN_SPLIT": "1",
+ "STRATA_QFUSE": "1", "STRATA_PLE_BATCH": "1", "STRATA_SH_STREAM": "1",
+}
AMD_NAMES = {"gfx1100": "AMD Radeon RX 7900 series (gfx1100)", # when sysfs has no product name
"gfx1101": "AMD Radeon RX 7800 XT / 7700 XT (gfx1101)",
"gfx1102": "AMD Radeon RX 7600 / 7600 XT (gfx1102)",
@@ -2344,8 +2361,9 @@ def gfx1103_notes(gpu, ram) -> list[str]:
f"seen by the OS + a {gpu.get('dedicated_gb', 0.0):.1f} GB BIOS carve-out), so the model's experts live in "
"that pool and the expert cache is sized from the memory the OS can give back."]
notes.append(" " + ("The engine is compiled here for gfx1103" if not WIN else "This GPU has no ready-made Windows engine")
+ + " with the native dot4 and WMMA kernels and the 780M's exact speed switches"
+ " (experimental opt-in, STRATA_EXPERIMENTAL_GFX1103=1; measured on one machine, not validated on a real "
- "card): see docs/AMD_HIP.md. This is not a Strix Halo.")
+ "card): see docs/AMD_HIP.md and docs/RADEON_780M.md. This is not a Strix Halo.")
if not WIN and gpu.get("shared_gb", 0) < 0.75 * ram - 1:
notes.append(f"!the GPU can reach {gpu.get('shared_gb', 0):.0f} GB of shared memory (the GTT pool; the kernel's "
"default is about half of the RAM). The kernel option ttm.pages_limit raises it; setup changes no "
@@ -4415,7 +4433,7 @@ def write_config(path: Path, cfg: dict):
SETUP_KEYS = frozenset({"exe", "args", "cwd", "tokenizer", "model_name", "log", "lib_dirs", "port", "backend", "env",
"gpu", "gpus_asked", "layer_split", "host", "api_key", "draft_vocab", "vision"})
SETUP_ENV = frozenset({"STRATA_HIPBLASLT_TUNING", "STRATA_RESIDENT_PIN", "STRATA_NO_ARENA_THP", "STRATA_MMQ_KQ", "STRATA_HC_Q8",
- "STRATA_ROUTE_TAIL_SKIP"}) # the "env" entries setup writes
+ "STRATA_ROUTE_TAIL_SKIP"}) | frozenset(GFX1103_SWITCHES) # the "env" entries setup writes (the gfx1103 switches are setup's too: a re-run refreshes them, they do not linger)
# 0.1.44 added these three, written for Unsloth's files only (unsloth_default_env). In any other model's config they are the
# user's own (STRATA_ROUTE_TAIL_SKIP=0 to turn the tail skip off, STRATA_MMQ_KQ=1 ...): a setup run again keeps them there
# (0.1.44 dropped them with the rest of SETUP_ENV).
@@ -6743,6 +6761,10 @@ def main() -> int:
if GFX1103_OPT_IN and gfx_arch_is(gpu["arch"], "gfx1103") and not WIN:
# the 780M's KFD queues are evicted (a GPU reset) while transparent huge pages move the pinned expert arena
cfg.setdefault("env", {})["STRATA_NO_ARENA_THP"] = "1"
+ # the exact gfx1151 speed switches measured on this chip (GFX1103_SWITCHES): the engine has no arch defaults
+ # for gfx1103, so setup writes them into the config. They are setup's own (SETUP_ENV), so a re-run refreshes
+ # them and turning the opt-in off takes them out again.
+ cfg.setdefault("env", {}).update(GFX1103_SWITCHES)
if resident: # ROCm: large page-locked host allocations can fail or be slow for the CPU; keep the copy pageable
cfg.setdefault("env", {})["STRATA_RESIDENT_PIN"] = "0"
if gpu["count"] > 1 or a.gpu is not None:
diff --git a/tools/test_setup_strix_halo.py b/tools/test_setup_strix_halo.py
index 0fb830512..cd93ac5b7 100644
--- a/tools/test_setup_strix_halo.py
+++ b/tools/test_setup_strix_halo.py
@@ -110,6 +110,23 @@ class ExactArch(unittest.TestCase):
self.assertIn("docs/STRIX_HALO.md", setup.AMD_CARDS)
+class Gfx1103Switches(unittest.TestCase):
+ def test_is_the_gfx1151_defaults_less_hcd_exact(self):
+ """GFX1103_SWITCHES is the gfx1151 arch-default set (src/core/arch_defaults.cpp) minus STRATA_HCD_EXACT, which
+ copies the gfx1151 hipBLASLt table's solutions 1176 / 1177 and so does not apply beside a gfx1103 table. The
+ engine keeps gfx1103 out of its own arch defaults, so setup writes this set."""
+ src = (ROOT / "src/core/arch_defaults.cpp").read_text(encoding="utf-8")
+ tail = src.split("gfx_arch_is_gfx1151(gcn_arch)) return t;", 1)[1]
+ block = tail.rsplit("t = {", 1)[1].split("};", 1)[0] # the gfx1151 switch table
+ gfx1151 = dict(re.findall(r'\{"(STRATA_[A-Z0-9_]+)",\s*"([^"]+)"\}', block))
+ self.assertIn("STRATA_HCD_EXACT", gfx1151) # the parse found the gfx1151 block
+ self.assertEqual(setup.GFX1103_SWITCHES,
+ {k: v for k, v in gfx1151.items() if k != "STRATA_HCD_EXACT"})
+ self.assertNotIn("STRATA_HCD_EXACT", setup.GFX1103_SWITCHES)
+ for k in setup.GFX1103_SWITCHES: # setup's own: a re-run refreshes them
+ self.assertIn(k, setup.SETUP_ENV)
+
+
class PciIds(unittest.TestCase):
def test_strix_halo_id(self):
# pci.ids: one id for every Strix Halo part (8060S, 8050S, 8040S share it; they differ by CU count)
@@ -486,6 +503,7 @@ class IgpuTextIsArchExact(unittest.TestCase):
text = chr(10).join(setup.igpu_notes(self.gpu("gfx1103", "AMD Radeon 780M Graphics"), 61.0))
self.assertIn("gfx1103", text)
self.assertIn("STRATA_EXPERIMENTAL_GFX1103=1", text)
+ self.assertIn("RADEON_780M.md", text)
for bad in ("gfx1151", "Ryzen AI Max", "STRIX_HALO", "Recommended model"):
self.assertNotIn(bad, text)
self.assertNotIn("Strix Halo (gfx1151", text)