MOD-14130 Fix build failures on focal cross-compilation and x86 with old binutils#912
Merged
MOD-14130 Fix build failures on focal cross-compilation and x86 with old binutils#912
Conversation
In the OPT_SVE blocks, the code incorrectly referenced sve2_supported (only defined in OPT_SVE2 block) instead of sve_supported, causing compilation errors when OPT_SVE is defined but OPT_SVE2 is not.
meiravgri
previously approved these changes
Feb 19, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #912 +/- ##
=======================================
Coverage 97.09% 97.09%
=======================================
Files 129 129
Lines 7500 7500
=======================================
Hits 7282 7282
Misses 218 218 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ST_SYSTEM_PROCESSOR
CMAKE_HOST_SYSTEM_PROCESSOR returns the host machine's architecture (where
CMake runs), while CMAKE_SYSTEM_PROCESSOR returns the target architecture
(what we're building for). In cross-compilation scenarios (e.g., building
ARM binaries on an x86 CI runner), these differ.
Using CMAKE_HOST_SYSTEM_PROCESSOR caused x86 AVX512 instructions to be
compiled when cross-compiling for ARM, resulting in assembler errors like:
Error: no such instruction: 'vfmadd132ph %zmm2,%zmm1,%zmm0{%k1}'
The compiler (GCC 13+) may support -mavx512fp16 flag, but the assembler (binutils) may be too old to handle the generated AVX512-FP16 instructions. This caused build failures on Ubuntu 20.04 (focal) which has: - GCC 13.1.0 (installed via PPA) - supports AVX512-FP16 - binutils 2.34 (system default) - does NOT support AVX512-FP16 AVX512-FP16 instructions (vfmadd132ph, vmovw, vcvtsh2ss, etc.) require binutils >= 2.38. Replace the hardcoded Ubuntu 18.04 check with proper binutils version detection: - AVX512-BF16: requires binutils >= 2.34 - AVX512-FP16: requires binutils >= 2.38
alonre24
approved these changes
Feb 22, 2026
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
This PR fixes three separate build issues affecting VectorSimilarity on different platforms:
1. SVE benchmark compilation bug (aarch64)
Files:
tests/benchmark/spaces_benchmarks/bm_spaces_int8.cpp,bm_spaces_uint8.cppCopy-paste bug:
#ifdef OPT_SVEblocks incorrectly referencedsve2_supported(only defined inOPT_SVE2block) instead ofsve_supported.2. Cross-compilation architecture detection
File:
src/VecSim/spaces/CMakeLists.txtUsed
CMAKE_HOST_SYSTEM_PROCESSOR(the machine running CMake) instead ofCMAKE_SYSTEM_PROCESSOR(the target architecture). This caused x86 AVX512 code to be compiled when cross-compiling for ARM.3. AVX512-FP16/BF16 build failure with old binutils
File:
cmake/x86_64InstructionFlags.cmakeOn systems with modern GCC (13+) but old binutils (e.g., Ubuntu 20.04 focal with binutils 2.34):
CHECK_CXX_COMPILER_FLAG(-mavx512fp16 ...)passes (GCC accepts the flag)Error: no such instruction: 'vfmadd132ph ...'Fix: Detect binutils version at configure time and disable:
CXX_AVX512BF16if binutils < 2.34CXX_AVX512FP16if binutils < 2.38Jira
https://redislabs.atlassian.net/browse/MOD-14130
Pull Request opened by Augment Code with guidance from the PR author
Pull Request opened by Augment Code with guidance from the PR author
Note
Low Risk
Build/benchmark-only changes with straightforward conditional logic; main risk is mis-detecting binutils/CPU and unintentionally enabling/disabling optimized code paths.
Overview
Fixes cross-compilation build breakages by switching VecSim spaces’ architecture gating from
CMAKE_HOST_SYSTEM_PROCESSORtoCMAKE_SYSTEM_PROCESSOR, preventing x86-only AVX sources from being compiled when targeting ARM.Improves x86 AVX512 feature detection on Linux by checking the installed
binutils/assembler version and disablingCXX_AVX512BF16(<2.34) andCXX_AVX512FP16(<2.38) when assembly support is too old.Fixes AArch64 benchmark compilation by using
sve_supported(notsve2_supported) inside#ifdef OPT_SVEblocks in the INT8/UINT8 space benchmarks.Written by Cursor Bugbot for commit dcde91f. This will update automatically on new commits. Configure here.