-
Notifications
You must be signed in to change notification settings - Fork 307
Add LoongArch64 support #1402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add LoongArch64 support #1402
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| set(CMAKE_SYSTEM_PROCESSOR loongarch64) | ||
| set(triple loongarch64-linux-gnu) | ||
|
|
||
| include(${CMAKE_CURRENT_LIST_DIR}/gcc.cmake) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| name: LoongArch64 cross-compilation build | ||
| on: [push, pull_request] | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| name: 'LoongArch64 ${{ matrix.simd.name }}' | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| simd: | ||
| - { name: 'LSX', flags: '-mlsx' } | ||
| - { name: 'LASX', flags: '-mlasx' } | ||
| steps: | ||
| - name: Setup compiler | ||
| run: | | ||
| sudo apt-get -y -qq update | ||
| sudo apt-get -y -qq --no-install-suggests --no-install-recommends install \ | ||
| gcc-14-loongarch64-linux-gnu \ | ||
| g++-14-loongarch64-linux-gnu | ||
| sudo update-alternatives --install /usr/bin/loongarch64-linux-gnu-gcc \ | ||
| loongarch64-linux-gnu-gcc /usr/bin/loongarch64-linux-gnu-gcc-14 20 | ||
| sudo update-alternatives --install /usr/bin/loongarch64-linux-gnu-g++ \ | ||
| loongarch64-linux-gnu-g++ /usr/bin/loongarch64-linux-gnu-g++-14 20 | ||
| loongarch64-linux-gnu-g++ --version | ||
| - name: Setup QEMU | ||
| run: | | ||
| sudo apt-get -y -qq update | ||
| sudo apt-get -y -qq --no-install-suggests --no-install-recommends install qemu-user-static | ||
| qemu-loongarch64-static --version | ||
| - name: Setup Ninja | ||
| run: | | ||
| sudo apt-get -y -qq install ninja-build | ||
| - name: Checkout xsimd | ||
| uses: actions/checkout@v6 | ||
| - name: Setup | ||
| run: >- | ||
| cmake -S . -B _build | ||
| -GNinja | ||
| -DBUILD_TESTS=ON | ||
| -DDOWNLOAD_DOCTEST=ON | ||
| -DCMAKE_BUILD_TYPE=Release | ||
| -DTARGET_ARCH=generic | ||
| -DCMAKE_C_FLAGS="${{ matrix.simd.flags }}" | ||
| -DCMAKE_CXX_FLAGS="${{ matrix.simd.flags }}" | ||
| -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/.github/toolchains/gcc-loongarch64-linux-gnu.cmake | ||
| - name: Build | ||
| run: cmake --build _build | ||
| - name: Set CPU feature test expectations | ||
| run: | | ||
| echo "XSIMD_TEST_CPU_ASSUME_SSE4_2=0" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_NEON64=0" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_SVE=0" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_RVV=0" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_LSX=1" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_LASX=1" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_VSX=0" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_VXE=0" >> "$GITHUB_ENV" | ||
| echo "XSIMD_TEST_CPU_ASSUME_MANUFACTURER=unknown" >> "$GITHUB_ENV" | ||
| - name: Testing xsimd | ||
| timeout-minutes: 15 | ||
| run: qemu-loongarch64-static -L /usr/loongarch64-linux-gnu ./test/test_xsimd | ||
| working-directory: ${{ github.workspace }}/_build | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ INPUT = ../include/xsimd/types/xsimd_api.hpp \ | |
| ../include/xsimd/types/xsimd_neon64_register.hpp \ | ||
| ../include/xsimd/types/xsimd_neon_register.hpp \ | ||
| ../include/xsimd/types/xsimd_rvv_register.hpp \ | ||
| ../include/xsimd/types/xsimd_lsx_register.hpp \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there should be an lsx register file and an lasx register file |
||
| ../include/xsimd/types/xsimd_sse2_register.hpp \ | ||
| ../include/xsimd/types/xsimd_sse3_register.hpp \ | ||
| ../include/xsimd/types/xsimd_sse4_1_register.hpp \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,10 @@ | |
| #include "./xsimd_rvv.hpp" | ||
| #endif | ||
|
|
||
| #if XSIMD_WITH_LSX || XSIMD_WITH_LASX | ||
| #include "./xsimd_lsx.hpp" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and a split between the different implementation here. the idea is that lsx support could be on even when lasx is not supported |
||
| #endif | ||
|
|
||
| #if XSIMD_WITH_WASM | ||
| #include "./xsimd_wasm.hpp" | ||
| #endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect two different runs with different qemu invocation and different feature tests, one for LSX and one for LASX?