Files
project_6/cccl_upstream/libcudacxx/test/debugging/array/source.cu
EngineX CI 56fd68e7dd [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
2026-07-30 09:35:51 +00:00

61 lines
1.6 KiB
Plaintext

// Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <cuda/std/array>
template <class T>
[[gnu::noinline]] void keep_for_debugger(const T& value)
{
asm volatile("" : : "g"(&value) : "memory");
}
using array_alias = cuda::std::array<int, 4>;
[[gnu::noinline]] void inspect_normal(const cuda::std::array<int, 3>& values)
{
keep_for_debugger(values);
}
[[gnu::noinline]] void inspect_empty(const cuda::std::array<int, 0>& values)
{
keep_for_debugger(values);
}
[[gnu::noinline]] void inspect_nested(const cuda::std::array<cuda::std::array<int, 2>, 2>& values)
{
keep_for_debugger(values);
}
[[gnu::noinline]] void inspect_alias(const array_alias& values)
{
keep_for_debugger(values);
}
[[gnu::noinline]] void inspect_before_update(const cuda::std::array<int, 3>& values)
{
keep_for_debugger(values);
}
[[gnu::noinline]] void inspect_after_update(const cuda::std::array<int, 3>& values)
{
keep_for_debugger(values);
}
int main()
{
const cuda::std::array<int, 3> normal = {-7, 0, 42};
const cuda::std::array<int, 0> empty = {};
const cuda::std::array<cuda::std::array<int, 2>, 2> nested = {{{13, -5}, {0, 88}}};
const array_alias alias = {-31, 17, 8, -64};
cuda::std::array<int, 3> updated_values = {6, -91, 52};
inspect_normal(normal);
inspect_empty(empty);
inspect_nested(nested);
inspect_alias(alias);
inspect_before_update(updated_values);
updated_values = {3, 85, -12};
inspect_after_update(updated_values);
}