Skip to content

Commit 3055f61

Browse files
committed
Add ptxas local memory usage warnings to cub builds
1 parent a5df4b1 commit 3055f61

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cub/cmake/CubBuildCompilerTargets.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,23 @@ function(cub_build_compiler_targets)
1010

1111
thrust_create_target(cub.thrust HOST CPP DEVICE CUDA)
1212

13+
set(ptxas_compile_options "--warn-on-spills" "--warn-on-local-memory-usage")
1314
set(cuda_compile_options)
1415
set(cxx_compile_options)
1516
set(cxx_compile_definitions)
1617

18+
# append ptxas compile options to cuda_compile_options with compiler specific prefix
19+
foreach (ptxas_compile_option ${ptxas_compile_options})
20+
if (
21+
"${CMAKE_CUDA_COMPILER_ID}" STREQUAL "NVIDIA"
22+
OR "${CMAKE_CUDA_COMPILER_ID}" STREQUAL "NVHPC"
23+
)
24+
list(APPEND cuda_compile_options "-Xptxas=${ptxas_compile_option}")
25+
elseif ("${CMAKE_CUDA_COMPILER_ID}" STREQUAL "CLANG")
26+
list(APPEND cuda_compile_options "-Xcuda-ptxas ${ptxas_compile_option}")
27+
endif()
28+
endforeach()
29+
1730
cccl_build_compiler_interface(
1831
cub.compiler_flags
1932
"${cuda_compile_options}"

0 commit comments

Comments
 (0)