Skip to content

Commit

Permalink
Add gcc vector extension support (#249)
Browse files Browse the repository at this point in the history
* add simd_op template for gcc vector extension

* add 128,256,512 vector extension for simd eval tag

* add metafunction for reserve member fn detection

* add builtin math macro collection

* add ci for gcc vector extension on arm

* add ci for gcc vector extension on wasm

* add tests for gcc vector extension

* add ci for gcc vector extension on x86

* fix wams simd vector ci

* fix wams simd vector ci name

* fix wasm simd vector run tests
  • Loading branch information
alifahrri authored Oct 18, 2023
1 parent 39455e8 commit d3232d2
Show file tree
Hide file tree
Showing 30 changed files with 8,305 additions and 5 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:


jobs:
dockcross-android:
dockcross-linux-arm:
name: ${{ matrix.name }}
runs-on: ubuntu-20.04
strategy:
Expand All @@ -34,3 +34,28 @@ jobs:
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake ../.. && make -j2'
dockcross-linux-arm-simd:
name: ${{ matrix.name }}-simd-${{ matrix.arch }}-vector
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- name: linux-arm64
arch: armv8-a+simd
- name: linux-armv7
arch: armv7-a+simd
- name: linux-armv5
arch: armv5te
steps:
- uses: actions/checkout@v2
- name: setup dockcross
run: docker run --rm dockcross/${{ matrix.name }} > ./dockcross-${{ matrix.name }}; chmod +x ./dockcross-${{ matrix.name }}
- uses: actions/cache@v2
id: cache
with:
path: ./build/${{ matrix.name }}
key: ${{ github.job }}-${{ matrix.name }}-${{ hashFiles('./**') }}
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_VECTOR_TESTS=ON -DNMTOOLS_VECTOR_TEST_ALL=ON -DNMTOOLS_VECTOR_TEST_ARCH=-march=${{ matrix.arch }} ../.. && make -j2 VERBOSE=1 numeric-tests-vector-doctest'
2 changes: 1 addition & 1 deletion .github/workflows/riscv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:


jobs:
dockcross-android:
dockcross-riscv:
name: ${{ matrix.name }}
runs-on: ubuntu-20.04
strategy:
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/web-wasm-simd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,37 @@ jobs:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt update && sudo apt install nodejs
node --version
node --experimental-wasm-simd build/web-wasm-simd/tests/simd/numeric-tests-simd-doctest.wasm.js
node --experimental-wasm-simd build/web-wasm-simd/tests/simd/numeric-tests-simd-doctest.wasm.js
dockcross-wasm-simd-vector:
name: ${{ matrix.name }}-simd-vector
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- name: web-wasm-latest
image: web-wasm
tag: latest
steps:
- uses: actions/checkout@v2
- name: setup dockcross
run: docker run --rm dockcross/${{ matrix.image }}:${{ matrix.tag }} > ./dockcross-${{ matrix.name }}; chmod +x ./dockcross-${{ matrix.name }}
- uses: actions/cache@v2
id: cache
with:
path: ./build/${{ matrix.name }}
key: ${{ github.job }}-${{ matrix.name }}-${{ hashFiles('./**') }}
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: |
./dockcross-${{ matrix.name }} bash -c "emcc -v"
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/web-wasm-simd && cd build/web-wasm-simd/ && cmake -DNMTOOLS_BUILD_VECTOR_TESTS=ON -DNMTOOLS_VECTOR_TEST_ALL=ON -DNMTOOLS_VECTOR_TEST_ARCH=-msimd128 ../.. && make -j2 VERBOSE=1 numeric-tests-vector-doctest'
- name: run tests
run: |
./dockcross-${{ matrix.name }} node --version
ls build/web-wasm-simd/tests/vector
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt update && sudo apt install nodejs
node --version
node --experimental-wasm-simd build/web-wasm-simd/tests/vector/numeric-tests-vector-doctest.wasm.js
29 changes: 28 additions & 1 deletion .github/workflows/x86-simd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,31 @@ jobs:
run: ./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_SIMD_TESTS=ON -DNMTOOLS_SIMD_TEST_ALL=ON -DNMTOOLS_TEST_ALL=OFF ../.. && make -j2 numeric-tests-simd-doctest VERBOSE=1'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/simd/numeric-tests-simd-doctest'
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/simd/numeric-tests-simd-doctest'
dockcross-x86-simd-vector:
name: ${{ matrix.name }}-simd-${{ matrix.arch }}-vector
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- name: linux-x64
- name: linux-x64-clang
steps:
- uses: actions/checkout@v2
- name: setup dockcross
run: docker run --rm dockcross/${{ matrix.name }} > ./dockcross-${{ matrix.name }}; chmod +x ./dockcross-${{ matrix.name }}
- uses: actions/cache@v2
id: cache
with:
path: ./build/${{ matrix.name }}
key: ${{ github.job }}-${{ matrix.name }}-${{ hashFiles('./**') }}
- name: setup doctest
run: bash scripts/download_doctest_header.sh -d include/
- name: build
run: |
./dockcross-${{ matrix.name }} bash -c 'mkdir -p build/${{ matrix.name }} && cd build/${{ matrix.name }}/ && cmake -DNMTOOLS_BUILD_VECTOR_TESTS=ON -DNMTOOLS_VECTOR_TEST_ALL=ON ../.. && make -j2 VERBOSE=1 numeric-tests-vector-doctest'
- name: run tests
run: |
./dockcross-${{ matrix.name }} bash -c 'build/${{ matrix.name }}/tests/vector/numeric-tests-vector-doctest'
13 changes: 13 additions & 0 deletions include/nmtools/array/eval/simd/vector_128.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_128_HPP
#define NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_128_HPP

#include "nmtools/array/eval/simd/vector_extension.hpp"

namespace nmtools::array::simd
{
using vector_128_t = vector_t<128>;

constexpr inline auto vector_128 = array::simd_base_t<vector_128_t>{};
}

#endif // NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_128_HPP
13 changes: 13 additions & 0 deletions include/nmtools/array/eval/simd/vector_256.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_256_HPP
#define NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_256_HPP

#include "nmtools/array/eval/simd/vector_extension.hpp"

namespace nmtools::array::simd
{
using vector_256_t = vector_t<256>;

constexpr inline auto vector_256 = array::simd_base_t<vector_256_t>{};
}

#endif // NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_256_HPP
13 changes: 13 additions & 0 deletions include/nmtools/array/eval/simd/vector_512.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_512_HPP
#define NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_512_HPP

#include "nmtools/array/eval/simd/vector_extension.hpp"

namespace nmtools::array::simd
{
using vector_512_t = vector_t<512>;

constexpr inline auto vector_512 = array::simd_base_t<vector_512_t>{};
}

#endif // NMTOOLS_ARRAY_EVAL_SIMD_VECTOR_512_HPP
Loading

0 comments on commit d3232d2

Please sign in to comment.