Skip to content

Commit 5a2471d

Browse files
committed
fix(sglang): force AVX-512 CXXFLAGS and disable CI e2e job
sgl-kernel's shm.cpp uses __m512 AVX-512 intrinsics unconditionally; -march=native fails on CI runners without AVX-512 in /proc/cpuinfo. Force -march=sapphirerapids so the build always succeeds, matching sglang upstream's docker/xeon.Dockerfile recipe. The resulting binary still requires an AVX-512 capable CPU at runtime, so disable tests-sglang-grpc in test-extra.yml for the same reason tests-vllm-grpc is disabled. Local runs with make test-extra-backend-sglang still work on hosts with the right SIMD baseline. Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent cd4bd28 commit 5a2471d

3 files changed

Lines changed: 54 additions & 28 deletions

File tree

.github/workflows/test-extra.yml

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -590,32 +590,48 @@ jobs:
590590
# - name: Build vllm (cpu) backend image and run gRPC e2e tests
591591
# run: |
592592
# make test-extra-backend-vllm
593-
tests-sglang-grpc:
594-
needs: detect-changes
595-
if: needs.detect-changes.outputs.sglang == 'true' || needs.detect-changes.outputs.run-all == 'true'
596-
runs-on: ubuntu-latest
597-
timeout-minutes: 90
598-
steps:
599-
- name: Clone
600-
uses: actions/checkout@v6
601-
with:
602-
submodules: true
603-
- name: Dependencies
604-
run: |
605-
sudo apt-get update
606-
sudo apt-get install -y --no-install-recommends \
607-
make build-essential curl unzip ca-certificates git tar
608-
- name: Setup Go
609-
uses: actions/setup-go@v5
610-
with:
611-
go-version: '1.25.4'
612-
- name: Free disk space
613-
run: |
614-
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL || true
615-
df -h
616-
- name: Build sglang (cpu) backend image and run gRPC e2e tests
617-
run: |
618-
make test-extra-backend-sglang
593+
# tests-sglang-grpc is currently disabled in CI for the same reason as
594+
# tests-vllm-grpc: sglang's CPU kernel (sgl-kernel) uses __m512 AVX-512
595+
# intrinsics unconditionally in shm.cpp, so the from-source build
596+
# requires `-march=sapphirerapids` (already set in install.sh) and the
597+
# resulting binary SIGILLs at import on CPUs without AVX-512 VNNI/BF16.
598+
# The ubuntu-latest runner pool does not guarantee that ISA baseline.
599+
#
600+
# The test itself (tests/e2e-backends + make test-extra-backend-sglang)
601+
# is fully working and validated locally on a host with the right
602+
# SIMD baseline. Run it manually with:
603+
#
604+
# make test-extra-backend-sglang
605+
#
606+
# Re-enable this job once we have a self-hosted runner label with
607+
# guaranteed AVX-512 VNNI/BF16 support.
608+
#
609+
# tests-sglang-grpc:
610+
# needs: detect-changes
611+
# if: needs.detect-changes.outputs.sglang == 'true' || needs.detect-changes.outputs.run-all == 'true'
612+
# runs-on: bigger-runner
613+
# timeout-minutes: 90
614+
# steps:
615+
# - name: Clone
616+
# uses: actions/checkout@v6
617+
# with:
618+
# submodules: true
619+
# - name: Dependencies
620+
# run: |
621+
# sudo apt-get update
622+
# sudo apt-get install -y --no-install-recommends \
623+
# make build-essential curl unzip ca-certificates git tar
624+
# - name: Setup Go
625+
# uses: actions/setup-go@v5
626+
# with:
627+
# go-version: '1.25.4'
628+
# - name: Free disk space
629+
# run: |
630+
# sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL || true
631+
# df -h
632+
# - name: Build sglang (cpu) backend image and run gRPC e2e tests
633+
# run: |
634+
# make test-extra-backend-sglang
619635
tests-acestep-cpp:
620636
needs: detect-changes
621637
if: needs.detect-changes.outputs.acestep-cpp == 'true' || needs.detect-changes.outputs.run-all == 'true'

backend/python/sglang/install.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ if [ "x${BUILD_TYPE}" == "x" ] || [ "x${FROM_SOURCE:-}" == "xtrue" ]; then
5050
# present in the venv before we build from source.
5151
uv pip install --no-build-isolation "scikit-build-core>=0.10" ninja cmake
5252

53+
# sgl-kernel's CPU shm.cpp uses __m512 AVX-512 intrinsics unconditionally.
54+
# CMakeLists passes -march=native, which on runners without AVX-512 in
55+
# /proc/cpuinfo (ubuntu-latest, most shared CI pools) fails with
56+
# "__m512 return without 'avx512f' enabled changes the ABI".
57+
# Force Sapphire Rapids ISA at compile time so the build always succeeds;
58+
# the resulting binary still requires an AVX-512 capable CPU at runtime,
59+
# same constraint sglang upstream documents in docker/xeon.Dockerfile.
60+
export CXXFLAGS="${CXXFLAGS:-} -march=sapphirerapids"
61+
export CFLAGS="${CFLAGS:-} -march=sapphirerapids"
62+
5363
_sgl_src=$(mktemp -d)
5464
trap 'rm -rf "${_sgl_src}"' EXIT
5565
git clone --depth 1 https://github.com/sgl-project/sglang "${_sgl_src}/sglang"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--extra-index-url https://download.pytorch.org/whl/cu124
22
accelerate
3-
torch==2.9.1
3+
torch==2.7.1
44
torchvision
5-
torchaudio==2.9.1
5+
torchaudio==2.7.1
66
transformers

0 commit comments

Comments
 (0)