Skip to content

Commit a0f7faa

Browse files
localai-botmudler
andauthored
fix(sycl): stop building the ggml CPU variant matrix with icpx (#11321)
Since #11255 and #11276 every GPU image also builds ggml's CPU_ALL_VARIANTS matrix, so a partial offload uses the host's SIMD kernels. That works everywhere except SYCL, where the Makefile compiles the whole tree with icpx -fsycl: icpx never finishes ggml-cpu/arch/x86/repack.cpp at -march=sapphirerapids. In run 30765516644 both sycl_f16 and sycl_f32 stopped at that translation unit and sat there for 5h30m with a single compile in flight until GitHub killed the job at its 6h limit, and turboquant's f16 job lost its runner outright. gcc compiles the same file in seconds in the vulkan and CPU jobs of the same run, so the CPU variant matrix is only unbuildable under icpx. Route SYCL back to the portable fallback binary, which is what these images shipped before #11255. run.sh already prefers *-cpu-all when present and falls back otherwise, so nothing else has to change. Assisted-by: Claude Code:claude-opus-5[1m] [Read] [Edit] [Bash] Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 133c546 commit a0f7faa

6 files changed

Lines changed: 40 additions & 4 deletions

File tree

.docker/llama-cpp-build-target.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ set -euo pipefail
44
arch=${1:?target architecture is required}
55
build_type=${2-}
66

7+
# SYCL compiles the whole tree with icpx -fsycl, and icpx never finishes
8+
# ggml-cpu/arch/x86/repack.cpp at -march=sapphirerapids: the job sits on that one
9+
# translation unit until GitHub kills it at 6h. gcc builds the same file in
10+
# seconds, so only the SYCL images have to give up the CPU variant matrix.
11+
case "$build_type" in
12+
sycl*)
13+
echo llama-cpp-fallback
14+
exit 0
15+
;;
16+
esac
17+
718
# GPU arm64 base images do not consistently provide the gcc-14 toolchain needed
819
# to compile ggml's armv9.2 CPU variants. Keep their portable fallback until the
920
# builder images can supply that compiler.

.docker/turboquant-build-target.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ set -euo pipefail
44
arch=${1:?target architecture is required}
55
build_type=${2-}
66

7+
# SYCL compiles the whole tree with icpx -fsycl, and icpx never finishes
8+
# ggml-cpu/arch/x86/repack.cpp at -march=sapphirerapids: the job sits on that one
9+
# translation unit until GitHub kills it at 6h. gcc builds the same file in
10+
# seconds, so only the SYCL images have to give up the CPU variant matrix.
11+
case "$build_type" in
12+
sycl*)
13+
echo turboquant-fallback
14+
exit 0
15+
;;
16+
esac
17+
718
# GPU arm64 base images do not consistently provide the gcc-14 toolchain needed
819
# to compile ggml's armv9.2 CPU variants. Keep their portable fallback until the
920
# builder images can supply that compiler.

backend/cpp/llama-cpp/run.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ grep -e "flags" /proc/cpuinfo | head -1
1212

1313
BINARY=llama-cpp-fallback
1414

15-
# CPU images and x86 GPU images ship a single llama-cpp-cpu-all built with ggml
15+
# CPU images and most x86 GPU images ship a single llama-cpp-cpu-all built with ggml
1616
# CPU_ALL_VARIANTS: ggml's backend registry dlopens the best libggml-cpu-*.so for this
1717
# host, so no shell-side AVX probing. GPU arm64 images still ship llama-cpp-fallback
18-
# until their builder toolchains support ggml's complete arm variant matrix.
18+
# until their builder toolchains support ggml's complete arm variant matrix, and so do
19+
# the SYCL images, whose icpx compiler hangs on the sapphirerapids variant.
1920
if [ -e "$CURDIR"/llama-cpp-cpu-all ]; then
2021
BINARY=llama-cpp-cpu-all
2122
fi

backend/cpp/turboquant/run.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ grep -e "flags" /proc/cpuinfo | head -1
1212

1313
BINARY=turboquant-fallback
1414

15-
# CPU images and x86 GPU images ship a single turboquant-cpu-all built with ggml
15+
# CPU images and most x86 GPU images ship a single turboquant-cpu-all built with ggml
1616
# CPU_ALL_VARIANTS: ggml's
1717
# backend registry dlopens the best libggml-cpu-*.so for this host, so no shell-side
1818
# probing. GPU arm64 images still ship turboquant-fallback until their builder toolchains
19-
# support ggml's complete arm variant matrix.
19+
# support ggml's complete arm variant matrix, and so do the SYCL images, whose icpx
20+
# compiler hangs on the sapphirerapids variant.
2021
if [ -e "$CURDIR"/turboquant-cpu-all ]; then
2122
BINARY=turboquant-cpu-all
2223
fi

scripts/build/llama-cpp-build-target_test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ assert_target amd64 "" llama-cpp-cpu-all
2323
assert_target arm64 cublas llama-cpp-fallback
2424
assert_target arm64 "" llama-cpp-cpu-all
2525

26+
# SYCL builds the whole tree with icpx -fsycl, and icpx never finishes
27+
# ggml-cpu/arch/x86/repack.cpp at -march=sapphirerapids: every sycl job sat on
28+
# that one translation unit until GitHub killed it at its 6h limit.
29+
assert_target amd64 sycl_f16 llama-cpp-fallback
30+
assert_target amd64 sycl_f32 llama-cpp-fallback
31+
2632
echo "PASS: llama.cpp build target preserves CPU variants where supported"

scripts/build/turboquant-build-target_test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ assert_target amd64 "" turboquant-cpu-all
2323
assert_target arm64 cublas turboquant-fallback
2424
assert_target arm64 "" turboquant-cpu-all
2525

26+
# SYCL builds the whole tree with icpx -fsycl, and icpx never finishes
27+
# ggml-cpu/arch/x86/repack.cpp at -march=sapphirerapids: every sycl job sat on
28+
# that one translation unit until GitHub killed it at its 6h limit.
29+
assert_target amd64 sycl_f16 turboquant-fallback
30+
assert_target amd64 sycl_f32 turboquant-fallback
31+
2632
echo "PASS: turboquant build target preserves CPU variants where supported"

0 commit comments

Comments
 (0)