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++
Intel Arc engine package: packaging/build_sycl_linux.sh, tests, docs
Niko12218be3f916f21e
diff --git a/docs/INTEL_ARC.md b/docs/INTEL_ARC.mdindex d3f0b4233..0e55edafc 100644--- a/docs/INTEL_ARC.md+++ b/docs/INTEL_ARC.md@@ -10,11 +10,7 @@ Intel GPU and every result on Arc hardware came from the community. Since 0.1.40(32 GB, `xe`) and an Arc A750 (8 GB, `i915`); the results from those two cards are marked in the table below. Other cardsare still community reports. The NVIDIA and AMD engines are unchanged: the Intel build is a separate CMake target, off by default.-**Where the engine comes from.** There is **no Intel engine in the release zips** (the ones `START-HERE.bat` and `setup.sh`-use): you build it from source on Linux, as described below. The Docker route is a ready-made image,-`ghcr.io/niko1221/strata:0.2.2-sycl`, which is published only for a release that carries a Linux Intel engine package; with none, [build-the image yourself](DOCKER.md#build-it-yourself) from the engine you built (the image needs prepared model files; see-[Docker: Intel Arc](DOCKER.md#intel-arc)). The Mac and Windows builds have no Intel engine.+**Where the engine comes from.** On Linux, `strata update` (Terminal) and Settings > Update (app) download the Intel engine package, `linux-x86_64-sycl`, for a PC whose graphics card is made by Intel, when the release feed lists one (`strata update --check` shows what it would install). One package serves Alchemist (A-series) and Battlemage (B-series) cards: the GPU code is compiled from SPIR-V at the first start, because the A-series cards have no FP64 units and the engine's FP64 kernels cannot be built ahead of time for them. It carries oneAPI's runtime libraries; the Level Zero loader and the compute runtime stay the PC's own (see "What you need" below), and the user must be in the `render` group (`strata doctor` says so). The package is built by `packaging/build_sycl_linux.sh`. It was tested on an Arc A750 only. The release zips (the ones `START-HERE.bat` and `setup.sh` use) have no Intel engine; to build one from source, follow the steps below. The Docker route is a ready-made image, `ghcr.io/niko1221/strata:0.2.2-sycl`, which is published only for a release that carries a Linux Intel engine package; with none, [build the image yourself](DOCKER.md#build-it-yourself) from the engine you built (the image needs prepared model files; see [Docker: Intel Arc](DOCKER.md#intel-arc)). The Mac and Windows builds have no Intel engine.## What has been run, and by whomdiff --git a/packaging/ENGINE-COMPONENT.md b/packaging/ENGINE-COMPONENT.mdindex 3a633e0d2..ea76ae394 100644--- a/packaging/ENGINE-COMPONENT.md+++ b/packaging/ENGINE-COMPONENT.md@@ -104,7 +104,7 @@ the manifest file (which holds every file's hash), used as the package's digest| `linux-x86_64` hip | a box with ROCm (the Python wheels are enough) | `strata`, the HIP runtime, hipBLAS/hipBLASLt/rocBLAS, comgr + libLLVM, `rocblas/library` and `hipblaslt/library` for the listed gfx archs; `packaging/build_hip_linux.sh` builds it with both picture readers || `linux-x86_64` hip, variant `rx6000` (RX 6000, gfx1030 / gfx1031) | `VARIANT=rx6000 packaging/build_hip_linux.sh` in the jammy chroot, ROCm 7.13.0a20260515 `gfx103X-all` wheels | the same set as the other HIP packages, with `rocblas/library` for gfx1030 / gfx1031; no `hipblaslt/library` kernels exist for them and no `tuning/` table | built, not tested on a real RX 6000 card (the manifest notes say so). `windows-x86_64` hip, variant `rdna2`: the same archs from `tools/hip/build_windows.bat` with `STRATA_HIP_ARCHS=gfx1030;gfx1031`, packaged with `--variant rdna2`. A PC with an RX 7000 / 9000 card beside an RX 6000 one never takes it (`engine_component.hip_preference`) || `linux-x86_64` hip, gfx1103 (Radeon 780M / Phoenix iGPU) | `packaging/build_hip_gfx1103.sh` on the mini PC (TheRock gfx110X-all SDK) | the same set as the gfx1200/1201 package, with `rocblas/library` and `hipblaslt/library` for gfx1103 (600 MiB) | experimental, unvalidated: the iGPU resets now and then (MES REMOVE_QUEUE); never kill the engine mid-request; run configs set `STRATA_NO_ARENA_THP=1`. `engine_component.resolve` picks a HIP package only when its `archs` list a gfx target the Linux kfd topology reports |-| `linux-x86_64` sycl | a box with oneAPI DPC++ | `strata` (JIT from SPIR-V), libsycl, the Unified Runtime adapters, MKL SYCL libraries | the Level Zero loader and compute runtime are the PC's driver |+| `linux-x86_64` sycl, `archs` `intel-arc` | a Linux box with oneAPI DPC++ 2026.1 and `patchelf`, `packaging/build_sycl_linux.sh` (JIT from SPIR-V; ocloc cannot build the Alchemist FP64 kernels ahead of time, so one JIT package serves A-series and B-series) | `strata`, libsycl, the Unified Runtime adapters, the oneMKL SYCL libraries, libimf / libsvml / libirng / libintlc (about 650 MiB); every ELF file has RUNPATH `$ORIGIN` (Intel's libraries ship without it), so `env -i ./strata --version` runs | the Level Zero loader and compute runtime are the PC's driver; the user must be in the `render` group (`strata doctor` warns). No Windows package: `BACKEND_MATRIX` allows sycl on `linux-x86_64` only || `macos-arm64` metal | an Apple Silicon Mac | `strata`, `metal/kernels/*.metal`, `metal/engine-msl/*.metal`, `metal/ggml-common.h`, `metal/data/*.bin` | the Metal engine compiles its kernel sources when it starts; since S1 it finds them beside the executable (`metal/src/resource_path.h`: environment variable, then `<exe dir>/metal/`, then the compiled-in source path) |`packaging/collect_libs.py` gathers the Linux libraries (an `ldd` closure with the dlopen'd extras named, kernel data filtered bydiff --git a/packaging/README.md b/packaging/README.mdindex d316ef445..b6e746322 100644--- a/packaging/README.md+++ b/packaging/README.md@@ -22,7 +22,7 @@ A backend name alone is not a target. Each row is an OS x CPU ABI x backend tupl| `windows-x86_64-hip` | NSIS `.exe` (Tauri) | `tools/hip/build_windows.bat` | **built; never run on a real AMD card.** || `linux-x86_64-cuda` | AppImage (Tauri) | `setup.py`; built in a glibc 2.35 chroot | **cuda13 built and tested** (RTX 3060 and RTX A4000: app in the browser, a real model, a picture). cuda12 built. || `linux-x86_64-hip` | AppImage (Tauri) | `packaging/build_hip_linux.sh` | **RX 9000 (gfx1200 / gfx1201) built and tested** on a Radeon AI PRO R9700. **RX 7000 (gfx1100 / 1101 / 1102) built; not run on an RX 7000 card.** **RX 6000 (gfx1030 / 1031, 0.2.2, engine package `rx6000` only) built; not tested on a real RX 6000 card.** |-| `linux-x86_64-sycl` | | `sycl/setup_intel.py` | Documented as experimental ([INTEL.md](../docs/INTEL.md)). |+| `linux-x86_64-sycl` | | `packaging/build_sycl_linux.sh` (one JIT package for Alchemist and Battlemage) | **engine package built; tested on an Arc A750** (Intel Arc is an official platform since 0.1.40.2, docs/INTEL_ARC.md). No B-series card was available for the package. `sycl/setup_intel.py` (Docker) remains the source-build route. || `windows-x86_64-sycl` | none | none | **gated.** No native Windows SYCL path exists upstream; it needs a separate feasibility gate, not a recipe. || `macos-x86_64-*` | none | none | **unsupported.** The macOS engine is Apple-Silicon only (`metal/CMakeLists.txt` requires Apple Silicon for the Metal runtime). |diff --git a/packaging/build_sycl_linux.sh b/packaging/build_sycl_linux.shnew file mode 100644index 000000000..028f05504--- /dev/null+++ b/packaging/build_sycl_linux.sh@@ -0,0 +1,74 @@+#!/bin/sh+# Build the Linux Intel Arc (SYCL) engine package for the release feed.+#+# packaging/build_sycl_linux.sh # the release package: GPU code JIT-compiled from SPIR-V (A-series and B-series)+# AOT=bmg-g21,bmg-g31 packaging/build_sycl_linux.sh # a Battlemage-only build of your own, GPU code built ahead of time (not a release package)+#+# Run it on a Linux x86_64 box with Intel oneAPI DPC++ (icx / icpx 2026.1 or newer, oneMKL) installed under $ONEAPI (default+# /opt/intel/oneapi), `patchelf` (apt install patchelf, or pip install patchelf in a venv and put it on PATH) and, for an AOT build,+# `ocloc` (apt: intel-ocloc). The Alchemist cards (A-series, DG2) have no FP64 units and ocloc cannot build the engine's double+# kernels for them, so the JIT package is the one an A-series card runs; a Battlemage card runs it too (the first start compiles the+# kernels, the persistent JIT cache stays off on Xe2, docs/INTEL_ARC.md).+# The level-zero loader and the compute runtime stay the PC's own (the Intel graphics PPA / `apt install libze1 intel-opencl-icd`);+# the oneAPI runtime the engine loads (libsycl, the Unified Runtime adapters, the MKL SYCL libraries) is bundled by collect_libs.py.+# Every ELF file of the package gets RUNPATH $ORIGIN, so the package finds its own libraries with no environment+# (`env -i ./strata --version` runs); Intel's libraries ship without it (libur_loader has $ORIGIN/../lib, libmkl_core none).+# The package lands in $OUT (default ./out-engine-sycl). Nothing is uploaded or signed.+set -eu+repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd -P)+aot=${AOT:-}+case "$aot" in+ ""|bmg-*|bmg-*,bmg-*) ;;+ *) echo "build_sycl_linux.sh: AOT is empty (the release package) or a Battlemage device list such as bmg-g21,bmg-g31" >&2; exit 2 ;;+esac+oneapi=${ONEAPI:-/opt/intel/oneapi}+out=${OUT:-$repo/out-engine-sycl}+build=${BUILD:-$repo/build-sycl}+py=${PYTHON:-python3}+jobs=${JOBS:-$(nproc)}+command -v patchelf >/dev/null || { echo "build_sycl_linux.sh: patchelf is not on PATH" >&2; exit 2; }+# setvars.sh is not written for `set -u`+set +u+# shellcheck disable=SC1091+. "$oneapi/setvars.sh" >/dev/null 2>&1 || { echo "build_sycl_linux.sh: $oneapi/setvars.sh not found or failed" >&2; exit 2; }+set -u+command -v icpx >/dev/null || { echo "build_sycl_linux.sh: icpx is not on PATH after setvars.sh" >&2; exit 2; }+[ -z "$aot" ] || command -v ocloc >/dev/null || { echo "build_sycl_linux.sh: AOT needs ocloc (apt install intel-ocloc)" >&2; exit 2; }+iccver=$(icpx --version | sed -n 's/.*Compiler \([0-9][0-9.]*\).*/\1/p' | head -1)++cd "$repo"+ggml=""+if [ -n "${LLAMA_CPP:-}" ]; then ggml="-DFETCHCONTENT_SOURCE_DIR_STRATA_LLAMACPP=$LLAMA_CPP -DFETCHCONTENT_FULLY_DISCONNECTED=ON"+elif [ -d "$repo/third_party/llama.cpp/ggml" ]; then ggml="-DSTRATA_GGML_DIR=$repo/third_party/llama.cpp"; fi+# shellcheck disable=SC2086+cmake -S sycl -B "$build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \+ -DSTRATA_SYCL_PARITY=OFF ${aot:+"-DSTRATA_SYCL_AOT=$aot"} $ggml+cmake --build "$build" --target strata -j "$jobs"++ver=$(sed -n 's/^[[:space:]]*project([^)]*VERSION[[:space:]]*\([0-9][0-9.]*\).*/\1/p' CMakeLists.txt | head -1)+commit=${COMMIT:-$(git rev-parse --short=12 HEAD 2>/dev/null || echo unknown)} # a git archive has no .git: pass COMMIT=+stage=$(mktemp -d "${TMPDIR:-/tmp}/strata-sycl-stage.XXXXXX")+trap 'rm -rf "$stage"' EXIT+cp "$build/strata" "$stage/"+code=${aot:+AOT $aot}; code=${code:-JIT from SPIR-V}+echo "{\"version\": \"$ver\", \"source\": \"packaging/build_sycl_linux.sh\", \"sycl\": \"oneAPI DPC++ $iccver ($code)\", \"portable\": false}" > "$stage/BUILD.json"+# libsycl and the MKL SYCL libraries come through ldd; the Unified Runtime adapters (level zero, opencl) are dlopen'd, so they are named+"$py" packaging/collect_libs.py --binary "$build/strata" --search "$oneapi/compiler/latest/lib" --search "$oneapi/mkl/latest/lib" \+ --also 'libur_adapter_level_zero*.so*' --also 'libur_adapter_opencl*.so*' --out "$stage"+# RUNPATH $ORIGIN on the engine and on every bundled library (the same way packaging/build_hip_linux.sh does it)+for f in "$stage/strata" "$stage"/*.so "$stage"/*.so.*; do+ [ -f "$f" ] && [ ! -L "$f" ] && patchelf --set-rpath '$ORIGIN' "$f"+done+for f in "$stage/strata" "$stage"/*.so "$stage"/*.so.*; do+ [ -f "$f" ] && [ ! -L "$f" ] && { readelf -d "$f" | grep -q 'RUNPATH.*\[\$ORIGIN\]' || { echo "build_sycl_linux.sh: $(basename "$f") has no RUNPATH \$ORIGIN" >&2; exit 1; }; }+done+if [ -n "$aot" ]; then arch_args=$(echo "$aot" | tr ',' '\n' | sed 's/^/--arch /' | tr '\n' ' '); else arch_args="--arch intel-arc"; fi+mkdir -p "$out"+# shellcheck disable=SC2086+"$py" packaging/package_engine.py --src "$stage" --backend sycl --version "$ver" --out "$out" $arch_args \+ --platform linux-x86_64 --build-id "${commit}-oneapi${iccver}" --include SYSTEM-LIBS.txt+for d in "$out"/*/; do+ "$py" packaging/package_engine.py --verify "$d"; "$py" packaging/binary_deps.py "$d"+ env -i "$d/strata" --version > /dev/null || { echo "build_sycl_linux.sh: env -i $d/strata --version does not run" >&2; exit 1; }+done+echo "built: $out"diff --git a/strata_control/engine_component.py b/strata_control/engine_component.pyindex 3d3c09a78..0cddbf4fb 100644--- a/strata_control/engine_component.py+++ b/strata_control/engine_component.py@@ -471,15 +471,15 @@ def detect_backend(environ=None) -> tuple[str | None, str]:return None, "no GPU tool answered"-def _drm_vendor_backend() -> str | None:+def _drm_vendor_backend(root: str = "/sys/class/drm") -> str | None:"""Linux without the vendor tools on PATH (a HIP box that runs ROCm from Python wheels has no rocminfo): the PCIvendor of the display adapters decides. NVIDIA 0x10de -> cuda, AMD 0x1002 -> hip, Intel 0x8086 -> sycl, in thatorder. Read-only sysfs, nothing is run."""- if not os.path.isdir("/sys/class/drm"):+ if not os.path.isdir(root):return Nonevendors = set()try:- for card in sorted(Path("/sys/class/drm").glob("card[0-9]*")):+ for card in sorted(Path(root).glob("card[0-9]*")):if "-" in card.name:continuetry:diff --git a/tests/terminal/test_release_matrix.py b/tests/terminal/test_release_matrix.pyindex a074fbfce..d6aab3114 100644--- a/tests/terminal/test_release_matrix.py+++ b/tests/terminal/test_release_matrix.py@@ -39,6 +39,7 @@ RELEASE = [pkg("linux-x86_64", "hip", "rx7900", ("gfx1100", "gfx1101", "gfx1102")),pkg("linux-x86_64", "hip", "halo", ("gfx1151",)),pkg("linux-x86_64", "hip", "rx6000", ("gfx1030", "gfx1031")),+ pkg("linux-x86_64", "sycl", "", ("intel-arc",)), # the Intel Arc (A and B series) engine, GPU code JIT-compiledpkg("macos-arm64", "metal", "", ("apple-gpu",)),]@@ -65,6 +66,7 @@ class ReleaseSelection(unittest.TestCase):self.pick(pc("linux-x86_64", "hip", gfx=["gfx1100"]))[0], # RX 7900 XTXself.pick(pc("linux-x86_64", "hip", gfx=["gfx1151"]))[0], # Ryzen AI Max (Strix Halo)self.pick(pc("linux-x86_64", "hip", gfx=["gfx1031"]))[0], # RX 6700 XT+ self.pick(pc("linux-x86_64", "sycl"))[0], # Arc A750 / B580 / Pro B70self.pick(pc("macos-arm64", "metal"))[0],}self.assertEqual(chosen, {(p["platform"], p["backend"], p["variant"]) for p in RELEASE})diff --git a/tests/terminal/test_sycl_package.py b/tests/terminal/test_sycl_package.pynew file mode 100644index 000000000..be9ac3147--- /dev/null+++ b/tests/terminal/test_sycl_package.py@@ -0,0 +1,127 @@+"""Intel Arc engine package (owner test round 8, track L3): the stable feed had no `linux-x86_64-sycl` package, so a clean Arc PC got a+Terminal that could not run a model and `strata update` kept saying the feed had no engine for it. The feed is whatever packages the release+builds (packaging/feed_tool.py takes every `*.entry.json`), so the gap was the missing build recipe, not the choice code. These tests keep the+choice honest once the package exists: an Arc PC (found by its PCI vendor, with no oneAPI tools installed) gets it by itself, nobody else does,+and the recipe that makes it carries the checks that a clean PC needs."""+from __future__ import annotations++import shutil+import subprocess+import sys+import tempfile+import unittest+from pathlib import Path+from unittest import mock++from strata_control import engine_component as ec, feed as feedmod, updater++ROOT = Path(__file__).resolve().parents[2]+sys.path.insert(0, str(ROOT / "packaging"))+import package_engine # noqa: E402++LINUX, WIN = "linux-x86_64", "windows-x86_64"+++def entry(platform, backend, variant, archs, version="0.1.47"):+ return {"version": version, "platform": platform, "backend": backend, "variant": variant, "archs": list(archs), "min_driver": {},+ "min_runtime": None, "build_id": f"rel-{platform}-{backend}-{variant}", "format": "tar.gz",+ "url": f"strata-engine-{platform}-{backend}-{variant}.tar.gz", "size": 1000, "sha256": "a" * 64, "manifest_sha256": "b" * 64,+ "installed_bytes": 2000, "notes": ""}+++FEED = [feedmod._engine_package(e) for e in (+ entry(LINUX, "cuda", "cuda13", ("sm_75", "sm_86", "sm_89", "sm_120", "compute_120")),+ entry(LINUX, "hip", "rx9070", ("gfx1200", "gfx1201")),+ entry(WIN, "cuda", "cuda13", ("sm_86",)),+ entry(LINUX, "sycl", "", ("intel-arc",)))]+++def fake_drm(root: Path, *vendors: str) -> str:+ """A /sys/class/drm with one card per vendor id (plus a connector entry, which must be skipped)."""+ for i, vendor in enumerate(vendors):+ dev = root / f"card{i}" / "device"+ dev.mkdir(parents=True)+ (dev / "vendor").write_text(vendor + "\n")+ (root / f"card{i}-HDMI-A-1").mkdir()+ return str(root)+++class ArcChoice(unittest.TestCase):+ def detect(self, *vendors, platform=LINUX, environ=None):+ """What `updater.detect_hardware` says on a PC with these display vendors and none of the vendor tools installed."""+ with tempfile.TemporaryDirectory() as t:+ drm = fake_drm(Path(t), *vendors)+ real = ec._drm_vendor_backend+ with mock.patch.object(ec.shutil, "which", return_value=None), \+ mock.patch.object(ec, "host_platform", return_value=platform), \+ mock.patch.object(updater, "host_platform", return_value=platform), \+ mock.patch.object(ec, "_drm_vendor_backend", lambda: real(drm)), \+ mock.patch.object(ec, "_windows_vendor_backend", lambda: real(drm)): # the test PC may be Windows: either probe answers+ return updater.detect_hardware(environ or {})++ def pick(self, hardware):+ best, reasons = feedmod.select_engine(FEED, hardware)+ return best, reasons++ def test_a_clean_arc_pc_without_oneapi_gets_the_sycl_package(self):+ hw = self.detect("0x8086")+ self.assertEqual((hw["platform"], hw["backend"]), (LINUX, "sycl"))+ best, _ = self.pick(hw)+ self.assertEqual((best.backend, best.platform, best.archs), ("sycl", LINUX, ("intel-arc",)))++ def test_nvidia_and_amd_pcs_never_get_it_even_with_an_intel_igpu_beside_the_card(self):+ for vendors, want in ((("0x10de",), "cuda"), (("0x8086", "0x10de"), "cuda"), (("0x8086", "0x1002"), "hip")):+ hw = self.detect(*vendors)+ best, _ = self.pick(hw)+ self.assertEqual(best.backend, want, vendors)++ def test_windows_has_no_intel_package_and_says_why(self):+ hw = self.detect("0x8086", platform=WIN)+ best, why = self.pick(hw)+ self.assertIsNone(best)+ self.assertTrue(any("sycl" in r and WIN in r for r in why), why)+ self.assertEqual(ec.backend_supported("sycl", WIN)[0], False)+ self.assertEqual(ec.backend_supported("sycl", LINUX)[0], True)++ def test_the_package_is_not_offered_to_a_mac_or_to_a_forced_other_backend(self):+ self.assertIsNone(self.pick({"platform": "macos-arm64", "backend": "metal", "runtime": "0.2.2"})[0])+ best, _ = self.pick(self.detect("0x8086", environ={ec.ENV_BACKEND: "cuda"}))+ self.assertEqual(best.backend, "cuda")++ def test_an_older_sycl_package_does_not_beat_the_new_one_and_a_newer_one_wins(self):+ packages = [feedmod._engine_package(entry(LINUX, "sycl", "", ("intel-arc",), v)) for v in ("0.1.45", "0.1.47", "0.1.46")]+ best, _ = feedmod.select_engine(packages, self.detect("0x8086"))+ self.assertEqual(best.version, "0.1.47")++ def test_no_package_at_all_gives_the_plain_no_engine_reason(self):+ best, why = feedmod.select_engine([p for p in FEED if p.backend != "sycl"], self.detect("0x8086"))+ self.assertIsNone(best)+ self.assertTrue(any("needs sycl" in r for r in why), why)+++class Recipe(unittest.TestCase):+ SCRIPT = ROOT / "packaging" / "build_sycl_linux.sh"++ def test_the_recipe_exists_and_is_valid_shell(self):+ self.assertTrue(self.SCRIPT.is_file())+ sh = shutil.which("sh")+ if sh:+ self.assertEqual(subprocess.run([sh, "-n", str(self.SCRIPT)], capture_output=True).returncode, 0)++ def test_the_recipe_bundles_the_runtime_and_checks_a_clean_start(self):+ text = self.SCRIPT.read_text(encoding="utf-8")+ for needed in ("collect_libs.py", "libur_adapter_level_zero", "libur_adapter_opencl", "patchelf --set-rpath",+ "package_engine.py --verify", "binary_deps.py", "env -i", "--version", "--backend sycl", "intel-arc"):+ self.assertIn(needed, text)+ self.assertNotIn("\r", text, "a shell script with CRLF endings does not run on Linux")++ def test_a_sycl_package_needs_an_arch_tag_and_only_linux(self):+ with tempfile.TemporaryDirectory() as t:+ with self.assertRaises(SystemExit):+ package_engine.build(Path(t), "sycl", "0.1.47", LINUX, Path(t) / "out")+ self.assertIn(LINUX, ec.BACKEND_MATRIX["sycl"])+ self.assertNotIn(WIN, ec.BACKEND_MATRIX["sycl"])+++if __name__ == "__main__":+ unittest.main()