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

Strix Halo (gfx1151) on Windows: DeepSeek V4.1-Flash support and the 0.2.6 shared-memory fix

Niko12216c70d4bc5d59
diff --git a/README.md b/README.md
index 3046c044d..0fd9f05d0 100644
--- a/README.md
+++ b/README.md
@@ -63,14 +63,14 @@ disk space.
| 2.00 bpw | 257 GB | about 265 GB |
| 2.25 bpw | 274 GB | about 280 GB |
-Runs on NVIDIA RTX 30, 40 and 50 series (Windows and Linux) and AMD Radeon AI PRO R9700 (Linux). Setup downloads the
-files and the DeepSeek engine, then starts the model.
+Runs on NVIDIA RTX 30, 40 and 50 series (Windows and Linux), AMD Radeon AI PRO R9700 (Linux), and AMD Ryzen AI Max — Strix Halo
+(Windows). Setup downloads the files and the DeepSeek engine, then starts the model.
```sh
strata launch --family deepseek41 --model ist-das-2.00bpw --plan
```
-Measured with the 2.00 bpw set on Strata 0.2.5. Output is the speed of the answer, prompt is how fast Strata reads your input.
+Measured with the 2.00 bpw set on Strata 0.2.5 (Strix Halo: 0.2.7). Output is the speed of the answer, prompt is how fast Strata reads your input.
| Hardware | Output | Prompt |
| --- | ---: | ---: |
@@ -78,6 +78,7 @@ Measured with the 2.00 bpw set on Strata 0.2.5. Output is the speed of the answe
| RTX 3060 12 GB, 46 GB RAM | 9 to 11 tokens/s | about 155 tokens/s (4K) |
| 1x Radeon AI PRO R9700, 251 GB RAM | 21 to 25 tokens/s | 320 to 360 tokens/s (8K) |
| 4x Radeon AI PRO R9700 | 74 to 77 tokens/s | 400 to 450 tokens/s (8K) |
+| Ryzen AI Max+ 395 (Strix Halo), 64 GB shared | 14 to 16 tokens/s (code), 10 to 11 (chat) | 78 tokens/s (4K), 109 tokens/s (8K) |
[Memory, disk and details](docs/DEEPSEEK41.md) · [Release notes](https://github.com/Niko1221/Strata/releases)
diff --git a/apps/host/src/components/GuidedSetup.tsx b/apps/host/src/components/GuidedSetup.tsx
index 519806bc9..2feb0bf34 100644
--- a/apps/host/src/components/GuidedSetup.tsx
+++ b/apps/host/src/components/GuidedSetup.tsx
@@ -26,7 +26,7 @@ const steps = ['Welcome', 'Your model', 'Prepare', 'Make it yours'];
function DeepSeekNote({ version, plan }: { version: NonNullable<ReturnType<typeof nativeCatalogModels>[number]['sizes'][number]>; plan: Record<string, any> | null }) {
void plan; // the plan's own disk line repeats what the version says in on_this_pc
return <div className="engine-warning" role="status"><Icon name="info" size={18}/><div>
- <p>{tr("This is a very large model. The download is {0} GB and it needs about as much free disk space. It runs on one 12 GB graphics card with 46 to 64 GB of RAM, slowly: about 5 to 7 words a second. What does not fit in memory is read from your SSD, so an NVMe drive matters.", [Math.round(version.download_gb)])}</p>
+ <p>{tr("This is a very large model. The download is {0} GB and it needs about as much free disk space. It runs on NVIDIA RTX 30, 40 and 50 cards, on a Radeon AI PRO R9700 (Linux) or on a Ryzen AI Max / Strix Halo PC (Windows); how fast it is depends on the memory and card (the line below says what to expect on this computer). What does not fit in memory is read from your SSD, so an NVMe drive matters.", [Math.round(version.download_gb)])}</p>
{version.on_this_pc ? <p className="small muted">{version.on_this_pc}</p> : null}
<p className="small muted">{tr("You can stop the download and continue later; it picks up where it stopped. Strata warns you here but never blocks you.")}</p>
</div></div>;
diff --git a/docs/AI_REFERENCE.md b/docs/AI_REFERENCE.md
index 8bcd3c8ec..07412b0d0 100644
--- a/docs/AI_REFERENCE.md
+++ b/docs/AI_REFERENCE.md
@@ -29,7 +29,7 @@ not additional top-level families.
| Family | Availability evidence | Catalog and limits |
| --- | --- | --- |
-| DeepSeekV4.1-Flash-1017 | `deepseek41` in `MULTI_FILE_FAMILIES` in [setup.py](../setup.py); Terminal since 0.2.4, desktop app since 0.2.5 | [MODELS.md](MODELS.md#deepseek-v41-flash): IST-DAS 1.75 bpw (239 GB), 2.00 bpw (257 GB) and 2.25 bpw (274 GB), 8K context, a Speed choice (Faster or Full quality). NVIDIA RTX 30, 40 and 50 (Windows, Linux) and AMD Radeon AI PRO R9700 (Linux). Not on Mac, Intel Arc or Strix Halo yet. |
+| DeepSeekV4.1-Flash-1017 | `deepseek41` in `MULTI_FILE_FAMILIES` in [setup.py](../setup.py); Terminal since 0.2.4, desktop app since 0.2.5 | [MODELS.md](MODELS.md#deepseek-v41-flash): IST-DAS 1.75 bpw (239 GB), 2.00 bpw (257 GB) and 2.25 bpw (274 GB), 8K context, a Speed choice (Faster or Full quality). NVIDIA RTX 30, 40 and 50 (Windows, Linux), AMD Radeon AI PRO R9700 (Linux) and Ryzen AI Max / Strix Halo (Windows, gfx1151). Not on Mac, Intel Arc or Strix Halo on Linux yet. |
| Qwen3.8-Flash-Next | Catalog entries in [setup.py](../setup.py), model guides and backend documentation | [MODELS.md](MODELS.md), [QUANTS.md](QUANTS.md), [GYRO.md](GYRO.md), [NVFP4.md](NVFP4.md), [ORCA.md](ORCA.md) |
| Qwen3.6-35B-A3B | `qwen36` in `OWN_PATH_FAMILIES` in [setup.py](../setup.py) | [QWEN36.md](QWEN36.md): NVIDIA and AMD; not the Intel or Mac engine |
diff --git a/docs/DEEPSEEK41.md b/docs/DEEPSEEK41.md
index aba0e8874..9eea1feaa 100644
--- a/docs/DEEPSEEK41.md
+++ b/docs/DEEPSEEK41.md
@@ -39,6 +39,13 @@ perplexity +7.3% (code +3.2%, agent work +2.2%). IQ1_M: perplexity +21% (KL 0.21
| IQ4_NL: `DeepSeek-V4.1-Flash-Engram-IQ4_NL.gguf` | 111 GB | the 4-bit Engram lookup table the model reads from RAM or SSD. Not a model to pick: all three sets use this one file, and it is already in their download sizes |
| DSpark drafter (Q8_0) | 8 GB | the small draft model (Unsloth) |
+**On a Ryzen AI Max "Strix Halo" (Windows)** the graphics chip and the CPU share one pool of RAM, so the engine counts it once: on
+the 64 GB box about 49 GB of the experts stay in memory (the dense weights and 8 GB for Windows and the desktop aside) and the
+other 83 GB of the 2.00 set are read from the SSD. Measured there (2.00 bpw, default Faster mode, DSpark auto): answers 14-16
+tokens/s on code and 10-11 on chat; a 4,000-token prompt 78 tokens/s, 8,000 tokens 109. The tested driver is AMD Adrenalin 26.10.1
+(driver 32.0.32015.7029); the 2025-03 driver failed at 32K context, so 26.10.1 is the minimum to use. The 32K and 64K contexts work
+on it; an 8-hour 32K soak passed on this box.
+
121 + 111 + 8 = 239 GB for 1.75; 138 + 111 + 8 = 257 GB for 2.00; 155 + 111 + 8 = 274 GB for 2.25.
Measured: an RTX 5070 (12 GB) with 64 GB of RAM and a 3.6 GB/s NVMe drive answers at about 4.7 tokens/s and reads prompts at 121
@@ -108,7 +115,8 @@ says so. The RAM store (`--ssd-cache`) sizes itself when the model starts, so th
DeepSeek's engine, `strata-dsv41`, is a separate download from the Strata engine: when you choose DeepSeek, setup (or `strata launch`) fetches the
package for your computer from the signed update feed (resumable, signature and every file checked) and installs it in `engine-dsv41/` beside
`engine/`. The Qwen engine's files are never changed. If the feed has no package for your graphics card, setup says so in plain words and stops before
-anything big is downloaded.
+anything big is downloaded. The Windows AMD package (`...-windows-x86_64-hip-rdna3`) carries the ROCm 10.2 runtime and the
+rocBLAS / hipBLASLt kernels for gfx1151 in `rocm/bin`, which Strata puts on the engine's library path.
### Getting the engine by hand
diff --git a/docs/MODELS.md b/docs/MODELS.md
index 17206ac8e..db536a5c6 100644
--- a/docs/MODELS.md
+++ b/docs/MODELS.md
@@ -70,9 +70,13 @@ you have the disk. Perplexity is measured on a fixed set of 4,995 test texts; lo
| --- | --- |
| NVIDIA RTX 30, 40 and 50 series, 12 GB or more | Windows, Linux |
| AMD Radeon AI PRO R9700 | Linux |
+| AMD Ryzen AI Max (Strix Halo, gfx1151, 64 GB or more shared) | Windows |
-Tested on an RTX 3060 (Linux), an RTX 5070 (Windows) and four R9700 cards (Linux). The RTX 30 kernels were also checked
-on an RTX A4000. Windows on RTX 30 and the RX 9070 are built but were not run. Mac and Strix Halo do not run it yet.
+Tested on an RTX 3060 (Linux), an RTX 5070 (Windows), four R9700 cards (Linux) and a Ryzen AI Max+ 395 with 64 GB (Windows:
+14 to 16 tokens a second on code with the default Faster mode, 10 to 11 on chat, 78 tokens a second on a 4K prompt and 109 on
+8K). The RTX 30 kernels were also checked on an RTX A4000. Windows on RTX 30 and the RX 9070 are built but were not run. Mac
+and Strix Halo on Linux do not run it yet; on Strix Halo Windows the graphics memory is the RAM, so most of the experts are
+read from the SSD and an NVMe drive matters.
**What you need:** a graphics card with 12 GB or more, 46 GB of RAM at least (64 GB is the tested comfortable size),
an NVMe SSD, and the disk space above. Setup warns when disk or RAM is short and does not stop you.
diff --git a/docs/STRIX_HALO.md b/docs/STRIX_HALO.md
index 551fdacde..11fdc77fc 100644
--- a/docs/STRIX_HALO.md
+++ b/docs/STRIX_HALO.md
@@ -4,10 +4,13 @@ This page is for people with a Ryzen AI Max "Strix Halo" PC (Radeon 8060S / 8050
shared by the CPU and the GPU). Strata runs there through the same HIP backend as the Radeon cards in [AMD_HIP.md](AMD_HIP.md).
**Status: experimental.**
-DeepSeek V4.1-Flash does not run on Strix Halo yet. It runs in the app and the Terminal on NVIDIA RTX 30, 40 and 50 cards and on the Radeon AI
-PRO R9700 ([MODELS.md](MODELS.md#deepseek-v41-flash)).
+**DeepSeek V4.1-Flash runs here on Windows** (since 0.2.7): its own engine package is built for gfx1151 and the official IST-DAS
+1.75 / 2.00 / 2.25 bpw sets run through it. Measured on the 64 GB box with 2.00 bpw and the default Faster mode: answers 14-16
+tokens/s on code, 10-11 on chat; a 4K prompt 78 tokens/s and an 8K prompt 109. The graphics chip and the CPU share the RAM, so the
+engine counts it once and reads the rest of the experts from the SSD. [DeepSeek on Strix Halo](#deepseek-v41-flash) has the details,
+the driver it needs and the limits.
-> **On this page:** [Quick start](#quick-start) · [What the engine does differently](#what-the-engine-does-differently) ·
+> **On this page:** [Quick start](#quick-start) · [DeepSeek](#deepseek-v41-flash) · [What the engine does differently](#what-the-engine-does-differently) ·
> [1. Toolchain](#1-the-toolchain-no-root-needed) · [2. Engine](#2-the-engine) · [3. Tuning table](#3-the-prompt-table-and-running) ·
> [4. Defaults](#4-what-is-on-by-default-on-gfx1151) · [5. Opt-in](#5-what-is-not-on-by-default-it-changes-bits) ·
> [5b. Desktop and RAM](#5b-the-desktop-the-ram-and-a-discrete-card-beside-the-strix-halo-linux) · [6. Measured](#6-measured) ·
@@ -26,6 +29,40 @@ Packaged engines carry the matching hipBLASLt tuning table for gfx1151 and selec
PCI ID `1002:1586`; other integrated Radeon chips have separate support limits. Unified memory is counted once. Setup does not
change BIOS or kernel settings. The manual Linux toolchain below is for reproduction and builds, not a prerequisite for the app.
+DeepSeek V4.1-Flash comes with its own engine package on Windows and needs nothing extra: pick the model and the app or `strata launch`
+downloads it ([DeepSeek on Strix Halo](#deepseek-v41-flash)).
+
+## DeepSeek V4.1-Flash
+
+The model runs through its own engine, `strata-dsv41`, as on the other platforms ([DEEPSEEK41.md](DEEPSEEK41.md)); on Windows the
+package is the AMD one built for gfx1151 (`strata-dsv41-...-windows-x86_64-hip-rdna3`), downloaded when you choose the model.
+
+| | |
+| --- | --- |
+| Sets | IST-DAS 1.75 bpw (239 GB download), 2.00 bpw (257 GB), 2.25 bpw (274 GB); the n-gram table is shared |
+| Memory | one pool: about 49 GB of the 2.00 set's 132 GB of experts stay in RAM beside the dense weights and 8 GB kept for Windows; the rest is read from the SSD |
+| Driver | AMD Adrenalin 26.10.1 (driver 32.0.32015.7029) is the tested version, and the minimum to use: the 2025-03 driver failed at 32K context |
+| Context | 8K default; 32K and 64K work (an 8-hour 32K soak passed) |
+| Disk | the sets above; keep the files on the NVMe drive, they are read while it answers |
+
+Measured on the maintainers' box (Ryzen AI Max+ 395, 64 GB, Windows 11, 2.00 bpw, Faster mode, DSpark auto, engine 0.1.51):
+
+| Workload | Result |
+| --- | --- |
+| Code answer | 14-16 tokens/s |
+| Chat answer | 10-11 tokens/s |
+| 4K prompt | about 78 tokens/s |
+| 8K prompt | about 109 tokens/s |
+| Stability | 100-request, 1-hour (243 requests) and 8-hour 32K (646 requests) soaks passed on the engine line this package is built from |
+
+How it uses the memory: the GPU's expert tier and the RAM store are the same memory, so the engine keeps a store of about 23 GB,
+sized after the weights are on the GPU, and reads the other experts from the model files when a word needs them. It does not copy the
+CPU lane's experts into RAM on an integrated GPU: on this box that copy overcommits the shared memory and an 8K prompt stalls (found
+on Strix on 2026-10-25, fixed for 0.2.7; `DS4_COPY_ALL=1` forces the old behaviour for a test). `--ssd-cache N` sets the store size.
+
+Known limits: a 64 GB machine was tested. A 32 GB Strix Halo gets a much smaller store and is slower, and setup says so (it never
+refuses). Linux on Strix Halo has no DeepSeek engine package yet. WSL is not supported: the AMD engines hang there.
+
## What the engine does differently
- **Unified memory.** The GPU's "VRAM" is the GTT pool of the same RAM. `device_free_bytes()` (the figure `--expert-cache auto`
diff --git a/packaging/README.md b/packaging/README.md
index 651022101..452e272a4 100644
--- a/packaging/README.md
+++ b/packaging/README.md
@@ -34,10 +34,19 @@ Each row is an OS, CPU ABI and backend. A row is `qualified` only after the acce
| `windows-x86_64-sycl` | none | none | Gated. No native Windows SYCL path exists upstream. |
| `macos-x86_64-*` | none | none | Unsupported. The macOS engine is Apple Silicon only. |
-**DeepSeek V4.1-Flash.** Three packages carry engine 0.1.50 with the DeepSeek engine `strata-dsv41`: Windows NVIDIA `cuda13`,
-Linux NVIDIA `cuda13` and Linux AMD `rx9070`. All other packages carry engine 0.1.50. Build `strata-dsv41` with
-`packaging/build_dsv41_cuda.sh` (Linux) or `packaging/build_dsv41_windows.bat` (Windows), then package it with
-`package_engine.py --require-dsv41`. The DeepSeek engine can also be a separate download (feed member `dsv41`, see [UPDATES.md](UPDATES.md#the-feed)).
+**DeepSeek V4.1-Flash.** The signed feed's `dsv41` member carries the DeepSeek engine `strata-dsv41` as its own package: Windows
+NVIDIA `cuda13`, Linux NVIDIA `cuda13`, Linux AMD `rx9070`, and since 0.2.7 Windows AMD `rdna3` (Ryzen AI Max, gfx1151). All other
+engine packages carry no DeepSeek engine. Build `strata-dsv41` with `packaging/build_dsv41_cuda.sh` (Linux) or
+`packaging/build_dsv41_windows.bat` (Windows), then package it with `package_engine.py --require-dsv41`; or pack it as the separate
+download (`feed_tool.py pack-engine --prefix strata-dsv41`, [UPDATES.md](UPDATES.md#the-feed)).
+
+Windows AMD (gfx1151): build `strata-dsv41` with `tools\dsv41\win\build_hip_win.bat` (the ROCm venv, default `gfx1151`) and stage
+it with the ROCm runtime the Qwen Windows `rdna3` package already carries: the HIP and C++ runtime DLLs beside the program,
+`rocm/bin` (hipBLAS / rocBLAS / hipBLASLt and their imports), `rocm/bin/rocblas/library/gfx1151`,
+`rocm/bin/hipblaslt/library/gfx1151`, `rocm/.kpack/blas_lib_gfx1151.kpack`, `rocm/licenses`, and a `BUILD.json` that names
+`"lib_dirs": ["rocm/bin"]`. Package it with `package_engine.py --backend hip --platform windows-x86_64 --arch gfx1151 --entrypoint
+strata-dsv41.exe --variant rdna3` (about 240 MiB, 280 files). Strata puts the package's `lib_dirs` on the engine's library path
+(`strata_control/dsv41_engine.py lib_dirs`), so the HIP runtime is found the same way the Qwen engine finds it.
Cross-compilation is not attempted for the desktop app. Tauri bundles are per OS, and the Windows installer is built on Windows.
The Python contracts, the owner transport, the checks and the engine build recipes are portable.
diff --git a/setup.py b/setup.py
index 440bfc181..ab3b8a8d8 100644
--- a/setup.py
+++ b/setup.py
@@ -7878,7 +7878,7 @@ def dsv41_engine_pending(eng: Path) -> bool:
def dsv41_manual_steps(eng: Path) -> str:
- return (f"If you downloaded the DeepSeek engine package from the release page (the file strata-dsv41-...-{'windows' if WIN else 'linux'}-....{'zip' if WIN else 'tar.gz'}), "
+ return (f"If you downloaded the DeepSeek engine package from the release page (the file strata-dsv41-...-{'windows' if WIN else 'linux'}-....tar.gz), "
f"run the same command again with --dsv41-package PATH-OF-THE-FILE (strata launch accepts it too), or put the file in {dsv41_engine_dir(eng)} "
"and run it again. Strata checks it before it is used.")
@@ -8166,12 +8166,14 @@ def install_dsv41(a, family, gpu, hip, amd, cuda_tk, multi, port, ram, adopted,
and not (os.environ.get("STRATA_DSV41_EXE") or "").strip() and exe.parent.parent == dsv41_engine_dir(eng)):
exe = upgrade_dsv41_engine(eng, exe) # an installed package older than the signed feed's: updated next to it, switched after it starts
if exe is not None and exe.parent != Path(eng):
- lib_dirs = [*lib_dirs, str(exe.parent)] # its own package carries the libraries it needs
+ from strata_control import dsv41_engine
+ lib_dirs = [*lib_dirs, *dsv41_engine.lib_dirs(exe)] # its own package, and the rocm/bin an AMD package keeps the ROCm DLLs in
if exe is None:
if os.environ.get("STRATA_VERBOSE") == "1" or "--verbose" in sys.argv:
say(" Details for developers: build it with cmake -DSTRATA_BUILD_DSV41=ON and point STRATA_DSV41_EXE at it.")
fail("DeepSeek's engine is not available for this computer yet",
- "Supported graphics cards: NVIDIA RTX 30, 40 and 50 series, and the Radeon AI PRO R9700. " + dsv41_manual_steps(eng)
+ "Supported graphics cards: NVIDIA RTX 30, 40 and 50 series, the Radeon AI PRO R9700, and a Ryzen AI Max (Strix Halo) on "
+ "Windows with the AMD DeepSeek engine package. " + dsv41_manual_steps(eng)
+ " Or update Strata later (a newer version may add your card), or pick another model. Nothing has been downloaded.")
ok(f"engine: {exe}")
diff --git a/src/dsv41/ds4_model.cu b/src/dsv41/ds4_model.cu
index b8d3991d8..dbd3e58b4 100644
--- a/src/dsv41/ds4_model.cu
+++ b/src/dsv41/ds4_model.cu
@@ -4578,6 +4578,12 @@ struct Model::Impl {
bool cpu_lane_fits_ram() const {
if (!pk.gguf || o.mmap_experts >= 0 || o.ssd_cache_gb >= 0.0 || std::getenv("DS4_STORE_GB") || std::getenv("DS4_COPY_GB")) return false;
if (const char* v = std::getenv("DS4_COPY_ALL")) return std::atoi(v) != 0 && ram_avail() != ~uint64_t{0};
+ // An integrated GPU's experts are already in this same RAM (and, above the RAM, in the page file it commits): copying
+ // the CPU lane's in beside them takes the pages the GPU's experts live on. Measured on Strix Halo (64 GB, 2.00 set):
+ // 82 GB of experts on the GPU, then 53 GB copied in, and an 8K prompt did not finish in 11 minutes (the in-place path is
+ // what the 8-hour soak ran). DS4_COPY_ALL=1 still forces it; DS4_COPY_ALL=0 leaves it off everywhere.
+ for (const Dev& d : devs)
+ if (commit_charged(d)) return false;
const uint64_t avail = ram_avail();
if (avail == ~uint64_t{0}) return false;
double exp_b = 0, room = 0, other_b = 0;
diff --git a/strata_cli/launch/runner.py b/strata_cli/launch/runner.py
index 588534f96..7b322be66 100644
--- a/strata_cli/launch/runner.py
+++ b/strata_cli/launch/runner.py
@@ -2092,7 +2092,8 @@ class Runner:
if old:
self.notices.append("DeepSeek runs on this install's own engine package, not the one the model's earlier settings named.")
libs = [d for d in (cfg.get("lib_dirs") or []) if "engine-dsv41" not in str(d)]
- cfg["lib_dirs"] = [*libs, str(Path(found).parent)] # its own folder carries the libraries it needs
+ from strata_control import dsv41_engine
+ cfg["lib_dirs"] = [*libs, *dsv41_engine.lib_dirs(found)] # its own folder, and rocm/bin for a Windows HIP package
def upgrade_dsv41_engine(self, found: Path) -> Path:
"""The installed DeepSeek engine package is older than the signed feed's: fetch, check and start the newer one next to it and switch to it
diff --git a/strata_control/dsv41_engine.py b/strata_control/dsv41_engine.py
index b547443c2..94125fae8 100644
--- a/strata_control/dsv41_engine.py
+++ b/strata_control/dsv41_engine.py
@@ -38,6 +38,29 @@ def find(dest: Path) -> Path | None:
ARCHIVE_SUFFIXES = (".tar.gz", ".tar.xz", ".zip")
MAX_UNPACKED = 8 << 30 # a DeepSeek engine package is under a GB; this only stops an archive that unpacks into something huge
+LIB_VAR = "PATH" if os.name == "nt" else "LD_LIBRARY_PATH"
+
+
+def lib_dirs(exe: str | os.PathLike) -> list[str]:
+ """The folders that must be on the library path when this engine starts: its own package folder, then the folders the package's
+ BUILD.json names. A Windows HIP package keeps the ROCm DLLs (hipBLAS / rocBLAS and their imports) in ``rocm/bin``, which is also
+ where rocBLAS's kernel folders and ``../.kpack`` are laid out from (strata_control/engine_component.py package_lib_dirs). A CUDA
+ package keeps everything beside the program, so this is its folder alone."""
+ from strata_control import engine_component as ec
+ try:
+ return ec.package_lib_dirs(Path(exe).parent)
+ except OSError:
+ return [str(Path(exe).parent)]
+
+
+def start_env(exe: str | os.PathLike, environ: dict | None = None) -> dict:
+ """`environ` (the process's own by default) with this package's folders first on PATH (Windows) / LD_LIBRARY_PATH."""
+ env = dict(os.environ if environ is None else environ)
+ dirs = [d for d in lib_dirs(exe) if Path(d).is_dir()]
+ if dirs:
+ env[LIB_VAR] = os.pathsep.join(dirs + ([env[LIB_VAR]] if env.get(LIB_VAR) else []))
+ return env
+
def pending(dest: Path) -> list[Path]:
"""Packages the person put in `dest` (engine-dsv41/) by hand: strata-dsv41-*.tar.gz / .zip, newest first."""
@@ -186,10 +209,12 @@ def source_reachable(source: str, timeout: float = 10.0) -> bool:
def _test_start(exe: Path, timeout: float = 120.0) -> tuple[bool, str]:
- """The new engine starts: `strata-dsv41 --version` runs, loads its libraries and names itself (it needs no graphics card and no model)."""
+ """The new engine starts: `strata-dsv41 --version` runs, loads its libraries and names itself (it needs no graphics card and no model).
+ The package's own folders go on the library path first: a Windows HIP package carries the ROCm runtime it loads in rocm/bin."""
import subprocess
try:
- done = subprocess.run([str(exe), "--version"], capture_output=True, text=True, timeout=timeout, cwd=str(Path(exe).parent))
+ done = subprocess.run([str(exe), "--version"], capture_output=True, text=True, timeout=timeout, cwd=str(Path(exe).parent),
+ env=start_env(exe))
except (OSError, subprocess.SubprocessError) as exc:
return False, f"it could not be started ({exc})"
first = ((done.stdout or "").strip().splitlines() or [""])[0]
diff --git a/strata_control/dsv41_fit.py b/strata_control/dsv41_fit.py
index 8de951c2d..e1bd201f9 100644
--- a/strata_control/dsv41_fit.py
+++ b/strata_control/dsv41_fit.py
@@ -77,6 +77,11 @@ ISTA_DENSE_ON_GPU_GB = 4.5 # what a card holds of them with a 12 GB c
ISTA_MEASURED = ("an RTX 5070 (12 GB) with 64 GB of RAM and a 3.6 GB/s NVMe drive: answers about 4.7 tokens a second, a 4,000-token prompt "
"read at 121 tokens a second; an RTX 3060 (12 GB) with 46 GB of RAM: about 7.2 tokens a second; four Radeon AI PRO R9700 cards: "
"about 31 tokens a second")
+# A unified-memory APU (Ryzen AI Max "Strix Halo", gfx1151, Windows): the graphics chip and the CPU share one pool of RAM, so the
+# engine's expert tiers are one pool too. The measured 64 GB box: 2.00 bpw, Faster (5 experts), DSpark auto, Adrenalin 26.10.1.
+UMA_RESERVE_GB = 8.0 # kept for Windows, the desktop and the engine's buffers (measured min free 6.5-11 GB)
+UMA_MEASURED = ("a Ryzen AI Max+ 395 (Radeon 8060S, 64 GB shared with the CPU) on Windows: answers 14-16 tokens a second on code in the "
+ "default Faster mode (5 experts) and 10-11 on chat; a 4,000-token prompt 77-81 tokens a second, 8,000 tokens 108-111")
def variant(model: str | None) -> dict | None:
@@ -86,6 +91,12 @@ def variant(model: str | None) -> dict | None:
return next((v for k, v in ISTA_SETS.items() if k.lower() == str(model).lower()), None)
+def uma_card(cards: list[dict] | None) -> dict | None:
+ """The integrated Radeon a run uses, when the graphics memory is the PC's RAM (Ryzen AI Max, gfx1151): setup marks it `uma` (and
+ `integrated`); a discrete card never is. None on every other computer."""
+ return next((c for c in cards or [] if c.get("uma") or c.get("integrated")), None)
+
+
def variant_key(model: str | None) -> str | None:
return next((k for k in ISTA_SETS if k.lower() == str(model or "").lower()), None)
@@ -245,6 +256,64 @@ def _plan_ista(model: str, cards: list[dict] | None, ram_gb: float | None, disk_
return out
+def _plan_uma(key: str, model: str, card: dict, ram_gb: float | None, disk_free_gb: float | None, context: int) -> dict[str, Any]:
+ """plan() for an official IST-DAS set on a unified-memory APU (Ryzen AI Max, gfx1151, Windows): the graphics memory is the RAM,
+ counted once. The engine holds what fits beside the dense weights and the reserve and reads the rest from the SSD; the numbers in
+ UMA_MEASURED are the measured 64 GB box. Never a refusal."""
+ v = ISTA_SETS[key]
+ total = float(ram_gb or 0.0) or float(card.get("vram_gb") or 0.0)
+ expert_gb = v["experts_gb"] / EXPERTS
+ set_gb = v["set_bytes"] / GB
+ download = ista_download_bytes(model) / GB
+ room = max(0.0, total - ISTA_DENSE_GB - UMA_RESERVE_GB)
+ resident = min(float(v["experts_gb"]), room)
+ streamed = max(0.0, float(v["experts_gb"]) - room)
+ in_mem = int(resident / expert_gb)
+ need_disk = download + DISK_HEADROOM_GB
+ out: dict[str, Any] = {
+ "variant": model, "cards": [{"index": card.get("index"), "name": card.get("name"), "vram_gb": _round1(total),
+ "layers": [0, LAYERS - 1], "dense_gb": _round1(ISTA_DENSE_GB),
+ "experts_gb": _round1(resident), "experts": in_mem}],
+ "experts_total": EXPERTS, "experts_in_vram": in_mem, "vram_experts_gb": _round1(resident), "cpu_experts_gb": 0.0,
+ "weights_gb": _round1(set_gb), "experts_gb": _round1(v["experts_gb"]), "dense_gb": _round1(ISTA_DENSE_GB),
+ "engram_gb": _round1(ISTA_ENGRAM_BYTES / GB), "download_gb": _round1(download), "tp": 1, "args": [],
+ "measured": UMA_MEASURED, "lines": [], "warnings": [], "ram_gb": ram_gb, "context": context,
+ "disk_total_gb": v["disk_total"], "disk_need_gb": _round1(need_disk),
+ "disk_ok": None if disk_free_gb is None else disk_free_gb >= need_disk,
+ "uma": True, "streamed_gb": _round1(streamed), "ram_needed_gb": _round1(total), "spill_gb": _round1(streamed),
+ "spare_ram_gb": _round1(max(0.0, total - ISTA_DENSE_GB - v["experts_gb"] - UMA_RESERVE_GB)),
+ }
+ lines, warns = out["lines"], out["warnings"]
+ lines.append(f"DeepSeek-V4.1-Flash, {v['title']}: a {download:.0f} GB download ({set_gb:.0f} GB of model, "
+ f"{ISTA_ENGRAM_BYTES / GB:.0f} GB n-gram table, {ISTA_DSPARK_BYTES / GB:.0f} GB drafter). Quality: {v['quality']}.")
+ lines.append("The n-gram table stays on the SSD and is read a few rows for each word: use an NVMe drive for the model files (a slow "
+ "disk makes every word slower). The same table serves every IST-DAS set, so installing another one downloads it once.")
+ name = card.get("name") or "the built-in Radeon"
+ lines.append(f"{name} shares this PC's RAM: one pool of {total:.0f} GB holds the model and the graphics memory together. About "
+ f"{resident:.0f} GB of the {float(v['experts_gb']):.0f} GB of experts stay in memory beside {ISTA_DENSE_GB:.1f} GB of "
+ f"dense weights and {UMA_RESERVE_GB:.0f} GB kept for Windows; the other {streamed:.0f} GB are read from the SSD while it answers.")
+ lines.append(f"Measured on this kind of PC: {UMA_MEASURED}.")
+ if streamed > 0.5:
+ lines.append("Keep the model files on the NVMe drive and the machine otherwise idle while it answers: every word reads experts from it.")
+ if streamed <= 0.5:
+ out["verdict"] = "fits"
+ elif total >= float(v.get("ram_ok_gb") or 0):
+ out["verdict"] = "tight"
+ if total < 48:
+ warns.append(f"This PC has {total:.0f} GB of memory shared with the graphics chip and the model was measured on 64 GB: with less, "
+ "more experts come from the SSD and each word takes longer. It still runs.")
+ else:
+ out["verdict"] = "spills"
+ warns.append(f"This PC has {total:.0f} GB of memory shared with the graphics chip and the model was measured on 64 GB: most of its "
+ "experts are read from the SSD while it answers, so it is slow (a word can take seconds). The smaller 1.75 bpw set "
+ "suits this computer better. It is still allowed.")
+ if disk_free_gb is not None and disk_free_gb < need_disk:
+ warns.append(f"The download needs about {need_disk:.0f} GB of free disk space and {disk_free_gb:.0f} GB are free where the files go. "
+ "Use --models-dir on a bigger drive, or --gguf-dir for files you already have.")
+ out["words"] = " ".join(lines)
+ return out
+
+
def plan(cards: list[dict] | None, ram_gb: float | None, disk_free_gb: float | None = None, context: int = 8192,
vendor: str | None = None, model: str | None = None) -> dict[str, Any]:
"""Where the model goes on this computer. `cards`: the graphics cards ({"index", "name", "vram_gb", ...}, as gpu_fit takes them),
@@ -253,8 +322,14 @@ def plan(cards: list[dict] | None, ram_gb: float | None, disk_free_gb: float | N
Keys: cards (per card: index, name, vram_gb, layers, dense_gb, experts_gb, experts), experts_in_vram, experts_total, vram_experts_gb,
cpu_experts_gb, ram_needed_gb, spill_gb, spare_ram_gb, verdict (fits / tight / spills / unknown / no_card), tp, args,
- download_gb, engram_gb, disk_need_gb, disk_ok, lines (plain words, one idea each), warnings (the risks, plainly), measured."""
+ download_gb, engram_gb, disk_need_gb, disk_ok, lines (plain words, one idea each), warnings (the risks, plainly), measured.
+ On a unified-memory APU (Ryzen AI Max, gfx1151) the plan counts one pool: also `uma: True` and `streamed_gb` (the experts
+ read from the SSD), tp 1 and no args (nothing to split between cards)."""
if variant(model):
+ mine = gpu_fit.for_vendor(list(cards or []), vendor)[0] if vendor else list(cards or [])
+ card = uma_card(mine)
+ if card is not None:
+ return _plan_uma(variant_key(model), model, card, ram_gb, disk_free_gb, context)
return _plan_ista(variant_key(model), cards, ram_gb, disk_free_gb, context, vendor)
keep, ignored = gpu_fit.usable_cards(gpu_fit.for_vendor(list(cards or []), vendor)[0]) if vendor else gpu_fit.usable_cards(list(cards or []))
keep = [c for c in keep if float(c.get("vram_gb") or 0) >= SMALLEST_CARD_GB]
diff --git a/tests/terminal/test_dsv41_engine.py b/tests/terminal/test_dsv41_engine.py
index 26c047564..3158422e0 100644
--- a/tests/terminal/test_dsv41_engine.py
+++ b/tests/terminal/test_dsv41_engine.py
@@ -199,5 +199,50 @@ class ManualPackage(Dsv41Engine):
self.assertEqual([p.name for p in dsv41_engine.pending(dest)], [archive.name])
+class HipPackageLibraryPath(unittest.TestCase):
+ """A Windows HIP DeepSeek package keeps the ROCm DLLs in rocm/bin (hipBLAS / rocBLAS), exactly like the Qwen rdna3 engine package,
+ so the engine's folder list must carry it or a clean PC starts with 0xC0000135 (found on strix, 2026-10-25)."""
+
+ def package(self, build_json=None) -> Path:
+ tmp = tempfile.TemporaryDirectory(prefix="strata-dsv41-hip-")
+ self.addCleanup(tmp.cleanup)
+ folder = Path(tmp.name) / "0.1.51-windows-x86_64-hip-rdna3"
+ (folder / "rocm" / "bin").mkdir(parents=True)
+ (folder / "rocm" / "bin" / "rocblas.dll").write_bytes(b"x")
+ (folder / EXE).write_bytes(b"stub")
+ if build_json is not None:
+ (folder / "BUILD.json").write_text(json.dumps(build_json), encoding="utf-8")
+ return folder
+
+ def test_rocm_bin_comes_after_the_package_folder(self):
+ folder = self.package({"lib_dirs": ["rocm/bin"]})
+ self.assertEqual(dsv41_engine.lib_dirs(folder / EXE), [str(folder), str(folder / "rocm" / "bin")])
+ env = dsv41_engine.start_env(folder / EXE, {"PATH": "C:\\Windows"})
+ first = env["PATH"].split(os.pathsep)[:2]
+ self.assertEqual(first, [str(folder), str(folder / "rocm" / "bin")])
+
+ def test_a_cuda_package_needs_only_its_folder(self):
+ folder = self.package(None)
+ self.assertEqual(dsv41_engine.lib_dirs(folder / EXE), [str(folder)])
+
+ def test_a_package_folder_missing_from_disk_is_skipped(self):
+ folder = self.package({"lib_dirs": ["rocm/bin", "nope"]})
+ self.assertEqual(dsv41_engine.lib_dirs(folder / EXE), [str(folder), str(folder / "rocm" / "bin")])
+
+ def test_the_feed_offers_a_windows_hip_package_to_strix_halo_only(self):
+ from strata_control import feed as feedmod
+ p = {"version": "0.1.51", "platform": "windows-x86_64", "backend": "hip", "variant": "rdna3", "archs": ["gfx1151"],
+ "min_driver": {}, "min_runtime": None, "build_id": "dsv41-hip", "format": "tar.gz", "url": "strata-dsv41-0.1.51-windows-x86_64-hip-rdna3.tar.gz",
+ "size": 1, "sha256": "a" * 64, "manifest_sha256": "b" * 64, "installed_bytes": 2, "notes": ""}
+ packages = [feedmod._engine_package(p)]
+ halo = {"platform": "windows-x86_64", "backend": "hip", "runtime": None, "nvidia_driver": None, "cuda_archs": [], "gfx": ["gfx1151"]}
+ best, _why = feedmod.select_engine(packages, halo)
+ self.assertIsNotNone(best)
+ self.assertEqual((best.platform, best.backend, best.variant), ("windows-x86_64", "hip", "rdna3"))
+ for gfx in ("gfx1100", "gfx1201", "gfx1030"):
+ other = {**halo, "gfx": [gfx]}
+ self.assertIsNone(feedmod.select_engine(packages, other)[0], gfx)
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/terminal/test_dsv41_fit.py b/tests/terminal/test_dsv41_fit.py
new file mode 100644
index 000000000..55dceca22
--- /dev/null
+++ b/tests/terminal/test_dsv41_fit.py
@@ -0,0 +1,76 @@
+"""strata_control/dsv41_fit.py: the memory plan of the official DeepSeek-V4.1-Flash sets (IST-DAS 1.75 / 2.00 / 2.25 bpw), and its
+unified-memory branch for a Ryzen AI Max "Strix Halo" (gfx1151) PC, where the graphics memory is the RAM and is counted once.
+
+The numbers of the 64 GB box are the measured ones (Windows, Adrenalin 26.10.1, engine 0.1.51): 2.00 bpw, Faster mode (5 experts),
+DSpark auto: answers 14-16 tokens/s on code and 10-11 on chat, a 4K prompt 77-81 tokens/s and 8K 108-111.
+"""
+from __future__ import annotations
+
+import unittest
+
+from strata_control import dsv41_fit as F
+
+# what setup hands the plan on the owner's Strix Halo: one integrated Radeon, its "VRAM" counting the BIOS carve-out plus the shared pool
+HALO = [{"index": 0, "name": "AMD Radeon 8060S (Ryzen AI Max, Strix Halo, gfx1151)", "vram_gb": 95.7, "arch": "gfx1151",
+ "uma": True, "integrated": True}]
+R9700 = [{"index": 0, "name": "Radeon AI PRO R9700", "vram_gb": 32.0, "arch": "gfx1201"}]
+TWO_R9700 = [R9700[0], {**R9700[0], "index": 1}]
+
+
+class UnifiedMemoryPlan(unittest.TestCase):
+ def plan(self, model="IST-DAS-2.00bpw", ram=63.6, disk=700.0):
+ return F.plan(HALO, ram, disk, 16384, model=model)
+
+ def test_counts_the_graphics_memory_once(self):
+ p = self.plan()
+ self.assertTrue(p["uma"])
+ self.assertEqual(p["tp"], 1) # no multi-card split words
+ self.assertEqual(p["args"], []) # and no --tp argument
+ resident = 63.6 - F.ISTA_DENSE_GB - F.UMA_RESERVE_GB
+ self.assertAlmostEqual(p["vram_experts_gb"], resident, places=1)
+ self.assertAlmostEqual(p["streamed_gb"], 132.07 - resident, places=1)
+ self.assertEqual(p["experts_in_vram"], int(resident / (132.07 / F.EXPERTS)))
+ self.assertEqual(p["verdict"], "tight") # it runs, most of it from the SSD: measured 14-16 tokens/s on code
+ text = " ".join(p["lines"])
+ self.assertIn("shares this PC's RAM", text)
+ self.assertIn("read from the SSD", text)
+ self.assertIn("14-16 tokens a second", text)
+
+ def test_it_never_refuses_and_keeps_the_disk_numbers(self):
+ p = self.plan("IST-DAS-2.25bpw")
+ self.assertTrue(p["disk_ok"])
+ self.assertAlmostEqual(p["download_gb"], F.ista_download_bytes("IST-DAS-2.25bpw") / 1e9, places=1)
+ self.assertGreater(p["streamed_gb"], 90.0) # 2.25 needs more from the SSD than 2.00
+ self.assertTrue(any("274 GB" in l for l in p["lines"])) # the set's own download
+
+ def test_a_smaller_unified_pc_is_slower_never_refused(self):
+ p = F.plan(HALO, 32.0, 700.0, 8192, model="IST-DAS-2.00bpw")
+ self.assertEqual(p["verdict"], "spills")
+ self.assertTrue(any("1.75 bpw" in w for w in p["warnings"]))
+ self.assertTrue(p["disk_ok"])
+
+ def test_a_128_gb_unified_pc_holds_more(self):
+ p = F.plan(HALO, 127.0, 700.0, 8192, model="IST-DAS-1.75bpw")
+ self.assertGreater(p["vram_experts_gb"], 110.0)
+ self.assertLess(p["streamed_gb"], 3.0)
+ self.assertEqual(p["verdict"], "tight") # 1.75 nearly fits a 128 GB Strix Halo: about 2 GB still come from the SSD
+
+ def test_a_large_enough_unified_pc_fits(self):
+ p = F.plan(HALO, 160.0, 700.0, 8192, model="IST-DAS-1.75bpw")
+ self.assertEqual(p["verdict"], "fits")
+ self.assertEqual(p["streamed_gb"], 0.0)
+
+ def test_a_discrete_card_keeps_the_per_card_plan(self):
+ p = F.plan(TWO_R9700, 251.0, 700.0, 8192, model="IST-DAS-2.00bpw")
+ self.assertFalse(p.get("uma"))
+ self.assertEqual(p["tp"], 2)
+ self.assertEqual(len(p["cards"]), 2)
+ self.assertTrue(any("Two cards share" in l for l in p["lines"]))
+
+ def test_the_smaller_set_is_recommended_for_a_small_unified_pc(self):
+ self.assertEqual(F.recommend(32.0), "IST-DAS-1.75bpw")
+ self.assertEqual(F.recommend(63.6), "IST-DAS-2.00bpw")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/strata_mcp.py b/tools/strata_mcp.py
index b84d835bd..a047bc910 100644
--- a/tools/strata_mcp.py
+++ b/tools/strata_mcp.py
@@ -1334,6 +1334,10 @@ class Strata:
v = pl["verdict"]
if v == "no_card":
return "does not fit: it needs one or more graphics cards"
+ if pl.get("uma"): # Ryzen AI Max (Strix Halo, Windows): the graphics memory is the RAM, counted once
+ return (f"runs on this PC's shared memory: about {pl['vram_experts_gb']:.0f} GB of the {pl['experts_gb']:.0f} GB of experts stay "
+ f"in memory and the other {pl['streamed_gb']:.0f} GB are read from the SSD; measured 14-16 tokens a second on code and "
+ "10-11 on chat")
if pl.get("variant"): # an official IST-DAS set (strata_control/dsv41_fit.py): measured on 46-64 GB, never a refusal
if v == "spills":
return (f"slow here: this computer has {pl['ram_gb']:.0f} GB of RAM and the set was measured with 46-64 GB, so most of its "