[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:
@@ -0,0 +1,20 @@
|
||||
if (NOT "${CMAKE_CUDA_COMPILER_ID}" STREQUAL "NVIDIA")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# arch-specific features are supported since 12.9
|
||||
if ("${CMAKE_CUDA_COMPILER_VERSION}" VERSION_LESS "12.9")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set_directory_properties(
|
||||
PROPERTIES INCLUDE_DIRECTORIES "${libcudacxx_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
set(target_name "libcudacxx.test.nvtarget.arch_specific")
|
||||
add_library(${target_name} OBJECT arch_specific.cu)
|
||||
set_target_properties(
|
||||
${target_name}
|
||||
PROPERTIES CUDA_ARCHITECTURES "103a-virtual"
|
||||
)
|
||||
add_dependencies(libcudacxx.test.nvtarget ${target_name})
|
||||
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of libcu++, the C++ Standard Library for your entire system,
|
||||
// under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// This test checks if arch-specific NV target macros work properly.
|
||||
|
||||
#include <nv/target>
|
||||
|
||||
// Currently, nvcc is the only compiler that supports arch-specific architectures.
|
||||
#if !defined(__NVCC__)
|
||||
# error "This test works with nvcc only."
|
||||
#endif // !__NVCC__
|
||||
|
||||
#if defined(__CUDA_ARCH__)
|
||||
# if __CUDA_ARCH_SPECIFIC__ != 1030
|
||||
# error "This test must be compiled for sm_103a target."
|
||||
# endif // __CUDA_ARCH_SPECIFIC__ != 1030
|
||||
#endif // __CUDA_ARCH__
|
||||
|
||||
#define CHECK_TRUE(_PRED) \
|
||||
do \
|
||||
{ \
|
||||
NV_IF_ELSE_TARGET(_PRED, static_assert(true);, static_assert(false);) \
|
||||
} while (0)
|
||||
#define CHECK_FALSE(_PRED) \
|
||||
do \
|
||||
{ \
|
||||
NV_IF_ELSE_TARGET(_PRED, static_assert(false);, static_assert(true);) \
|
||||
} while (0)
|
||||
|
||||
#ifdef __CUDACC_TILE__
|
||||
__tile__
|
||||
#endif // __CUDACC_TILE__
|
||||
__host__ __device__ void
|
||||
fn()
|
||||
{
|
||||
#if defined(__CUDA_ARCH__)
|
||||
CHECK_TRUE(NV_IS_EXACTLY_SM_103);
|
||||
|
||||
CHECK_TRUE(NV_HAS_FEATURE_SM_103a);
|
||||
|
||||
CHECK_TRUE(NV_HAS_FEATURE_SM_100f);
|
||||
CHECK_TRUE(NV_HAS_FEATURE_SM_103f);
|
||||
#else // ^^^ __CUDA_ARCH__ ^^^ / vvv !__CUDA_ARCH__ vvv
|
||||
CHECK_TRUE(NV_IS_HOST);
|
||||
|
||||
CHECK_FALSE(NV_HAS_FEATURE_SM_103a);
|
||||
|
||||
CHECK_FALSE(NV_HAS_FEATURE_SM_100f);
|
||||
CHECK_FALSE(NV_HAS_FEATURE_SM_103f);
|
||||
#endif // ^^^ !__CUDA_ARCH__ ^^^
|
||||
|
||||
CHECK_FALSE(NV_HAS_FEATURE_SM_100a);
|
||||
CHECK_FALSE(NV_HAS_FEATURE_SM_110a);
|
||||
|
||||
CHECK_FALSE(NV_HAS_FEATURE_SM_110f);
|
||||
}
|
||||
Reference in New Issue
Block a user