Skip to content

[8.2] MOD-14130 Fix build failures on focal cross-compilation and x86 with old binutils - #1125

Merged
GuyAv46 merged 3 commits into
8.2from
backport-912-to-8.2
Nov 17, 2026
Merged

GuyAv46 merged 3 commits into
8.2from
backport-912-to-8.2

Conversation

@raz-mon

@raz-mon raz-mon commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Backport of #912 to 8.2 (clean cherry-pick of e5784b1).

Why now: RediSearchEnterprise snapshot builds for RSE 8.2 fail on the Ubuntu Focal x86_64 job (Build + Pack (RoR)) with Error: no such instruction: vfmadd231ph .... The job builds with a newer GCC inside the focal container, whose binutils is 2.34. GCC accepts -mavx512fp16, so CMake enables the FP16 kernels, but the assembler cannot emit them. RediSearch 8.2 pins VecSim 8.2, so the fix must land here before the Search pin can be bumped.

What changes: the hardcoded Ubuntu 18.04 check in cmake/x86_64InstructionFlags.cmake is replaced by a binutils version check (CXX_AVX512BF16 off below 2.34, CXX_AVX512FP16 off below 2.38); src/VecSim/spaces/CMakeLists.txt gates on CMAKE_SYSTEM_PROCESSOR instead of the host's; the SVE benchmark fix from the original PR is included as-is.

Validation: ran the cmake flags file under cmake -P with a stubbed compiler check and a fake as reporting a chosen version. FP16 and BF16 both off at 2.30; FP16 off, BF16 on at 2.34; both on at 2.38 and 2.42.

Follow-up: bump deps/VectorSimilarity on RediSearch 8.2, then RSE 8.2 picks it up via the daily bump.

CI note: GitHub moved ubuntu-latest to Ubuntu 26.04 (GCC 15, binutils 2.44, clang-format 18) and this branch's PR CI had not run on it before. The PR therefore also carries two CI-only cherry-picks from main, both unrelated to the binutils change:

🤖 Generated with Claude Code

… with old binutils (#912)

* Fix SVE benchmark compilation bug on aarch64

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.

* Fix cross-compilation: use CMAKE_SYSTEM_PROCESSOR instead of CMAKE_HOST_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}'

* Fix AVX512-FP16 build on systems with old binutils

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

(cherry picked from commit e5784b1)
@raz-mon
raz-mon requested a review from GuyAv46 November 16, 2026 17:09
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.96%. Comparing base (8253c64) to head (8e75319).

Additional details and impacted files
@@           Coverage Diff           @@
##              8.2    #1125   +/-   ##
=======================================
  Coverage   96.96%   96.96%           
=======================================
  Files         126      126           
  Lines        7371     7371           
=======================================
  Hits         7147     7147           
  Misses        224      224           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add Ubuntu 26.04 install script for the new ubuntu-latest runner

GitHub's ubuntu-latest image moved to Ubuntu 26.04, and install_script.sh
failed with "ubuntu_26.04.sh: No such file or directory".

apt.llvm.org has no LLVM 18 repo for 26.04 (resolute), so install
clang-format-18 from the Ubuntu archive and point the unversioned
clang-format used by check-format.sh at it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4d9e4d2)
@raz-mon

raz-mon commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

CI status: basic tests and sanitizer were failing in the install step because ubuntu-latest is now Ubuntu 26.04 and this branch had no .install/ubuntu_26.04.sh (same failure that hit #1117 on 8.8). Pushed a cherry-pick of 4d9e4d2 from main, which adds that installer; CI is re-running. The binutils change itself is unaffected.

Fix std::vector::swap assertion failure with GCC 15

GCC 15 (Fedora 43) auto-enables _GLIBCXX_ASSERTIONS in unoptimized
builds (-O0). This activates a runtime check in std::vector::swap
(stl_vector.h:1847) that requires either propagate_on_container_swap
to be true_type, or the two allocators to compare equal.

TieredHNSW_BatchIterator::getNextResults swaps result vectors across
allocator boundaries: flat_results (management-layer allocator) is
swapped with the VecSimQueryReply returned by the frontend BF index
(frontend allocator), and similarly for hnsw_results. These allocators
are distinct VecSimAllocator instances, so operator== returns false,
triggering __glibcxx_assert_fail -> abort().

Adding propagate_on_container_swap = true_type to VecsimSTLAllocator
is safe because all VecSimAllocator instances use the same underlying
allocation functions — they differ only in memory-tracking bookkeeping,
not in actual alloc/free behavior.

(cherry picked from commit 5bcc53e)
@raz-mon

raz-mon commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Also cherry-picked 5bcc53e (MOD-14977, #938): GCC 15 on the 26.04 image enables _GLIBCXX_ASSERTIONS and the tiered batch-iterator sanitizer tests abort in std::vector::swap without propagate_on_container_swap on the allocator. This branch had not run on the new image before, so these are the first PR CI runs to hit it.

@GuyAv46
GuyAv46 added this pull request to the merge queue Nov 17, 2026
Merged via the queue into 8.2 with commit 0727de4 Nov 17, 2026
16 checks passed
@GuyAv46
GuyAv46 deleted the backport-912-to-8.2 branch November 17, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants