mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1584] fix(docker): support CPUs without AVX2 (AVX / SSE4.2 fallback & ISA floor detection) #634
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#634
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @przemsiedl on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1584
Description
git-diff-hotfix.txt
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).
@Niko1221 commented on GitHub (Oct 10, 2026):
Thank you for the diagnosis. The engine's AVX2 kernels sit behind the ISA guard (tools/check_isa_guard.py), and changing the ISA floor for the image goes through that guard, so we took the part that is safe to do now: docker-entrypoint.sh warns clearly when the host CPU has no AVX2 and says to build the image on that machine, instead of letting the container die on an illegal instruction. It warns and goes on, it does not refuse. The older-CPU build itself is the experimental one in docs/INSTALL.md (Older CPUs). Your STRATA_ISA_FLOOR build argument and the isa_floor entry in BUILD.json are a larger change; we keep them for the review of the image build.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.