Issues / #1584

#1584 fix(docker): support CPUs without AVX2 (AVX / SSE4.2 fallback & ISA floor detection)

open · @przemsiedl · 0 comments · View on GitHub

Setup & installServer & APIDocumentationLinux

Description

Description

[git-diff-hotfix.txt](https://github.com/user-attachments/files/33212987/git-diff-hotfix.txt)
[Strata-hotfix.zip](https://github.com/user-attachments/files/33212986/Strata-hotfix.zip)

On host systems with older CPU architectures that lack AVX2 support (e.g., Intel Xeon E5-2640 / Sandy Bridge-EP), running or restarting the Docker container failed or triggered an unintended recompilation on every launch.

Mechanism: The pre-built image binary defaults to an AVX2 instruction baseline. When executed on hardware lacking AVX2, the binary fails due to illegal instructions (SIGILL) or forces setup.py to recompile the engine inside the ephemeral container layer. Because container storage is non-persistent for the engine binary, every restart lost the recompiled binary and repeated the build process.

Environment Details
CPU Model: Intel(R) Xeon(R) CPU E5-2640 0 @ 2.50GHz (2 Sockets x 6 Cores / 12 Threads)

Supported Instruction Sets: sse4_1, sse4_2, avx, aes, xsave (Missing: avx2, fma, bmi2)

Memory: 112 GB RAM

Container Runtime: Podman / Docker on Linux

CPU Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid xsaveopt dtherm ida arat pln pts vnmi md_clear flush_l1d

MemTotal: 117440512 kB
MemAvailable: 46945817 kB
Solution / Applied Changes
The attached hotfix introduces explicit ISA floor configuration and runtime check logic:

Docker Build Argument (STRATA_ISA_FLOOR):

Added ARG STRATA_ISA_FLOOR= (avx | none) to Dockerfile.

Enables pre-building docker images targeted at older hardware:

Bash
docker build -t strata --build-arg STRATA_ISA_FLOOR=avx .
ISA Floor Detection & Metadata Tracking (setup.py):

Implemented this_cpu_floor() to evaluate host CPU instruction level (avx2, avx, sse4.2, or unsupported).

Stored isa_floor in BUILD.json metadata.

Updated ensure_engine_for() and build_engine() to verify if the compiled binary matches the host ISA floor before execution, preventing silent crashes or invalid reuse.

Vision Pipeline Build Parity (tools/vision/CMakeLists.txt):

Forwarded STRATA_ISA_FLOOR to the vision tool build configuration to ensure ggml-cpu flags match the main engine (GGML_AVX=ON, GGML_AVX2=OFF).

Documentation & Tests:

Updated docs/INSTALL.md with instructions for non-AVX2 hardware deployment.

Added unit tests in tools/test_setup_oldcpu.py.

Attached Files
git-diff-hotfix.txt (Contains all code modifications across Dockerfile, setup.py, INSTALL.md, tools/vision/CMakeLists.txt, and unit tests).

Related on strata.com

Editorial links to help you install, pick models, or read release notes — not part of the upstream thread.