AMD XDNA 2 NPU + Radeon 8060S iGPU Dual-Engine Setup & Lemonade Server Launcher (MS-S1 Max / Z2 Mini G1a) (setup-lemonade-npu-igpu-dual-engine.sh)
Validates /dev/accel/accel0 (amdxdna driver), unlimited memlock, 108GB GTT unified memory pool, and FastFlowLM NPU health, then serves an always-on helper model on the NPU alongside Qwen3.6-35B-A3B or Llama 4 Scout on ROCm 7.2.
AMD XDNA 2 NPU + Radeon 8060S iGPU Dual-Engine Setup & Lemonade Server Launcher (MS-S1 Max / Z2 Mini G1a)
Validates /dev/accel/accel0 (amdxdna driver), unlimited memlock, 108GB GTT unified memory pool, and FastFlowLM NPU health, then serves an always-on helper model on the NPU alongside Qwen3.6-35B-A3B or Llama 4 Scout on ROCm 7.2.
#!/usr/bin/env bash # Tinker AI — Split-Engine AMD XDNA 2 NPU (FastFlowLM) + Radeon 8060S (ROCm 7.2) Launcher (Guide #48) set -euo pipefail ROCM_MODEL="Qwen3.6-35B-A3B-Q8_0-GGUF" NPU_MODEL="Qwen3-8B-FLM-NPU-INT4" TTM_PAGES="28311552" PORT="13305" echo "=== [1/4] Checking Linux Kernel, amdxdna NPU Device (/dev/accel/accel0) & memlock ===" uname -r ls -la /dev/accel/accel0 /dev/kfd /dev/dri/renderD* MEMLOCK=$(ulimit -l) echo "Current memlock limit: $MEMLOCK (must be 'unlimited' for XRT / FastFlowLM NPU BO pinning)" if [ "$MEMLOCK" != "unlimited" ]; then echo "WARNING: Run 'echo "* soft memlock unlimited" | sudo tee -a /etc/security/limits.conf' and re-login!" fi echo "=== [2/4] Verifying 108GB Unified GTT/TTM Pool (Target pages_limit >= $TTM_PAGES) ===" cat /sys/module/amdttm/parameters/pages_limit || true rocm-smi --showmeminfo vram gtt || true echo "=== [3/4] Running FastFlowLM Hardware & XDNA 2 Firmware Validation ===" flm --version || true flm validate echo "=== [4/4] Pulling NPU + ROCm Models & Starting Unified Lemonade Server on Port $PORT ===" lemonade-server pull "$NPU_MODEL" || true lemonade-server pull "$ROCM_MODEL" || true echo "Starting lemonade-server (OpenAI endpoint: http://127.0.0.1:$PORT/api/v1)..." HSA_OVERRIDE_GFX_VERSION=11.5.1 ROCBLAS_USE_HIPBLASLT=1 \ lemonade-server serve --port "$PORT"
Customizable Parameter Reference for setup-lemonade-npu-igpu-dual-engine.sh
This SH artifact exposes 4 template variables compiled client-side in your browser.
| Template Token | Parameter Description | Verified Default | Example Format |
|---|---|---|---|
{{PRIMARY_ROCM_MODEL}} | Primary Heavy Model on Radeon 8060S ROCm 7.2 | Qwen3.6-35B-A3B-Q8_0-GGUF | Qwen3.6-35B-A3B-Q8_0-GGUF |
{{NPU_HELPER_MODEL}} | Always-On Helper Model on XDNA 2 NPU (flm:npu) | Qwen3-8B-FLM-NPU-INT4 | Qwen3-8B-FLM-NPU-INT4 |
{{TTM_PAGES_108GB}} | Linux amdttm.pages_limit (28311552 = 108GB on 128GB Host) | 28311552 | 28311552 |
{{LEMONADE_PORT}} | Lemonade OpenAI API Port | 13305 | 13305 |
Verified Environment for "Split-Engine NPU + iGPU Local AI on 128GB Compact Workstations: Minisforum MS-S1 Max (Dual 10GbE · USB4v2 80Gbps) & HP Z2 Mini G1a with AMD Lemonade Server, FastFlowLM (XDNA 2 NPU) & ROCm 7.2 Running Qwen3.6-35B-A3B & Llama 4 Scout (109B)"
Minisforum MS-S1 Max (Ryzen AI Max+ 395 · 128GB LPDDR5X-8000 256 GB/s · 130W Performance Mode · 2× 10GbE RTL8127 + 2× USB4v2 80Gbps) & HP Z2 Mini G1a Workstation (Ryzen AI Max+ PRO 395 · 128GB LPDDR5X-8000 ECC · up to 150W sustained)
Once ROCm GGUF and FastFlowLM NPU checkpoints are pulled via `lemonade-server pull`, both NPU (`/dev/accel/accel0`) and iGPU (`/dev/kfd`) run 100% offline with zero external telemetry.
- **`flm validate` Fails Immediately Without `memlock unlimited`:** The Linux `amdxdna` / XRT runtime pins NPU buffer objects (BOs) directly in non-pageable host memory. Ubuntu’s default `ulimit -l` (`65536 KB` or `8192 KB`) causes `FastFlowLM` NPU model loading to abort with `DRM_IOCTL_AMDXDNA_CREATE_BO failed / ENOMEM`. Set `* soft memlock unlimited` and `* hard memlock unlimited` in `/etc/security/limits.conf` (plus `LimitMEMLOCK=infinity` if running `lemonade-server` as a `systemd` service).
- **Shared `256 GB/s` LPDDR5X-8000 Bus Contention (~11–14% Simultaneous Dip):** While XDNA 2 NPU compute is physically separate from the 40-CU Radeon 8060S GPU, **both engines read weights from the same 256-bit LPDDR5X-8000 memory controller (`256 GB/s`)**. When an `flm:npu` 8B stream and a `ROCm 7.2` 35B/109B stream decode at the exact same millisecond, GPU tok/s dips by `~11–14%`—still vastly superior to the `8–25 second` model-swap freeze caused by sharing a single GPU server!
- **`Llama-4-Scout-17B-16E` (`109B`) Active-Parameter Speed Ceiling (`~15–20 tok/s`):** Even though both `Qwen3.6-35B-A3B` and `Llama-4-Scout` fit inside the 108GB UMA pool, `Qwen3.6-35B-A3B` activates only **`3.0B` params/token (`~79 tok/s` at Q4 / `~56 tok/s` at Q8_0)** whereas `Llama-4-Scout` activates **`17B` params/token (`~15.4 tok/s` at Q4_K_M / `~19.6 tok/s` at Q3_K_XL)** due to `256 GB/s` memory bandwidth physics.
3-Step Verification Checklist After Deploying setup-lemonade-npu-igpu-dual-engine.sh
- Verified `/dev/accel/accel0` exists, `ulimit -l` outputs `unlimited`, and `flm validate` passes kernel, `amdxdna`, and NPU firmware (`>= 1.1.0.0`) checks.
- Set `amdttm.pages_limit=28311552` (`108 GB` GTT ceiling on 128GB host) while keeping `~20 GB` reserved for Ubuntu kernel, ZFS/page cache, and IDE containers.
- Routed IDE autocomplete / lightweight tasks to `flm:npu` (`Llama-3.2-3B` / `Qwen3-8B`) and main coding agent sessions to `ROCm 7.2` (`Qwen3.6-35B-A3B` or `Llama-4-Scout`) via `lemonade-server`.