From 41b56b2f2ae5607a06caf0fec797dc819f8d8729 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 13 May 2022 18:18:15 -0400 Subject: [PATCH] Updating the old CI tests. Making AVX-512 work by default. --- .github/workflows/msys2-clang.yml | 2 +- .github/workflows/vs17-ci.yml | 10 +++--- .github/workflows/vs17-clang-ci.yml | 48 +++++++++++++++++------------ .github/workflows/vs17-ninja-ci.yml | 45 --------------------------- cmake/developer-options.cmake | 6 ++-- doc/performance.md | 3 +- 6 files changed, 40 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/vs17-ninja-ci.yml diff --git a/.github/workflows/msys2-clang.yml b/.github/workflows/msys2-clang.yml index dda9ed615..20a08f4cd 100644 --- a/.github/workflows/msys2-clang.yml +++ b/.github/workflows/msys2-clang.yml @@ -38,6 +38,6 @@ jobs: run: | mkdir build cd build - cmake -DSIMDJSON_DEVELOPER_MODE=ON -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DSIMDJSON_BUILD_STATIC=ON -DSIMDJSON_DO_NOT_USE_THREADS_NO_MATTER_WHAT=ON .. + cmake -DSIMDJSON_DEVELOPER_MODE=ON -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DBUILD_SHARED_LIBS=OFF -DSIMDJSON_DO_NOT_USE_THREADS_NO_MATTER_WHAT=ON .. cmake --build . --verbose ctest -j4 --output-on-failure -LE explicitonly diff --git a/.github/workflows/vs17-ci.yml b/.github/workflows/vs17-ci.yml index eaabbcfb7..ef2d27826 100644 --- a/.github/workflows/vs17-ci.yml +++ b/.github/workflows/vs17-ci.yml @@ -13,16 +13,16 @@ jobs: fail-fast: false matrix: include: - - {gen: Visual Studio 17 2022, arch: Win32, static: ON} - - {gen: Visual Studio 17 2022, arch: Win32, static: OFF} - - {gen: Visual Studio 17 2022, arch: x64, static: ON} - - {gen: Visual Studio 17 2022, arch: x64, static: OFF} + - {gen: Visual Studio 17 2022, arch: Win32, shared: ON} + - {gen: Visual Studio 17 2022, arch: Win32, shared: OFF} + - {gen: Visual Studio 17 2022, arch: x64, shared: ON} + - {gen: Visual Studio 17 2022, arch: x64, shared: OFF} steps: - name: checkout uses: actions/checkout@v2 - name: Configure run: | - cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_BUILD_STATIC=${{matrix.static}} -B build + cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -DBUILD_SHARED_LIBS=${{matrix.shared}} -B build - name: Build Debug run: cmake --build build --config Debug --verbose - name: Build Release diff --git a/.github/workflows/vs17-clang-ci.yml b/.github/workflows/vs17-clang-ci.yml index 5cca0d494..5da062765 100644 --- a/.github/workflows/vs17-clang-ci.yml +++ b/.github/workflows/vs17-clang-ci.yml @@ -9,23 +9,33 @@ jobs: ! contains(toJSON(github.event.commits.*.message), '[skip github]') name: windows-vs17 runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - {gen: Visual Studio 17 2022, arch: x64} steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: dependencies/.cache - key: ${{ hashFiles('dependencies/CMakeLists.txt') }} - - name: 'Run CMake with VS17 Clang' - uses: lukka/run-cmake@v3 - with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' - buildDirectory: "${{ github.workspace }}/../../_temp/windows" - cmakeBuildType: Release - buildWithCMake: true - cmakeAppendedArgs: -T ClangCL -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_DEVELOPER_MODE=ON -DBUILD_SHARED_LIBS=OFF - buildWithCMakeArgs: --config Release - - - name: 'Run CTest' - run: ctest -C Release -LE explicitonly --output-on-failure - working-directory: "${{ github.workspace }}/../../_temp/windows" \ No newline at end of file + - name: checkout + uses: actions/checkout@v2 + - name: Configure + run: | + cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -T ClangCL -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -B build + - name: Build Debug + run: cmake --build build --config Debug --verbose + - name: Build Release + run: cmake --build build --config Release --verbose + - name: Run Release tests + run: | + cd build + ctest -C Release -LE explicitonly --output-on-failure + - name: Run Debug tests + run: | + cd build + ctest -C Debug -LE explicitonly --output-on-failure + - name: Install + run: | + cmake --install build --config Release + - name: Test Installation + run: | + cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -B build_install_test tests/installation_tests/find + cmake --build build_install_test --config Release \ No newline at end of file diff --git a/.github/workflows/vs17-ninja-ci.yml b/.github/workflows/vs17-ninja-ci.yml deleted file mode 100644 index 7fdcfbc91..000000000 --- a/.github/workflows/vs17-ninja-ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: VS17-Ninja-CI - -on: [push, pull_request] - -jobs: - ci: - if: >- - ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && - ! contains(toJSON(github.event.commits.*.message), '[skip github]') - name: windows-vs17 - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: dependencies/.cache - key: ${{ hashFiles('dependencies/CMakeLists.txt') }} - - name: 'Run CMake with VS17' - uses: lukka/run-cmake@v2 - with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' - buildDirectory: "${{ github.workspace }}/../../_temp/windows" - cmakeBuildType: Release - buildWithCMake: true - cmakeAppendedArgs: -G Ninja -DSIMDJSON_COMPETITION=OFF -DSIMDJSON_DEVELOPER_MODE=ON -DBUILD_SHARED_LIBS=OFF - buildWithCMakeArgs: --config Release - - name: 'Run CTest' - run: ctest -C Release -LE explicitonly --output-on-failure - working-directory: "${{ github.workspace }}/../../_temp/windows" - - name: 'Install with CMake' - uses: lukka/run-cmake@v3 - with: - cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' - buildWithCMakeArgs: '--target install' - - name: 'Test Installation with CMake' - uses: lukka/run-cmake@v3 - with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - cmakeListsTxtPath: '${{ github.workspace }}/tests/installation_tests/find/CMakeLists.txt' - cmakeBuildType: Release - buildWithCMake: true - buildDirectory: '${{ github.workspace }}/tests/installation_tests/find/buildDirectory' - cmakeAppendedArgs: -G Ninja - buildWithCMakeArgs: '--config Release --verbose' diff --git a/cmake/developer-options.cmake b/cmake/developer-options.cmake index a0511704e..fb421c955 100644 --- a/cmake/developer-options.cmake +++ b/cmake/developer-options.cmake @@ -175,8 +175,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Intel") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel") endif() - - option( SIMDJSON_AVX512_ALLOWED "Enable AVX-512 instructions (only affects processors and compilers with AVX-512 support)." @@ -184,7 +182,9 @@ option( ) if(SIMDJSON_AVX512_ALLOWED) add_compile_definitions(SIMDJSON_AVX512_ALLOWED=1) - message(STATUS "AVX-512 instructions allowed if the CPU and compiler support it.") +else() + add_compile_definitions(SIMDJSON_AVX512_ALLOWED=0) + message(STATUS "AVX-512 instructions are not allowed.") endif() include(CheckSymbolExists) diff --git a/doc/performance.md b/doc/performance.md index 721b1e226..ea1ced120 100644 --- a/doc/performance.md +++ b/doc/performance.md @@ -161,6 +161,7 @@ You should not expect the simdjson library to cause *downclocking* of your recen - Whenever heavy 256-bit or wider instructions are used. Heavy instructions are those involving floating point operations or integer multiplications (since these execute on the floating point unit). The simdjson library does not make use of heavy 256-bit instructions. We do use vectorized multiplications, but only using 128-bit registers. Thus there should be no downclocking due to simdjson on recent processors, except when AVX-512 is allowed and -detected. However, we only allow AVX-512 on recent processors (Ice Lake/Tiger Lake or better) where [little to no frequency throttling is expected](https://travisdowns.github.io/blog/2020/08/19/icl-avx512-freq.html). If you can still concerned, you can easily disable AVX-512 with the CMake option `SIMDJSON_AVX512_ALLOWED` set to `OFF` (e.g., `cmake -D SIMDJSON_AVX512_ALLOWED=OFF -B build && cmake --build build`). +detected. However, we only allow AVX-512 on recent processors (Ice Lake/Tiger Lake or better) where [little to no frequency throttling is expected](https://travisdowns.github.io/blog/2020/08/19/icl-avx512-freq.html). If you can still concerned, you can easily disable AVX-512 with the CMake option `SIMDJSON_AVX512_ALLOWED` set to `OFF` (e.g., `cmake -D SIMDJSON_AVX512_ALLOWED=OFF -B build && cmake --build build`) or by setting +the macro `SIMDJSON_AVX512_ALLOWED` to `0` in C++ prior to importing the headers. You may still be worried about which SIMD instruction set is used by simdjson. Thankfully, [you can always determine and change which architecture-specific implementation is used](implementation-selection.md) by simdjson. Thus even if your CPU supports AVX2, you do not need to use AVX2. You are in control.