[INFRA] Import NVIDIA/CCCL upstream as optimization reference library
CCCL (CUDA C++ Core Libraries) provides: - CUB: device/block/warp-level GPU primitives (reduce, scan, sort, topk) - Thrust: high-level parallel algorithms (transform_reduce, sort, scan) - libcudacxx: CUDA C++ standard library (atomics, barriers, memory) - cudax: experimental features (memory resources, allocators) - Tuning policies: per-SM hardware-specific algorithm parameters Competition optimization vectors mapped to CCCL: - Output TPS (83% weight): warp_reduce, block_reduce, device_topk - Input TPS (14% weight): device_scan, block_load, prefetch - Cache TPS (3% weight): prefix caching strategy patterns - Memory (0.9 util): pooled/cached/buddy allocators Source: https://github.com/NVIDIA/cccl (shallow clone, HEAD only) License: Apache-2.0
This commit is contained in:
56
cccl_upstream/cub/cmake/CubBuildCompilerTargets.cmake
Normal file
56
cccl_upstream/cub/cmake/CubBuildCompilerTargets.cmake
Normal file
@@ -0,0 +1,56 @@
|
||||
# This file provides the following function which defines the following targets:
|
||||
#
|
||||
# cub.compiler_interface
|
||||
# - Interface target that includes all compiler settings for cub tests, etc.
|
||||
|
||||
function(cub_build_compiler_targets)
|
||||
cccl_get_cub()
|
||||
cccl_get_libcudacxx()
|
||||
cccl_get_thrust()
|
||||
|
||||
thrust_create_target(cub.thrust HOST CPP DEVICE CUDA)
|
||||
|
||||
set(ptxas_compile_options)
|
||||
if (CCCL_ENABLE_PTXAS_WARNINGS)
|
||||
list(
|
||||
APPEND ptxas_compile_options
|
||||
"--warn-on-spills"
|
||||
"--warn-on-local-memory-usage"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(cuda_compile_options)
|
||||
set(cxx_compile_options)
|
||||
set(cxx_compile_definitions)
|
||||
|
||||
# append ptxas compile options to cuda_compile_options with compiler specific prefix
|
||||
foreach (ptxas_compile_option ${ptxas_compile_options})
|
||||
if (
|
||||
"${CMAKE_CUDA_COMPILER_ID}" STREQUAL "NVIDIA"
|
||||
OR "${CMAKE_CUDA_COMPILER_ID}" STREQUAL "NVHPC"
|
||||
)
|
||||
list(APPEND cuda_compile_options "-Xptxas=${ptxas_compile_option}")
|
||||
elseif ("${CMAKE_CUDA_COMPILER_ID}" STREQUAL "CLANG")
|
||||
list(APPEND cuda_compile_options "-Xcuda-ptxas ${ptxas_compile_option}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
cccl_build_compiler_interface(
|
||||
cub.compiler_flags
|
||||
"${cuda_compile_options}"
|
||||
"${cxx_compile_options}"
|
||||
"${cxx_compile_definitions}"
|
||||
)
|
||||
|
||||
add_library(cub.compiler_interface INTERFACE)
|
||||
target_link_libraries(
|
||||
cub.compiler_interface
|
||||
INTERFACE
|
||||
# order matters here, we need the project options to override the cccl options.
|
||||
cccl.compiler_interface
|
||||
cub.compiler_flags
|
||||
libcudacxx::libcudacxx
|
||||
CUB::CUB
|
||||
cub.thrust
|
||||
)
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user