Repository navigation
native preview: CPU baseline check for images above the platform baseline (x86-64-v3, armv8.1-a) - #489
Closed
tae898 wants to merge 1 commit into
Closed
native preview: CPU baseline check for images above the platform baseline (x86-64-v3, armv8.1-a)#489tae898 wants to merge 1 commit into
tae898 wants to merge 1 commit into
Conversation
…line (x86-64-v3, armv8.1-a) The shipped wheels are built with -march=compatibility and run on every CPU of their platform. A reference image built for GraalVM's default baseline died with "Illegal instruction" on an older CPU. _native/cpu.py checks all eight x86-64-v3 features (was avx2, bmi2, fma), LSE atomics for armv8.1-a on arm64 Linux and AVX2 on Windows, never blocks when the CPU cannot be read, and ARCADEDB_NATIVE_SKIP_CPU_CHECK=1 skips it. Unit tests on fake cpuinfo; README section "CPU requirements". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tae898
marked this pull request as draft
October 23, 2026 15:54
Author
|
Not needed: the native wheel ships -march=compatibility, and the laptop A/B (native-compat, reportable, A/A clean) puts its cost against x86-64-v3 at no more than about 5% on write and load paths, with queries and vector search unchanged (numbers on ArcadeData#10581). A CPU check only matters for an image above the platform baseline, which we do not ship. |
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.
Note on the base: the native preview wheel (
arcadedb-embedded-native) is not onmainyet. It lives on thenative-*branches, andnative-inlineis the newest tip, so this PR is based onnative-inline, notmain.What
arcadedb_embedded/_native/cpu.pyis a pure-Python CPU baseline check that runs beforelibarcadedbis loaded. A CPU below the image's baseline gets anArcadeDBErrorthat names the missing features, the baseline, the JVM fallback (arcadedb-embedded) andARCADEDB_NATIVE_SKIP_CPU_CHECK=1, instead ofIllegal instruction.Why, and what the baseline really is
An image that needs more than the CPU has dies with
Illegal instructionand no message. That is what a user sees afterpip installon a Proxmox VM with the default CPU type, on a Celeron/Pentium N/J (J4125, N5105), or on a Raspberry Pi 4 / AWS Graviton1 (no LSE atomics).The shipped wheels do not have this problem:
native-spike/scripts/preview-build.shdefaults toMARCH=compatibility(line 16, passed as-march=$MARCHon line 27) and.github/workflows/native-preview.ymlsetsMARCH: compatibilityfor all four platforms. That is baseline x86-64 and generic armv8-a, and it runs on every CPU in the examples above. GraalVM CE's own default (x86-64-v3 / armv8.1-a) only applies to a reference image built withMARCH=x86-64-v3or a local build with the default. So the check is a guard for those images, and it is a no-op for the published wheels: it must not refuse a Celeron or a Pi 4 on acompatibilitywheel, because that wheel runs there.lib.py::_check_cpualready existed for this case but only knew avx2, bmi2 and fma, only Linux x86-64, and had no tests. This PR replaces it with the full list and covers the other platforms.How it detects
flagsline of/proc/cpuinfo: avx, avx2, bmi1, bmi2, fma, f16c, lzcnt (orabm), movbe (the v3 list of ArcadeData#10624)Featuresline:atomics(LSE), only for anarmv8.1-aimageIsProcessorFeaturePresent(40)(AVX2) via ctypesIf the information cannot be read (no
/proc, empty flags, any exception) it logs at debug and continues.ARCADEDB_NATIVE_SKIP_CPU_CHECK=1skips the check. Nothing is checked for-march=compatibility.Docs
native-wheel/README.mdhas a new "CPU requirements" section (baseline, machines below v3, fallback), andbuild-architecture.mdand thebuild_wheel.pycomment point atcpu.py. The repo keeps no changelog.Tests
bindings/python/tests/test_native_cpu_check.py, 12 tests on fake cpuinfo and feature sets: v3 present (also LZCNT aslzcnt), AVX2 missing (J4125-like), Proxmox default CPU, Pi 4 without atomics, arm64 with atomics,compatibilitynever checks, unreadable CPU does not block, skip env var, Windows AVX2, macOS and unknown machines.PYTHONPATH=src uv run --no-project --with pytest --with jpype1 --with numpy pytest tests/test_native_cpu_check.py --noconftest: 12 passed. The CI legs build and parity-test the wheel on the four platforms.🤖 Generated with Claude Code