feat: Add ARM64 Linux wheel support for leann-backend-hnsw (#83)
* feat: Add ARM64 Linux wheel support for leann-backend-hnsw * fix: Use OpenBLAS for ARM64 Linux builds instead of Intel MKL * fix: Configure Faiss with SVE optimization for ARM64 builds - Set FAISS_OPT_LEVEL to "sve" for ARM64 architecture - Disable x86-specific SIMD instructions (AVX2, AVX512, SSE4.1) - Use ARM64-native SVE optimization as per Faiss conda build scripts - Add architecture detection and proper configuration messages Fixes compilation error: "xmmintrin.h: No such file or directory" on ubuntu-24.04-arm runners. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Apply ARM64 compatibility fix directly to Faiss submodule - Modify faiss/impl/pq.cpp to use x86-specific preprocessor conditions - Remove patch file approach in favor of direct submodule modification - Update CMakeLists.txt to reflect the submodule changes - Fixes ARM64 Linux compilation by preventing x86 SIMD header inclusion This resolves the "xmmintrin.h: No such file or directory" error when building ARM64 Linux wheels for Docker compatibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: Update Faiss submodule to include ARM64 compatibility fix - Points to commit ed96ff7d with x86-specific preprocessor conditions - Enables successful ARM64 Linux wheel builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * retrigger ci * fix: Use different optimization levels for ARM64 based on platform - Use SVE optimization only for ARM64 Linux - Use generic optimization for ARM64 macOS to avoid clang SVE issues - Fixes macOS ARM64 compilation errors with SVE instructions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: Update DiskANN submodule with OpenBLAS fallback support - Points to commit 5c396c4 with ARM64 Linux OpenBLAS support - Enables DiskANN to build on ARM64 Linux using standard BLAS libraries - Resolves Intel MKL dependency issues for Docker ARM64 deployments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with ZeroMQ polling configuration - Points to commit 3a1016e with explicit polling method setup - Resolves ZeroMQ autodetection issues on ARM64 Linux - Ensures stable cross-platform ZeroMQ builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * retrigger ci * fix: Update DiskANN submodule with ARM64 compiler flags fix - Points to commit a0dc600 with architecture-specific compiler flags - Removes x86 SIMD flags on ARM64 Linux to fix compilation errors - Enables successful ARM64 Linux wheel builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with ARM64 compiler flags fix - Points to commit 0921664 with architecture-specific compiler flags - Removes x86 SIMD flags on ARM64 Linux to fix compilation errors - Enables successful ARM64 Linux wheel builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * retrigger ci * fix: Update DiskANN submodule with cross-platform prefetch support - Points to commit 39192d6 with unified prefetch macros - Replaces all Intel-specific _mm_prefetch calls with cross-platform macros - Enables ARM64 Linux compatibility while maintaining x86 performance - Resolves all remaining compilation errors for ARM64 builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with corrected ARM64 compatibility fixes - Points to commit 3cb87a8 with proper x86 platform detection - Includes ARM64 fallback for AVXDistanceInnerProductFloat function - Resolves all remaining '__m256 was not declared' compilation errors - Enables successful ARM64 Linux wheel builds for Docker compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with template type handling fix - Points to commit d396bc3 with corrected template type handling - Fixes DistanceInnerProduct template instantiation for int8_t/uint8_t types - Resolves 'cannot convert const signed char* to const float*' error - Completes ARM64 Linux compilation compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with DistanceFastL2::norm template fix - Points to commit 69d9a99 with corrected template type handling - Fixes DistanceFastL2::norm template instantiation for int8_t/uint8_t types - Resolves another 'cannot convert const signed char* to const float*' error - Continues ARM64 Linux compilation compatibility improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with LAPACKE header detection - Points to commit 64a9e01 with LAPACKE header path configuration - Adds pkg-config based detection for LAPACKE include directories - Resolves 'lapacke.h: No such file or directory' compilation error - Completes OpenBLAS integration for ARM64 Linux builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with enhanced LAPACKE header detection - Points to commit 18d0721 with fallback LAPACKE header search paths - Checks multiple standard locations for lapacke.h on various systems - Improves ARM64 Linux compatibility for OpenBLAS builds - Should resolve 'lapacke.h: No such file or directory' errors 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Add liblapacke-dev package for ARM64 Linux builds - Add liblapacke-dev to ARM64 dependencies alongside libopenblas-dev - Provides lapacke.h header file needed for LAPACK C interface - Fixes 'lapacke.h: No such file or directory' compilation error - Enables complete OpenBLAS + LAPACKE support for ARM64 wheel builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with cosine_similarity.h x86 intrinsics fix - Points to commit dbb17eb with corrected conditional compilation - Fixes immintrin.h inclusion for ARM64 compatibility in cosine_similarity.h - Resolves 'immintrin.h: No such file or directory' error - Continues systematic ARM64 Linux compilation fixes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Update DiskANN submodule with LAPACKE library linking fix - Points to commit 19f9603 with explicit LAPACKE library discovery and linking - Resolves 'undefined symbol: LAPACKE_sgesdd' runtime error on ARM64 Linux - Completes ARM64 Linux wheel build compatibility for Docker deployments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
58
.github/workflows/build-reusable.yml
vendored
58
.github/workflows/build-reusable.yml
vendored
@@ -54,6 +54,17 @@ jobs:
|
||||
python: '3.12'
|
||||
- os: ubuntu-22.04
|
||||
python: '3.13'
|
||||
# ARM64 Linux builds
|
||||
- os: ubuntu-24.04-arm
|
||||
python: '3.9'
|
||||
- os: ubuntu-24.04-arm
|
||||
python: '3.10'
|
||||
- os: ubuntu-24.04-arm
|
||||
python: '3.11'
|
||||
- os: ubuntu-24.04-arm
|
||||
python: '3.12'
|
||||
- os: ubuntu-24.04-arm
|
||||
python: '3.13'
|
||||
- os: macos-14
|
||||
python: '3.9'
|
||||
- os: macos-14
|
||||
@@ -108,13 +119,46 @@ jobs:
|
||||
pkg-config libabsl-dev libaio-dev libprotobuf-dev \
|
||||
patchelf
|
||||
|
||||
# Install Intel MKL for DiskANN
|
||||
wget -q https://registrationcenter-download.intel.com/akdlm/IRC_NAS/79153e0f-74d7-45af-b8c2-258941adf58a/intel-onemkl-2025.0.0.940.sh
|
||||
sudo sh intel-onemkl-2025.0.0.940.sh -a --components intel.oneapi.lin.mkl.devel --action install --eula accept -s
|
||||
source /opt/intel/oneapi/setvars.sh
|
||||
echo "MKLROOT=/opt/intel/oneapi/mkl/latest" >> $GITHUB_ENV
|
||||
echo "LD_LIBRARY_PATH=/opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64_lin" >> $GITHUB_ENV
|
||||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/oneapi/mkl/latest/lib/intel64" >> $GITHUB_ENV
|
||||
# Debug: Show system information
|
||||
echo "🔍 System Information:"
|
||||
echo "Architecture: $(uname -m)"
|
||||
echo "OS: $(uname -a)"
|
||||
echo "CPU info: $(lscpu | head -5)"
|
||||
|
||||
# Install math library based on architecture
|
||||
ARCH=$(uname -m)
|
||||
echo "🔍 Setting up math library for architecture: $ARCH"
|
||||
|
||||
if [[ "$ARCH" == "x86_64" ]]; then
|
||||
# Install Intel MKL for DiskANN on x86_64
|
||||
echo "📦 Installing Intel MKL for x86_64..."
|
||||
wget -q https://registrationcenter-download.intel.com/akdlm/IRC_NAS/79153e0f-74d7-45af-b8c2-258941adf58a/intel-onemkl-2025.0.0.940.sh
|
||||
sudo sh intel-onemkl-2025.0.0.940.sh -a --components intel.oneapi.lin.mkl.devel --action install --eula accept -s
|
||||
source /opt/intel/oneapi/setvars.sh
|
||||
echo "MKLROOT=/opt/intel/oneapi/mkl/latest" >> $GITHUB_ENV
|
||||
echo "LD_LIBRARY_PATH=/opt/intel/oneapi/compiler/latest/linux/compiler/lib/intel64_lin" >> $GITHUB_ENV
|
||||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/oneapi/mkl/latest/lib/intel64" >> $GITHUB_ENV
|
||||
echo "✅ Intel MKL installed for x86_64"
|
||||
|
||||
# Debug: Check MKL installation
|
||||
echo "🔍 MKL Installation Check:"
|
||||
ls -la /opt/intel/oneapi/mkl/latest/ || echo "MKL directory not found"
|
||||
ls -la /opt/intel/oneapi/mkl/latest/lib/ || echo "MKL lib directory not found"
|
||||
|
||||
elif [[ "$ARCH" == "aarch64" ]]; then
|
||||
# Use OpenBLAS for ARM64 (MKL installer not compatible with ARM64)
|
||||
echo "📦 Installing OpenBLAS for ARM64..."
|
||||
sudo apt-get install -y libopenblas-dev liblapack-dev liblapacke-dev
|
||||
echo "✅ OpenBLAS installed for ARM64"
|
||||
|
||||
# Debug: Check OpenBLAS installation
|
||||
echo "🔍 OpenBLAS Installation Check:"
|
||||
dpkg -l | grep openblas || echo "OpenBLAS package not found"
|
||||
ls -la /usr/lib/aarch64-linux-gnu/openblas/ || echo "OpenBLAS directory not found"
|
||||
fi
|
||||
|
||||
# Debug: Show final library paths
|
||||
echo "🔍 Final LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
|
||||
|
||||
- name: Install system dependencies (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
|
||||
Reference in New Issue
Block a user