From 062f94495b769d37439cdaecbe7af07bf7f0d090 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 6 Aug 2024 14:06:26 -0700 Subject: [PATCH 1/4] added new visual tests DISPATCH=ON without `clang-cl` backend --- .github/workflows/ci.yml | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57d25462..ddbfb3a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -545,6 +545,24 @@ jobs: run: | .\cmake_unofficial\build\Release\xxhsum.exe -bi1 + - name: Build ${{ matrix.system.os }}, ${{ matrix.arch }}, with DISPATCH + # DISPATCH only if target arch is x64 or Win32. + if: ${{ ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }} + run: | + cd cmake_unofficial + mkdir build-visual-dispatch + cd build-visual-dispatch + cmake .. -DCMAKE_BUILD_TYPE=Release -DDISPATCH=ON -A x64 + cmake --build . --config Release + + - name: Runtime Test (DISPATCH) + # Run benchmark for testing only if target arch is x64 or Win32. + if: ${{ ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }} + run: | + .\cmake_unofficial\build-visual-dispatch\Release\xxhsum.exe -V | grep autoVec + .\cmake_unofficial\build-visual-dispatch\Release\xxhsum.exe -bi1 + + - name: Build ${{ matrix.system.os }}, clang-cl, ${{ matrix.arch }} if: ${{ matrix.system.clangcl == 'true' }} run: | @@ -560,22 +578,6 @@ jobs: run: | .\cmake_unofficial\build-clang-cl\Release\xxhsum.exe -bi1 - - name: Build ${{ matrix.system.os }}, clang-cl, ${{ matrix.arch }}, with DISPATCH - # DISPATCH only if target arch is x64 or Win32. - if: ${{ matrix.system.clangcl == 'true' && ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }} - run: | - cd cmake_unofficial - mkdir build-clang-cl-dispatch - cd build-clang-cl-dispatch - cmake .. -DCMAKE_BUILD_TYPE=Release -DDISPATCH=ON -A x64 -DCMAKE_GENERATOR_TOOLSET=ClangCL - cmake --build . --config Release - - - name: Runtime Test (clang-cl + DISPATCH) - # Run benchmark for testing only if target arch is x64 or Win32. - if: ${{ matrix.system.clangcl == 'true' && ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }} - run: | - .\cmake_unofficial\build-clang-cl-dispatch\Release\xxhsum.exe -V | grep autoVec - .\cmake_unofficial\build-clang-cl-dispatch\Release\xxhsum.exe -bi1 # Windows, { mingw64, mingw32 } From 46e863e0ed5f3db6ae12822a49c76bab5af912ed Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 6 Aug 2024 14:11:34 -0700 Subject: [PATCH 2/4] make visual test harsher will error out on warnings --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddbfb3a3..d7ff8ec4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -552,7 +552,7 @@ jobs: cd cmake_unofficial mkdir build-visual-dispatch cd build-visual-dispatch - cmake .. -DCMAKE_BUILD_TYPE=Release -DDISPATCH=ON -A x64 + cmake .. -DCMAKE_BUILD_TYPE=Release -DDISPATCH=ON -A x64 -DCMAKE_C_FLAGS="/WX" cmake --build . --config Release - name: Runtime Test (DISPATCH) From ea72fcc5ad7c6bae18d9cc05f9b5eb48c865c636 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 6 Aug 2024 15:21:42 -0700 Subject: [PATCH 3/4] fix prototype signature of XXH3_hashLong_64b_defaultSecret_selection(), XXH3_hashLong_64b_withSeed_selection() and XXH3_hashLong_64b_withSecret_selection() --- xxh_x86dispatch.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xxh_x86dispatch.c b/xxh_x86dispatch.c index 5f8a4a01..86512714 100644 --- a/xxh_x86dispatch.c +++ b/xxh_x86dispatch.c @@ -729,8 +729,8 @@ static XXH_CONSTRUCTOR void XXH_setDispatch(void) /*! @cond Doxygen ignores this part */ static XXH64_hash_t -XXH3_hashLong_64b_defaultSecret_selection(const void* input, size_t len, - XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_defaultSecret_selection(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch.hashLong64_default == NULL) @@ -744,8 +744,8 @@ XXH64_hash_t XXH3_64bits_dispatch(XXH_NOESCAPE const void* input, size_t len) } static XXH64_hash_t -XXH3_hashLong_64b_withSeed_selection(const void* input, size_t len, - XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_withSeed_selection(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)secret; (void)secretLen; if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch.hashLong64_seed == NULL) @@ -759,8 +759,8 @@ XXH64_hash_t XXH3_64bits_withSeed_dispatch(XXH_NOESCAPE const void* input, size_ } static XXH64_hash_t -XXH3_hashLong_64b_withSecret_selection(const void* input, size_t len, - XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_withSecret_selection(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch.hashLong64_secret == NULL) From a26c58ae8a733547e55bdc9c04d3baa690731ec4 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 6 Aug 2024 15:50:59 -0700 Subject: [PATCH 4/4] harsher Visual compilation tests using `/W4` warning level --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7ff8ec4..e22a46ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -536,7 +536,7 @@ jobs: cd cmake_unofficial mkdir build cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -A ${{ matrix.arch }} -DXXHASH_C_FLAGS="/WX" + cmake .. -DCMAKE_BUILD_TYPE=Release -A ${{ matrix.arch }} -DCMAKE_C_FLAGS="/W4 /WX" cmake --build . --config Release - name: Test @@ -552,7 +552,7 @@ jobs: cd cmake_unofficial mkdir build-visual-dispatch cd build-visual-dispatch - cmake .. -DCMAKE_BUILD_TYPE=Release -DDISPATCH=ON -A x64 -DCMAKE_C_FLAGS="/WX" + cmake .. -DCMAKE_BUILD_TYPE=Release -DDISPATCH=ON -A x64 -DCMAKE_C_FLAGS="/W4 /WX" cmake --build . --config Release - name: Runtime Test (DISPATCH)