#!/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) # IQ_DECODE_FAST=OFF the earlier IQ/Q2 decode helpers (default ON: bit-exact packed arithmetic, PR #4185) # 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 <&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 rc=${PIPESTATUS[0]} # cmake's status, kept: the script ends with this, not with the status of the greps below (#2990) echo "BUILD EXIT $rc" 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 exit "$rc"