From dcd37692b0b2eb6f017a9a745bbddb853319d95e Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Thu, 28 Nov 2024 18:34:17 +0100 Subject: [PATCH 1/3] Build CUB and Thrust tests with assertions --- cub/test/CMakeLists.txt | 3 +++ thrust/testing/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/cub/test/CMakeLists.txt b/cub/test/CMakeLists.txt index fbc11c40df5..17201c4704f 100644 --- a/cub/test/CMakeLists.txt +++ b/cub/test/CMakeLists.txt @@ -308,6 +308,9 @@ function(cub_add_test target_name_var test_name test_src cub_target launcher_id) add_test(NAME ${test_target} COMMAND "$") endif() endif() # Not catch2 test + + # Ensure that we test with assertions enabled + target_compile_definitions(${test_target} PRIVATE CCCL_ENABLE_ASSERTIONS) endfunction() # Sets out_var to launch id if the label contains launch variants diff --git a/thrust/testing/CMakeLists.txt b/thrust/testing/CMakeLists.txt index cb8d955f666..d7f7288bbd1 100644 --- a/thrust/testing/CMakeLists.txt +++ b/thrust/testing/CMakeLists.txt @@ -79,6 +79,9 @@ function(thrust_add_test target_name_var test_name test_src thrust_target) target_compile_definitions(${test_target} PRIVATE THRUST_TEST_DEVICE_SIDE) endif() + # Ensure that we test with assertions enabled + target_compile_definitions(${test_target} PRIVATE CCCL_ENABLE_ASSERTIONS) + thrust_fix_clang_nvcc_build_for(${test_target}) # Add to the active configuration's meta target From 2fb6a973f6858b538874fde56b0ceb2277639c8a Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Fri, 29 Nov 2024 09:32:39 +0100 Subject: [PATCH 2/3] Suppress warning --- cub/cub/detail/fast_modulo_division.cuh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cub/cub/detail/fast_modulo_division.cuh b/cub/cub/detail/fast_modulo_division.cuh index 24b3204801d..d58a940abc9 100644 --- a/cub/cub/detail/fast_modulo_division.cuh +++ b/cub/cub/detail/fast_modulo_division.cuh @@ -109,8 +109,11 @@ multiply_extract_higher_bits(T value, R multiplier) { static_assert(supported_integral::value, "unsupported type"); static_assert(supported_integral::value, "unsupported type"); + _CCCL_DIAG_PUSH + _CCCL_DIAG_SUPPRESS_ICC(186) // pointless comparison of unsigned integer with zero _CCCL_ASSERT(value >= 0, "value must be non-negative"); _CCCL_ASSERT(multiplier >= 0, "multiplier must be non-negative"); + _CCCL_DIAG_POP static constexpr int NumBits = sizeof(DivisorType) * CHAR_BIT; using unsigned_t = unsigned_implicit_prom_t; using larger_t = larger_unsigned_type_t; From 25cb70f594c488b071b42aa284efc16211f1d14c Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Fri, 29 Nov 2024 11:08:23 +0100 Subject: [PATCH 3/3] Suppress more warnings --- thrust/testing/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/thrust/testing/CMakeLists.txt b/thrust/testing/CMakeLists.txt index d7f7288bbd1..60485e317d4 100644 --- a/thrust/testing/CMakeLists.txt +++ b/thrust/testing/CMakeLists.txt @@ -79,6 +79,13 @@ function(thrust_add_test target_name_var test_name test_src thrust_target) target_compile_definitions(${test_target} PRIVATE THRUST_TEST_DEVICE_SIDE) endif() + # nvcc < 11.5 generates "error #186-D: pointless comparison of unsigned integer with zero" + # when including in CUB's dispatch_transform.h, + # despite explicitly suppressing the warning there + if ("NVIDIA" STREQUAL "${CMAKE_CUDA_COMPILER_ID}" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.5.0) + target_compile_options(${test_target} PRIVATE $<$:-Xcudafe=--diag_suppress=186>) + endif () + # Ensure that we test with assertions enabled target_compile_definitions(${test_target} PRIVATE CCCL_ENABLE_ASSERTIONS)