Sparse-checkout from NVIDIA/cccl main branch to complete cccl_upstream: Added: - python/cuda_cccl/ (226 files) — Python bindings for device-level algorithms Critical for muh toolchain: cuda.compute.reduce_into, scan, radix_sort, etc. Includes 204 .py files with full test coverage for all 27 algorithms - ci/ (163 files) — Build/test infrastructure build_cub.sh, test_cub.sh, build_and_test_targets.sh, matrix.yaml Directly maps to our [INFRA-CI] and [INFRA-BUILD] items - .agent/skills/ (7 files) — NVIDIA's own agent skills for CCCL cccl-style/SKILL.md, cccl-test/SKILL.md, sass-diff/SKILL.md - docs/ (491 files) — Official CCCL documentation CI references, CMake guides, Python compute docs, libcudacxx PTX docs - test/ (12 files) — Top-level integration tests (cuda_smoke, stdpar) - Root configs: .clang-format, .clang-tidy, CONTRIBUTING.md, pyproject.toml - CLAUDE.md symlink → AGENTS.md (NVIDIA's standard) cccl_upstream now mirrors full NVIDIA/cccl structure: Before: 42M (cub + thrust + libcudacxx + cudax + c + examples + benchmarks) After: 53M (+python +ci +docs +.agent +test +configs) This completes the CCCL base needed for: - [muh-bench] items: ci/util/build_and_test_targets.sh for targeted builds - [CCCL-verify] items: python/cuda_cccl/tests/ as reference implementations - [CCCL-test] items: ci/test_cub.sh, ci/test_thrust.sh - Agent workflow: .agent/skills/ for consistent style and test patterns
4.0 KiB
libcudacxx Test
Organization
- Put CUDA Standard Library tests under
libcudacxx/test/libcudacxx/std/.... - Put CUDA-specific API tests under
libcudacxx/test/libcudacxx/cuda/..., unless an adjacentstd/...directory is clearly the established home for the functionality. - Read nearby tests first and mirror their directory layout, file names, helper types, includes, and lit gates.
Purpose
-
Validate libcudacxx functionality. It is fundamental to verify:
- Edge cases.
- Input and output types.
- Exception behavior.
- Runtime and constant-evaluation behavior.
- Device and host behavior.
Test kinds
.pass.cpp: compiles, links, runs, and returns 0..compile.pass.cpp: compiles correctly..fail.cpp: must fail compilation. Prefer preciseexpected-error,expected-warning,expected-note, orexpected-no-diagnosticsannotations when clang verify is supported..runfail.cpp: compiles and runs but must return non-zero.
Test structure
- All tests must have the correct license banner.
- Always include top level headers, never internal ones with
__prefix. - Include support headers
"test_macros.h","test_iterators.h","test_comparisons.h", when needed. - Use
static_assert(...)for compile-time guarantees and constexpr coverage. - Use
<cuda/std/cassert>andassert(...)for runtime checks. - The
mainfunction must be present, dispatch runtime and static-evaluation tests, and return 0.
Style
- Use
cuda::stdnames, notstd::names, unless the test is intentionally checking interoperability with host standard library types. - Do not fully qualify names in header includes unless the test is intentionally checking interoperability with host standard library types.
- Mark helper functions that may run on host and device with
TEST_FUNC; useTEST_DEVICE_FUNCfor device-only helpers. useTEST_TILE_FUNCfor tile only helpers andTEST_TILE_DEVICE_FUNCfor functions that can run on tile and device const-qualification is discouraged.- Don't use
noexceptfor helper functions unless strictly necessary. - Do not use lambda expressions in host/device test code unless nearby tests already prove the pattern is supported.
Portability
-
Guard host-only or device-only behavior with
NV_IF_TARGET(NV_IS_HOST, (...))andNV_IF_TARGET(NV_IS_DEVICE, (...))respectively. -
Use
TEST_STD_VER,TEST_COMPILER,TEST_CUDA_COMPILER,TEST_HAS_EXCEPTIONS, andTEST_THROWfrom"test_macros.h"instead of spelling compiler or dialect probes directly. -
Unsupported platforms can be disabled with
UNSUPPORTED: <feature-name>orXFAIL: <feature-name>lit directives. Some common feature names arenvrtc,enable-tile,pre-sm-70,c++17,c++20,msvc,gcc-<version>, orclang-<version>.- Always motivate unsupported features with a comment.
Lit directives
- Put lit directives near the top of the file before includes.
- Common directives:
UNSUPPORTED:,XFAIL:,REQUIRES:,ADDITIONAL_COMPILE_DEFINITIONS:,ADDITIONAL_COMPILE_OPTIONS_HOST:,ADDITIONAL_COMPILE_OPTIONS_CUDA:,MODULES_DEFINES:, andCONSTEXPR_STEPS:. - For diagnostics in
.fail.cpp, annotate the exact line that should fail when possible:
bad_expression(); // expected-error {{message fragment}}
- Prefer checking the intended diagnostic over accepting any compile failure.
Validation
Use targeted libcudacxx lit runs. Paths passed to --lit-precompile-tests and --lit-tests are relative to libcudacxx/test/libcudacxx/.
ci/util/build_and_test_targets.sh \
--preset libcudacxx \
--lit-precompile-tests "std/algorithms/alg.nonmodifying/alg.any_of/any_of.pass.cpp" \
--lit-tests "std/algorithms/alg.nonmodifying/alg.any_of/any_of.pass.cpp"
If running lit directly, use the configured site file:
LIBCUDACXX_SITE_CONFIG=<path-to-cccl>/build/<preset>/libcudacxx/test/libcudacxx/lit.site.cfg \
lit -v libcudacxx/test/libcudacxx/<relative-test-path>
- Use
-Dexecutor=NoopExecutor()for precompile-only validation when runtime execution is unavailable or GPU coverage is not required.