Skip to content

Commit

Permalink
Replace riscv64 vector GCC CI with clang toolchain.
Browse files Browse the repository at this point in the history
Signed-off-by: Phoebe Chen <[email protected]>
  • Loading branch information
phoebesv committed Dec 24, 2023
1 parent 86e0a93 commit 357a809
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Run tests
run: ctest --output-on-failure --parallel $(nproc)
working-directory: ${{ github.workspace }}/build/linux/riscv64
cmake-linux-riscv64-rvv:
cmake-linux-riscv64-vector:
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
Expand All @@ -101,7 +101,7 @@ jobs:
run: tar zxvf riscv64-glibc-ubuntu-22.04-llvm-nightly-2023.11.20-nightly.tar.gz
working-directory: ${{ github.workspace }}
- name: Configure and build
run: scripts/build-linux-riscv64.sh -DCMAKE_BUILD_TYPE=Release -DXNNPACK_ENABLE_RISCV_VECTOR=ON -DRISCV_TOOLCHAIN_ROOT=${{ github.workspace }}/riscv/ -DRISCV_QEMU_ROOT=${{ github.workspace }}/riscv/
run: scripts/build-linux-riscv64.sh -DCMAKE_BUILD_TYPE=Release -DXNNPACK_ENABLE_RISCV_VECTOR=ON -DUSE_GNU_SOURCE=ON -DRISCV_TOOLCHAIN_ROOT=${{ github.workspace }}/riscv/ -DRISCV_QEMU_ROOT=${{ github.workspace }}/riscv/
working-directory: ${{ github.workspace }}
- name: Run tests
run: ctest --output-on-failure --parallel $(nproc)
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ OPTION(XNNPACK_BUILD_LIBRARY "Build XNNPACK library" ON)
OPTION(XNNPACK_BUILD_TESTS "Build XNNPACK unit tests" ON)
OPTION(XNNPACK_BUILD_BENCHMARKS "Build XNNPACK benchmarks" ON)
OPTION(XNNPACK_USE_SYSTEM_LIBS "Use system-provided dependency libraries" OFF)
OPTION(USE_GNU_SOURCE "Use _GNU_SOURCE macro" OFF)


# --- [ Determine target processor
IF(CMAKE_OSX_ARCHITECTURES)
Expand Down Expand Up @@ -118,6 +120,9 @@ ADD_COMPILE_DEFINITIONS("XNN_ENABLE_DWCONV_MULTIPASS=$<BOOL:${XNNPACK_ENABLE_DWC
IF(XNNPACK_PLATFORM_JIT STREQUAL "ON" OR XNNPACK_PLATFORM_JIT STREQUAL "OFF")
ADD_COMPILE_DEFINITIONS("XNN_PLATFORM_JIT=$<BOOL:${XNNPACK_PLATFORM_JIT}>")
ENDIF()
IF(USE_GNU_SOURCE)
ADD_COMPILE_DEFINITIONS(_GNU_SOURCE)
ENDIF()

IF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
# Disable "unary minus operator applied to unsigned type, result still unsigned" warning
Expand Down
7 changes: 3 additions & 4 deletions cmake/riscv64.toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ IF(NOT RISCV_TOOLCHAIN_ROOT)
SET(CMAKE_PROGRAM_PATH "/usr/bin/riscv64-linux-gnu")
ELSE()
MESSAGE(STATUS "RISCV_TOOLCHAIN_ROOT=${RISCV_TOOLCHAIN_ROOT} is defined during compilation.")
SET(CMAKE_C_COMPILER "${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-gcc")
SET(CMAKE_ASM_COMPILER "${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-gcc")
SET(CMAKE_CXX_COMPILER "${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-g++")

SET(CMAKE_C_COMPILER "${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-clang")
SET(CMAKE_ASM_COMPILER "${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-clang")
SET(CMAKE_CXX_COMPILER "${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-clang++")
SET(CMAKE_FIND_ROOT_PATH "${RISCV_TOOLCHAIN_ROOT}/sysroot/")
SET(CMAKE_INCLUDE_PATH "${RISCV_TOOLCHAIN_ROOT}/sysroot/usr/include/")
SET(CMAKE_LIBRARY_PATH "${RISCV_TOOLCHAIN_ROOT}/sysroot/usr/lib/")
Expand Down

0 comments on commit 357a809

Please sign in to comment.