Repository navigation
Make AVX support an optional build arg instead of a hardcoded assumption - #3
Open
johnnyxmas wants to merge 1 commit into
Open
johnnyxmas wants to merge 1 commit into
johnnyxmas wants to merge 1 commit into
Conversation
UseAVX=true (compile-time, baked into the ReadyToRun binary) and DOTNET_EnableAVX=1 (runtime JIT) were both hardcoded with no way to override without editing the Dockerfile directly. Any CPU without AVX support -- including budget/low-power chips like Intel's Atom-derived Celeron/Pentium Silver line (e.g. Gemini Lake, common in consumer NAS devices) -- will hit an illegal-instruction fault the moment the ReadyToRun binary or a JIT-emitted code path executes an AVX instruction, since the CPU physically cannot decode it. Add ENABLE_AVX as a build arg (default 1, matching current behavior) that controls both the compile-time UseAVX flag and the runtime DOTNET_EnableAVX env var together, so builders on non-AVX hardware can opt out with `--build-arg ENABLE_AVX=0` without touching the Dockerfile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Dockerfile hardcodes AVX support at both compile time (
-p:UseAVX=true, baked into the ReadyToRun binary) and runtime (DOTNET_EnableAVX=1), with no way to override either without editing the Dockerfile.Any CPU without AVX -- including budget/low-power chips like Intel's Atom-derived Celeron/Pentium Silver line (e.g. Gemini Lake, common in consumer NAS devices) -- hits an illegal-instruction fault the moment the ReadyToRun binary or a JIT-emitted code path executes an AVX instruction, since the CPU physically cannot decode it. I ran into this building for a Celeron J4125-based Synology NAS, where the container would have crashed on startup with
SIGILL.Change
Adds
ENABLE_AVXas a build arg (default1, so behavior is unchanged for anyone not overriding it) that drives both the compile-timeUseAVXMSBuild property and the runtimeDOTNET_EnableAVXenv var together. Builders on non-AVX hardware can now do:without touching the Dockerfile. Other SSE variants, AES, POPCNT, and PCLMUL are left untouched since those are supported on essentially all relevant x86_64 hardware (Gemini Lake included) and provide real benefit.
Test plan
ENABLE_AVX=0on a Celeron J4125 (no AVX/AVX2 per/proc/cpuinfo) -- container starts and runs correctlyENABLE_AVX=1, i.e. omitted) reproduces the exact flags the Dockerfile already had, so this is a no-op for existing AVX-capable deployments