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

SYCL: build.sh stops an AOT Battlemage build before the compile when ocloc is the one that crashes on the int8 kernels (Compute Runtime 26.22.38646.x, IGC 2.36.3); I8_ESIMD=OFF / STRATA_SYCL_I8_ESIMD builds without them; docs say docker build --pull (#3219)

Niko12218e957cd53b2b
diff --git a/docs/INTEL.md b/docs/INTEL.md
index f77bb006a..788157ee3 100644
--- a/docs/INTEL.md
+++ b/docs/INTEL.md
@@ -90,7 +90,7 @@ community llama.cpp SYCL image), so the PC needs no oneAPI. From the checkout (i
folder above it is what the container mounts at `/work`):
cd Strata
- docker build -t strata-sycl-dev sycl/tools # once: about 6 minutes, a 13 GB image
+ docker build --pull -t strata-sycl-dev sycl/tools # once: about 6 minutes, a 13 GB image
H=$(basename "$PWD")
**Arc B-series** (Pro B70: `bmg-g31`; B580, B570 and Pro B60: `bmg-g21`; `ocloc ids bmg-g21` in the image lists the
@@ -105,6 +105,13 @@ device ids). Ahead-of-time code, no compile at the first start:
docker run --rm -u $(id -u):$(id -g) -v "$PWD/..:/work" -e REPO=/work/$H \
-e BUILD_DIR=/work/$H/build-sycl strata-sycl-dev "cd /work/$H && bash sycl/tools/build.sh strata"
+`--pull` matters: the image starts from a community image whose tag moves, and `docker build` reuses a copy of it from an earlier
+build unless it is told to fetch the current one. An old copy can hold a device compiler (ocloc from Compute Runtime
+26.22.38646, IGC 2.36.3) that crashes on the Battlemage kernels ("IGC: Internal Compiler Error: Floating point exception", 77 device
+images, then `gen compiler command failed with exit code 245` at the last link, #3219). `sycl/tools/build.sh` checks the
+version before the compile and stops with the fix. If you cannot update the image, `-e I8_ESIMD=OFF` builds without the fused int8
+kernels (stubs: the prompt's experts take the slower XMX path, the answers do not change); `-e ALLOW_BAD_OCLOC=1` builds anyway.
+
The build takes about 3 minutes and ends with `BUILD EXIT 0` and `errors: 0`. The binary is `build-sycl-aot/strata`
(B-series) or `build-sycl/strata` (A-series); setup finds either one. Run the `docker build` again after pulling a
Strata update that changes `sycl/tools/Dockerfile`, and the `docker run` after every update of the engine (setup
diff --git a/docs/INTEL_ARC.md b/docs/INTEL_ARC.md
index f56555f89..85c61a2b4 100644
--- a/docs/INTEL_ARC.md
+++ b/docs/INTEL_ARC.md
@@ -82,7 +82,7 @@ called `Strata` here:
```sh
cd Strata
-docker build -t strata-sycl-dev sycl/tools # once: ~6 minutes, a 13 GB image
+docker build --pull -t strata-sycl-dev sycl/tools # once: ~6 minutes, a 13 GB image (--pull: INTEL.md says why)
H=$(basename "$PWD")
# Arc B-series: bmg-g31 (Pro B70), bmg-g21 (B580, B570, Pro B60). Arc A-series (Alchemist): leave out AOT (JIT) and use build-sycl
docker run --rm -u $(id -u):$(id -g) -v "$PWD/..:/work" -e AOT=bmg-g31 -e REPO=/work/$H \
diff --git a/sycl/CMakeLists.txt b/sycl/CMakeLists.txt
index b5570d21c..b5eb3f6b5 100644
--- a/sycl/CMakeLists.txt
+++ b/sycl/CMakeLists.txt
@@ -42,8 +42,25 @@ if(STRATA_SYCL_AOT MATCHES "^(bmg|lnl)")
elseif(STRATA_SYCL_AOT MATCHES "^pvc")
add_compile_definitions(STRATA_NO_DG2_XMX=1) # the grouped XMX kernels (sub-group 8, 8x8x16) do not compile for Xe2 / Xe-HPC
endif()
-if(STRATA_SYCL_AOT AND NOT STRATA_SYCL_AOT MATCHES "^(bmg|lnl)")
- add_compile_definitions(STRATA_I8_NO_ESIMD=1) # 151-b70: the fused int8 DPAS expert kernels (ESIMD, s8 8x16x32) are Xe2-only: no AOT build for Alchemist / Xe-HPC
+# The fused int8 DPAS expert kernels (src/prefill/esimd_moe.dp.cpp, ESIMD, s8 8x16x32). AUTO: built for the JIT build and for an AOT build of
+# Xe2 (bmg, lnl); stubs for an AOT build of any other device. OFF: stubs everywhere, available() is false and the prompt's experts take the
+# grouped XMX path instead (slower prompts on Battlemage, same answers). #3219: IGC 2.36.3 (Compute Runtime 26.22.38646.4, in an old
+# strata-sycl-dev image) dies with an internal error on 77 of these kernels for bmg-g31; a newer IGC builds them. ON keeps them on a device AUTO
+# would stub.
+set(STRATA_SYCL_I8_ESIMD "AUTO" CACHE STRING "the fused int8 ESIMD expert kernels: AUTO, ON or OFF (OFF: the XMX path, for a device compiler that cannot build them)")
+set_property(CACHE STRATA_SYCL_I8_ESIMD PROPERTY STRINGS AUTO ON OFF)
+if(NOT STRATA_SYCL_I8_ESIMD MATCHES "^(AUTO|ON|OFF)$")
+ message(FATAL_ERROR "STRATA_SYCL_I8_ESIMD must be AUTO, ON or OFF (got '${STRATA_SYCL_I8_ESIMD}')")
+endif()
+set(_i8_esimd ON)
+if(STRATA_SYCL_I8_ESIMD STREQUAL "OFF")
+ set(_i8_esimd OFF)
+elseif(STRATA_SYCL_I8_ESIMD STREQUAL "AUTO" AND STRATA_SYCL_AOT AND NOT STRATA_SYCL_AOT MATCHES "^(bmg|lnl)")
+ set(_i8_esimd OFF) # 151-b70: DPAS s8 8x16x32 is Xe2-only: no AOT build for Alchemist / Xe-HPC
+endif()
+if(NOT _i8_esimd)
+ add_compile_definitions(STRATA_I8_NO_ESIMD=1)
+ message(STATUS "Strata SYCL: the fused int8 ESIMD expert kernels are off (STRATA_SYCL_I8_ESIMD=${STRATA_SYCL_I8_ESIMD}): stubs, the XMX path serves the prompt's experts")
endif()
if(STRATA_SYCL_AOT)
list(APPEND _sycl_flags -fsycl-targets=spir64_gen)
@@ -397,7 +414,7 @@ if(STRATA_SYCL_PARITY)
add_executable(esimd_moe_mode_test ${CMAKE_CURRENT_SOURCE_DIR}/src/kernels/esimd_moe_mode_test.cpp) # 151-b70: the default choice of the expert chain (no GPU)
target_include_directories(esimd_moe_mode_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
add_test(NAME esimd_moe_mode_test COMMAND esimd_moe_mode_test)
- if(NOT STRATA_SYCL_AOT OR STRATA_SYCL_AOT MATCHES "^(bmg|lnl)") # DPAS s8 8x16x32 (Xe2): not for an Alchemist / Xe-HPC AOT build
+ if(_i8_esimd) # DPAS s8 8x16x32 (Xe2): not for an Alchemist / Xe-HPC AOT build, nor with STRATA_SYCL_I8_ESIMD=OFF
add_executable(esimd_dpas_probe ${CMAKE_CURRENT_SOURCE_DIR}/src/kernels/esimd_dpas_probe.cpp) # ESIMD DPAS peak (registers only)
add_executable(esimd_i8_bench ${CMAKE_CURRENT_SOURCE_DIR}/src/kernels/esimd_i8_bench.cpp) # ESIMD int8 DPAS GEMM on pre-decoded weights
endif()
diff --git a/sycl/tools/build.sh b/sycl/tools/build.sh
index 5cb3cb58d..144dd427d 100755
--- a/sycl/tools/build.sh
+++ b/sycl/tools/build.sh
@@ -1,12 +1,49 @@
#!/usr/bin/env bash
# Configure + build the SYCL port inside strata-sycl-dev. sycl/build.sh [target...]
+# AOT=bmg-g31 ahead-of-time device code (empty: SPIR-V, JIT at the first start)
+# I8_ESIMD=OFF no fused int8 ESIMD expert kernels (stubs; the prompt's experts take the XMX path). AUTO (default) or ON otherwise.
+# ALLOW_BAD_OCLOC=1 build although this ocloc is known to crash on the Battlemage kernels (see below)
set -uo pipefail
set +u; source /opt/intel/oneapi/setvars.sh >/dev/null 2>&1 || true; set -u
+
+# #3219: ocloc from Compute Runtime 26.22.38646.x (IGC 2.36.3) ends with "IGC: Internal Compiler Error: Floating point exception" on the
+# fused int8 expert kernels when it builds for a Battlemage device (bmg-*): 77 device images, then "gen compiler command failed with exit
+# code 245" at the last link, after the long compile. A newer ocloc builds them. The strata-sycl-dev image keeps whatever ocloc its base image
+# had when it was built (the base tag moves; `docker build` reuses a cached base unless it gets --pull). Say it before the compile, not after.
+# Other versions are not judged: the list holds what has been seen to fail.
+known_bad_ocloc() {
+ case "$1" in
+ 26.22.38646|26.22.38646.*) return 0 ;;
+ esac
+ return 1
+}
+ocloc_version() {
+ command -v ocloc >/dev/null 2>&1 || return 1
+ ocloc --version 2>/dev/null | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?' | head -1
+}
+if [[ "${AOT:-}" =~ ^(bmg|lnl) ]] && [[ "${I8_ESIMD:-AUTO}" != "OFF" ]] && [[ "${ALLOW_BAD_OCLOC:-}" != "1" ]]; then
+ v=$(ocloc_version || true)
+ if [[ -n "$v" ]] && known_bad_ocloc "$v"; then
+ cat >&2 <<EOF
+build.sh: this image's ocloc is $v (IGC 2.36.3). It is known to crash while it compiles the int8 ESIMD kernels for AOT=${AOT} (#3219).
+ Fix: rebuild the image with a fresh base, then build again: docker build --pull -t strata-sycl-dev sycl/tools
+ Or build without those kernels (the prompt's experts take the slower XMX path): I8_ESIMD=OFF
+ Or build anyway: ALLOW_BAD_OCLOC=1
+EOF
+ exit 2
+ fi
+fi
+
repo=${REPO:-$(git rev-parse --show-toplevel)}
b=${BUILD_DIR:-$repo/build-sycl}
[ -f $b/build.ninja ] || cmake -S $repo/sycl -B $b -G Ninja -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
- -DSTRATA_SYCL_AOT="${AOT:-}" -DSTRATA_SYCL_SPIN_MAX="${SPIN_MAX:-}" 2>&1 | tail -15
+ -DSTRATA_SYCL_AOT="${AOT:-}" -DSTRATA_SYCL_SPIN_MAX="${SPIN_MAX:-}" -DSTRATA_SYCL_I8_ESIMD="${I8_ESIMD:-AUTO}" 2>&1 | tail -15
+# an existing build folder keeps its cache: a switch given now reaches it (only this one, so AOT and the rest stay as configured)
+[ -z "${I8_ESIMD:-}" ] || cmake -S $repo/sycl -B $b -DSTRATA_SYCL_I8_ESIMD="$I8_ESIMD" >/dev/null 2>&1
cmake --build $b -j ${JOBS:-12} ${1:+--target "$@"} -- -k 0 2>&1 | tee $b/build.log | grep -E '^FAILED|error:|^ninja: build stopped|Linking|^\[[0-9]+/[0-9]+\] Linking' | tail -40
echo "BUILD EXIT ${PIPESTATUS[0]}"
grep -c 'error:' $b/build.log | sed 's/^/errors: /'
grep -E '^FAILED' $b/build.log | sed 's#.*/##' | sort | uniq | head -60
+if grep -q 'IGC: Internal Compiler Error' $b/build.log 2>/dev/null; then
+ echo "build.sh: the device compiler (ocloc $(ocloc_version || echo '?')) crashed: try docker build --pull -t strata-sycl-dev sycl/tools or I8_ESIMD=OFF (#3219)"
+fi
diff --git a/tools/test_sycl_build_guard.py b/tools/test_sycl_build_guard.py
new file mode 100644
index 000000000..d9882940a
--- /dev/null
+++ b/tools/test_sycl_build_guard.py
@@ -0,0 +1,74 @@
+"""#3219: sycl/tools/build.sh stops before the long compile when this image's ocloc is the one that crashes on the Battlemage int8 kernels,
+and I8_ESIMD=OFF reaches cmake. A fake ocloc and a fake cmake stand in for the oneAPI image; skipped without bash."""
+import os
+import shutil
+import stat
+import subprocess
+import tempfile
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+BUILD_SH = ROOT / "sycl" / "tools" / "build.sh"
+BASH = shutil.which("bash")
+
+
[email protected](BASH, "needs bash")
+class BuildGuard(unittest.TestCase):
+ def setUp(self):
+ self.tmp = tempfile.TemporaryDirectory()
+ self.bin = Path(self.tmp.name) / "bin"
+ self.bin.mkdir()
+ self.log = Path(self.tmp.name) / "cmake.log"
+ (self.bin / "cmake").write_text('#!/bin/sh\necho "cmake $*" >> "%s"\nexit 0\n' % self.log.as_posix(), encoding="utf-8", newline="\n")
+ self.build = Path(self.tmp.name) / "b"
+
+ def tearDown(self):
+ self.tmp.cleanup()
+
+ def ocloc(self, version):
+ path = self.bin / "ocloc"
+ path.write_text('#!/bin/sh\necho "Intel(R) Compute Runtime ocloc %s"\n' % version, encoding="utf-8", newline="\n")
+ path.chmod(path.stat().st_mode | stat.S_IEXEC)
+ (self.bin / "cmake").chmod(0o755)
+
+ def run_build(self, **env):
+ (self.bin / "cmake").chmod(0o755)
+ merged = dict(os.environ, PATH=self.bin.as_posix() + os.pathsep + os.environ["PATH"], REPO=ROOT.as_posix(),
+ BUILD_DIR=self.build.as_posix())
+ for key in ("AOT", "I8_ESIMD", "ALLOW_BAD_OCLOC"):
+ merged.pop(key, None)
+ merged.update(env)
+ return subprocess.run([BASH, BUILD_SH.as_posix(), "strata"], env=merged, capture_output=True, text=True, timeout=120)
+
+ def test_known_bad_ocloc_stops_a_battlemage_aot_build(self):
+ self.ocloc("26.22.38646.4")
+ r = self.run_build(AOT="bmg-g31")
+ self.assertEqual(r.returncode, 2, r.stderr)
+ for word in ("26.22.38646.4", "docker build --pull", "I8_ESIMD=OFF", "ALLOW_BAD_OCLOC=1"):
+ self.assertIn(word, r.stderr)
+ self.assertFalse(self.log.exists(), "cmake never started")
+
+ def test_other_versions_other_devices_and_the_switches_go_on(self):
+ self.ocloc("26.31.39395.14")
+ r = self.run_build(AOT="bmg-g31")
+ self.assertEqual(r.returncode, 0, r.stderr)
+ self.assertIn("-DSTRATA_SYCL_I8_ESIMD=AUTO", self.log.read_text())
+ self.log.unlink()
+ self.ocloc("26.22.38646.4")
+ self.assertEqual(self.run_build(AOT="acm-g10").returncode, 0) # not a Battlemage build
+ self.assertEqual(self.run_build().returncode, 0) # the JIT build
+ self.assertEqual(self.run_build(AOT="bmg-g31", ALLOW_BAD_OCLOC="1").returncode, 0)
+ self.log.unlink()
+ r = self.run_build(AOT="bmg-g31", I8_ESIMD="OFF") # the workaround: stubs, no check needed
+ self.assertEqual(r.returncode, 0, r.stderr)
+ self.assertIn("-DSTRATA_SYCL_I8_ESIMD=OFF", self.log.read_text())
+
+ def test_the_cmake_switch_is_declared(self):
+ text = (ROOT / "sycl" / "CMakeLists.txt").read_text(encoding="utf-8")
+ self.assertIn('set(STRATA_SYCL_I8_ESIMD "AUTO" CACHE STRING', text)
+ self.assertIn("add_compile_definitions(STRATA_I8_NO_ESIMD=1)", text)
+
+
+if __name__ == "__main__":
+ unittest.main()