-
Notifications
You must be signed in to change notification settings - Fork 301
Add CMakePresets for target micro arch #1348
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
Open
AntoinePrv
wants to merge
9
commits into
xtensor-stack:master
Choose a base branch
from
AntoinePrv:cmake-presets
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+385
−100
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f4ff814
Add CMakePresets.txt
AntoinePrv b11e218
Use presets in CI
AntoinePrv 1993164
Only setup i386 support as needed
AntoinePrv bd85916
SDE skylake
AntoinePrv 300a00b
TMP: No avx512vl_256
AntoinePrv 33ebd43
Adjust x86 architectures
AntoinePrv 397718b
Disambiguate avx512f load_masked
AntoinePrv c573d9d
Set target arch
AntoinePrv 7ad91b2
Reintroduce avx512vl_256
AntoinePrv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,65 +10,72 @@ defaults: | |
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| name: '${{ matrix.sys.compiler }} ${{ matrix.sys.version }} - ${{ matrix.sys.flags }}' | ||
| name: '${{ matrix.sys.compiler }} ${{ matrix.sys.version }} - ${{ matrix.sys.preset }} - ${{ matrix.sys.flags }}' | ||
| strategy: | ||
| matrix: | ||
| sys: | ||
| - { compiler: 'gcc', version: '12', flags: 'force_no_instr_set' } | ||
| - { compiler: 'gcc', version: '13', flags: 'enable_xtl_complex' } | ||
| - { compiler: 'gcc', version: '14', flags: 'avx' } | ||
| - { compiler: 'gcc', version: '14', flags: 'avx2' } | ||
| - { compiler: 'gcc', version: '13', flags: 'avx512' } | ||
| - { compiler: 'gcc', version: '10', flags: 'avx512' } | ||
| - { compiler: 'gcc', version: '12', flags: 'i386' } | ||
| - { compiler: 'gcc', version: '13', flags: 'avx512pf' } | ||
| - { compiler: 'gcc', version: '13', flags: 'avx512vbmi' } | ||
| - { compiler: 'gcc', version: '14', flags: 'avx512vbmi2' } | ||
| - { compiler: 'gcc', version: '13', flags: 'avx512vnni' } | ||
| - { compiler: 'clang', version: '16', flags: 'force_no_instr_set' } | ||
| - { compiler: 'clang', version: '16', flags: 'enable_xtl_complex' } | ||
| - { compiler: 'clang', version: '17', flags: 'avx' } | ||
| - { compiler: 'clang', version: '17', flags: 'sse3' } | ||
| - { compiler: 'clang', version: '18', flags: 'avx512' } | ||
| - { compiler: 'clang', version: '18', flags: 'avx_128' } | ||
| - { compiler: 'clang', version: '18', flags: 'avx2_128' } | ||
| - { compiler: 'clang', version: '18', flags: 'avx512vl_256' } | ||
| - { compiler: 'gcc', version: '12', flags: 'force_no_instr_set', preset: 'native' } | ||
| - { compiler: 'gcc', version: '13', flags: 'enable_xtl_complex', preset: 'native' } | ||
| - { compiler: 'gcc', version: '14', flags: '', preset: 'avx' } | ||
| - { compiler: 'gcc', version: '14', flags: '', preset: 'avx2' } | ||
| - { compiler: 'gcc', version: '13', flags: '', preset: 'avx512f' } | ||
| - { compiler: 'gcc', version: '10', flags: '', preset: 'avx512f' } | ||
| - { compiler: 'gcc', version: '12', flags: 'i386', preset: 'native' } | ||
| - { compiler: 'gcc', version: '13', flags: '', preset: 'avx512pf' } | ||
| - { compiler: 'gcc', version: '13', flags: '', preset: 'avx512vbmi' } | ||
| - { compiler: 'gcc', version: '14', flags: '', preset: 'avx512vbmi2' } | ||
| - { compiler: 'gcc', version: '13', flags: '', preset: 'avx512vnni_avx512bw' } | ||
| - { compiler: 'clang', version: '16', flags: 'force_no_instr_set', preset: 'native' } | ||
| - { compiler: 'clang', version: '16', flags: 'enable_xtl_complex', preset: 'native' } | ||
| - { compiler: 'clang', version: '17', flags: '', preset: 'avx' } | ||
| - { compiler: 'clang', version: '17', flags: '', preset: 'sse3' } | ||
| - { compiler: 'clang', version: '18', flags: '', preset: 'avx512f' } | ||
| - { compiler: 'clang', version: '18', flags: '', preset: 'avx_128' } | ||
| - { compiler: 'clang', version: '18', flags: '', preset: 'avx2_128' } | ||
| - { compiler: 'clang', version: '18', flags: '', preset: 'avx512vl_256' } | ||
| steps: | ||
| - name: Setup compiler | ||
| - name: Setup GCC compiler | ||
| if: ${{ matrix.sys.compiler == 'gcc' }} | ||
| run: | | ||
| GCC_VERSION=${{ matrix.sys.version }} | ||
| sudo apt-get update | ||
| sudo apt-get --no-install-suggests --no-install-recommends install g++-$GCC_VERSION | ||
| sudo dpkg --add-architecture i386 | ||
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test | ||
| sudo apt-get update | ||
| sudo apt-get --no-install-suggests --no-install-recommends install gcc-$GCC_VERSION-multilib g++-$GCC_VERSION-multilib linux-libc-dev:i386 | ||
| CC=gcc-$GCC_VERSION | ||
| echo "CC=$CC" >> $GITHUB_ENV | ||
| CXX=g++-$GCC_VERSION | ||
| echo "CXX=$CXX" >> $GITHUB_ENV | ||
| - name: Setup compiler | ||
| # Setup i386 as needed | ||
| if [[ '${{ matrix.sys.flags }}' == 'i386' ]]; then | ||
| sudo dpkg --add-architecture i386 | ||
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test | ||
| sudo apt-get update | ||
| sudo apt-get --no-install-suggests --no-install-recommends install \ | ||
| gcc-$GCC_VERSION-multilib g++-$GCC_VERSION-multilib linux-libc-dev:i386 | ||
| fi | ||
| # Export compiler as environment var | ||
| echo "CC=gcc-$GCC_VERSION" >> $GITHUB_ENV | ||
| echo "CXX=g++-$GCC_VERSION" >> $GITHUB_ENV | ||
|
|
||
| - name: Setup Clang compiler | ||
| if: ${{ matrix.sys.compiler == 'clang' }} | ||
| run: | | ||
| LLVM_VERSION=${{ matrix.sys.version }} | ||
| sudo apt-get update || exit 1 | ||
| sudo apt-get --no-install-suggests --no-install-recommends install clang-$LLVM_VERSION || exit 1 | ||
| sudo apt-get --no-install-suggests --no-install-recommends install g++ g++-multilib || exit 1 | ||
| sudo ln -s /usr/include/asm-generic /usr/include/asm | ||
| CC=clang-$LLVM_VERSION | ||
| echo "CC=$CC" >> $GITHUB_ENV | ||
| CXX=clang++-$LLVM_VERSION | ||
| echo "CXX=$CXX" >> $GITHUB_ENV | ||
| # Export compiler as environment var | ||
| echo "CC=clang-$LLVM_VERSION" >> $GITHUB_ENV | ||
| echo "CXX=clang++-$LLVM_VERSION" >> $GITHUB_ENV | ||
|
|
||
| - name: Checkout xsimd | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Install mamba | ||
| uses: mamba-org/setup-micromamba@v2 | ||
| uses: mamba-org/setup-micromamba@v3 | ||
| with: | ||
| environment-file: environment.yml | ||
|
|
||
| - name: Setup SDE | ||
| if: startswith(matrix.sys.flags, 'avx512') | ||
| if: startswith(matrix.sys.preset, 'avx512') | ||
| run: sh install_sde.sh | ||
|
|
||
| - name: Configure build | ||
| env: | ||
| CC: ${{ env.CC }} | ||
|
|
@@ -77,82 +84,47 @@ jobs: | |
| if [[ '${{ matrix.sys.flags }}' == 'enable_xtl_complex' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DENABLE_XTL_COMPLEX=ON" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=sandybridge" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx_128' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=sandybridge" | ||
| CXXFLAGS="$CXX_FLAGS -DXSIMD_DEFAULT_ARCH=avx_128" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx2' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=haswell" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx2_128' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=haswell" | ||
| CXXFLAGS="$CXX_FLAGS -DXSIMD_DEFAULT_ARCH=avx2_128" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'sse3' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=nocona" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx512' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=skylake-avx512" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx512vl_256' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=skylake-avx512" | ||
| CXXFLAGS="$CXX_FLAGS -DXSIMD_DEFAULT_ARCH=avx512vl_256" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx512pf' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=knl" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx512vbmi' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=cannonlake" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx512vbmi2' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=icelake-server" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'avx512vnni' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DTARGET_ARCH=knm" | ||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'i386' ]]; then | ||
| CXX_FLAGS="$CXX_FLAGS -m32" | ||
| export CXXFLAGS="$CXXFLAGS -m32" | ||
|
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. !!! |
||
| fi | ||
| if [[ '${{ matrix.sys.flags }}' == 'force_no_instr_set' ]]; then | ||
| : | ||
| else | ||
| if [[ '${{ matrix.sys.flags }}' != 'force_no_instr_set' ]]; then | ||
| CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DXSIMD_ENABLE_WERROR=ON" | ||
| fi | ||
|
|
||
| # Cheap way of spotting uninitialized read | ||
| CXX_FLAGS="$CXX_FLAGS -ftrivial-auto-var-init=pattern" | ||
| # Cheap way of spotting uninitialized read; presets pick this up via $env{CXXFLAGS}. | ||
| export CXXFLAGS="$CXXFLAGS -ftrivial-auto-var-init=pattern" | ||
|
|
||
| cmake -B _build \ | ||
| -DBUILD_TESTS=ON \ | ||
| -DBUILD_BENCHMARK=ON \ | ||
| -DBUILD_EXAMPLES=ON \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_C_COMPILER=$CC \ | ||
| -DCMAKE_CXX_COMPILER=$CXX \ | ||
| $CMAKE_EXTRA_ARGS \ | ||
| -DCMAKE_CXX_FLAGS='$CXX_FLAGS' \ | ||
| --preset ${{ matrix.sys.preset }} \ | ||
| -D BUILD_TESTS=ON \ | ||
| -D BUILD_BENCHMARK=ON \ | ||
| -D BUILD_EXAMPLES=ON \ | ||
| -D CMAKE_BUILD_TYPE=Release \ | ||
| -D CMAKE_C_COMPILER=$CC \ | ||
| -D CMAKE_CXX_COMPILER=$CXX \ | ||
| -D CMAKE_CXX_FLAGS='$CXX_FLAGS' \ | ||
| -D TARGET_ARCH="x86-64" \ | ||
| "${CMAKE_EXTRA_ARGS}" \ | ||
| -G Ninja | ||
|
|
||
| - name: Build | ||
| run: cmake --build _build | ||
| run: cmake --build _build --parallel | ||
|
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. we probably have the same issue elsewhere, I'll handle hat |
||
| - name: Test | ||
| run: | | ||
| # Set CPU feature test expectations, 0 is explicit absence of the feature | ||
| export XSIMD_TEST_CPU_ASSUME_NEON64="0" | ||
| export XSIMD_TEST_CPU_ASSUME_RVV="0" | ||
| export XSIMD_TEST_CPU_ASSUME_VSX="0" | ||
| export XSIMD_TEST_CPU_ASSUME_VXE="0" | ||
| cd _build/test | ||
| if echo '${{ matrix.sys.flags }}' | grep -q 'avx512' ; then | ||
|
|
||
| if echo '${{ matrix.sys.preset }}' | grep -q 'avx512' ; then | ||
| # Running with emulation, must have AVX512, lower tier are checked by implications in tests | ||
| export XSIMD_TEST_CPU_ASSUME_AVX512F="1" | ||
| ../../sde-external-9.48.0-2024-11-25-lin/sde64 -tgl -- ./test_xsimd | ||
| ./sde-external-9.48.0-2024-11-25-lin/sde64 -skx -- ./_build/test/test_xsimd | ||
| else | ||
| export XSIMD_TEST_CPU_ASSUME_SSE4_2=$(grep -q 'sse4_2' /proc/cpuinfo && echo "1" || echo "0") | ||
| export XSIMD_TEST_CPU_ASSUME_AVX=$(grep -q 'avx' /proc/cpuinfo && echo "1" || echo "0") | ||
| export XSIMD_TEST_CPU_ASSUME_AVX512F=$(grep -q 'avx512f' /proc/cpuinfo && echo "1" || echo "0") | ||
| export XSIMD_TEST_CPU_ASSUME_MANUFACTURER="intel,amd" | ||
| ./test_xsimd | ||
| ./_build/test/test_xsimd | ||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what a nice cleanup. The current merge conflict is probably related to the latest addition of avx512vl support, sorry about that