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
95 lines
2.7 KiB
C
95 lines
2.7 KiB
C
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of CUDA Experimental in CUDA Core Compute Libraries,
|
|
// 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#pragma once
|
|
// NOLINTBEGIN(modernize-use-using)
|
|
|
|
#ifndef CCCL_C_EXPERIMENTAL
|
|
# error "C exposure is experimental and subject to change. Define CCCL_C_EXPERIMENTAL to acknowledge this notice."
|
|
#endif // !CCCL_C_EXPERIMENTAL
|
|
|
|
#include <cuda.h>
|
|
#include <stdint.h>
|
|
|
|
#include <cccl/c/extern_c.h>
|
|
#include <cccl/c/types.h>
|
|
|
|
CCCL_C_EXTERN_C_BEGIN
|
|
|
|
typedef struct cccl_device_reduce_build_result_t
|
|
{
|
|
int cc;
|
|
void* payload;
|
|
size_t payload_size;
|
|
void* jit_compiler; // hostjit::JITCompiler*
|
|
void* reduce_fn; // int(*)(void*, size_t*, void*, void*, unsigned long long, void*, void*, void*) — trailing void* is
|
|
// the CUstream
|
|
uint64_t accumulator_size;
|
|
cccl_determinism_t determinism;
|
|
} cccl_device_reduce_build_result_t;
|
|
|
|
// TODO return a union of nvtx/cuda/nvrtc errors or a string?
|
|
CCCL_C_API CUresult cccl_device_reduce_build(
|
|
cccl_device_reduce_build_result_t* build,
|
|
cccl_iterator_t d_in,
|
|
cccl_iterator_t d_out,
|
|
cccl_op_t op,
|
|
cccl_value_t init,
|
|
cccl_determinism_t determinism,
|
|
int cc_major,
|
|
int cc_minor,
|
|
const char* cub_path,
|
|
const char* thrust_path,
|
|
const char* libcudacxx_path,
|
|
const char* ctk_path);
|
|
|
|
// Extended version with build configuration
|
|
CCCL_C_API CUresult cccl_device_reduce_build_ex(
|
|
cccl_device_reduce_build_result_t* build,
|
|
cccl_iterator_t d_in,
|
|
cccl_iterator_t d_out,
|
|
cccl_op_t op,
|
|
cccl_value_t init,
|
|
cccl_determinism_t determinism,
|
|
int cc_major,
|
|
int cc_minor,
|
|
const char* cub_path,
|
|
const char* thrust_path,
|
|
const char* libcudacxx_path,
|
|
const char* ctk_path,
|
|
cccl_build_config* config);
|
|
|
|
CCCL_C_API CUresult cccl_device_reduce(
|
|
cccl_device_reduce_build_result_t build,
|
|
void* d_temp_storage,
|
|
size_t* temp_storage_bytes,
|
|
cccl_iterator_t d_in,
|
|
cccl_iterator_t d_out,
|
|
uint64_t num_items,
|
|
cccl_op_t op,
|
|
cccl_value_t init,
|
|
CUstream stream);
|
|
|
|
CCCL_C_API CUresult cccl_device_reduce_nondeterministic(
|
|
cccl_device_reduce_build_result_t build,
|
|
void* d_temp_storage,
|
|
size_t* temp_storage_bytes,
|
|
cccl_iterator_t d_in,
|
|
cccl_iterator_t d_out,
|
|
uint64_t num_items,
|
|
cccl_op_t op,
|
|
cccl_value_t init,
|
|
CUstream stream);
|
|
|
|
CCCL_C_API CUresult cccl_device_reduce_cleanup(cccl_device_reduce_build_result_t* bld_ptr);
|
|
|
|
CCCL_C_EXTERN_C_END
|
|
// NOLINTEND(modernize-use-using)
|