From bf8be4a79bdc4d1aac60f4ec0c7190123c973a0a Mon Sep 17 00:00:00 2001 From: anthony-zy Date: Mon, 21 Sep 2026 16:23:17 -0700 Subject: [PATCH] fix(ci): use GCC 14 riscv64 cross-compiler for RVV tuple/zvfhmin intrinsics (#5653) Summary: fix(ci): use GCC 14 riscv64 cross-compiler for RVV tuple/zvfhmin intrinsics The linux-riscv64-DD CI job installs the default cross-compiler from Ubuntu noble, which resolves to GCC 13.3. GCC 13's does not export the RVV tuple types (vuint8m1x3_t) nor the zvfhmin f16 intrinsics (vfloat16m1_t, __riscv_vle16_v_f16m1, __riscv_vfwcvt_f_f_v_f32m2) used by the SQ RVV kernels, so building sq-rvv.cpp failed with "'vuint8m1x3_t' was not declared in this scope" (and similar) in the Codec6bit software-pipelined loops and the QuantizerFP16 fast paths. The intrinsics used are all legal under -march=rv64gcv_zvfhmin (only vle16/vse16/vfwcvt/vfncvt on f16) and are fully supported starting with GCC 14, so no source changes are needed. Explicitly install gcc-14-riscv64-linux-gnu / g++-14-riscv64-linux-gnu and point the toolchain file at the versioned binaries, avoiding any reliance on update-alternatives defaults. A version self-check in the workflow makes the resolved compiler visible in the CI log. Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5653 Reviewed By: alibeklfc Differential Revision: D120734761 Pulled By: mnorris11 fbshipit-source-id: d82cf2c99dfd6e8720f31bdadb718806f9e71044 --- .github/workflows/build-pull-request.yml | 9 +++++++-- cmake/toolchains/riscv64-linux-gnu.cmake | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index c3abfc228..ee18252ed 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -391,12 +391,17 @@ jobs: sudo apt-get update -qq sudo apt-get install -y -qq \ cmake \ - gcc-riscv64-linux-gnu \ - g++-riscv64-linux-gnu \ + gcc-14-riscv64-linux-gnu \ + g++-14-riscv64-linux-gnu \ libopenblas-dev:riscv64 \ libgomp1:riscv64 \ qemu-user-static + # GCC 13's lacks the RVV tuple types (e.g. + # vuint8m1x3_t) and the zvfhmin f16 intrinsics the SQ kernels use; + # GCC 14 is required. Fail fast if the default still points at 13. + riscv64-linux-gnu-g++-14 --version + # Bridge Ubuntu's multiarch library directory into the sysroot so # that CMake's find_library() (ONLY mode, root=/usr/riscv64-linux-gnu) # can reach packages installed as :riscv64. diff --git a/cmake/toolchains/riscv64-linux-gnu.cmake b/cmake/toolchains/riscv64-linux-gnu.cmake index e2655397e..2914d7e0d 100644 --- a/cmake/toolchains/riscv64-linux-gnu.cmake +++ b/cmake/toolchains/riscv64-linux-gnu.cmake @@ -19,8 +19,10 @@ set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR riscv64) -set(CMAKE_C_COMPILER riscv64-linux-gnu-gcc) -set(CMAKE_CXX_COMPILER riscv64-linux-gnu-g++) +# GCC 14+: the RVV SQ kernels rely on tuple types (vuint8m1x3_t) and +# zvfhmin f16 intrinsics that GCC 13's does not export. +set(CMAKE_C_COMPILER riscv64-linux-gnu-gcc-14) +set(CMAKE_CXX_COMPILER riscv64-linux-gnu-g++-14) # Cross-compiler sysroot provided by gcc-riscv64-linux-gnu. set(CMAKE_FIND_ROOT_PATH /usr/riscv64-linux-gnu)