feat(cccl): integrate missing CCCL directories — python/, ci/, .agent/, docs/, test/
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
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
.. _libcudacxx-ptx-examples-device-tensormap-initialization:
|
||||
|
||||
How to initialize a tensor map on device
|
||||
========================================
|
||||
|
||||
How to initialize a tensor map on device is explained in the `CUDA Programming
|
||||
Guide
|
||||
<https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#encoding-a-tensor-map-on-device>`__.
|
||||
85
cccl_upstream/docs/libcudacxx/ptx/examples/st.async.rst
Normal file
85
cccl_upstream/docs/libcudacxx/ptx/examples/st.async.rst
Normal file
@@ -0,0 +1,85 @@
|
||||
.. _libcudacxx-ptx-examples-st-async:
|
||||
|
||||
How to use st.async
|
||||
===================
|
||||
|
||||
.. code:: cuda
|
||||
|
||||
#include <cstdio>
|
||||
#include <cuda/ptx>
|
||||
#include <cuda/barrier>
|
||||
#include <cooperative_groups.h>
|
||||
|
||||
__global__ void __cluster_dims__(8, 1, 1) kernel()
|
||||
{
|
||||
using cuda::ptx::sem_release;
|
||||
using cuda::ptx::sem_acquire;
|
||||
using cuda::ptx::space_cluster;
|
||||
using cuda::ptx::space_shared;
|
||||
using cuda::ptx::scope_cluster;
|
||||
|
||||
namespace cg = cooperative_groups;
|
||||
cg::cluster_group cluster = cg::this_cluster();
|
||||
|
||||
using barrier_t = cuda::barrier<cuda::thread_scope_block>;
|
||||
|
||||
#pragma nv_diag_suppress static_var_with_dynamic_init
|
||||
__shared__ int receive_buffer[4];
|
||||
__shared__ barrier_t bar;
|
||||
init(&bar, blockDim.x);
|
||||
|
||||
// Sync cluster to ensure remote barrier is initialized.
|
||||
cluster.sync();
|
||||
|
||||
// Get address of remote cluster barrier:
|
||||
unsigned int other_block_rank = cluster.block_rank() ^ 1;
|
||||
uint64_t * remote_bar = cluster.map_shared_rank(cuda::device::barrier_native_handle(bar), other_block_rank);
|
||||
// int * remote_buffer = cluster.map_shared_rank(&receive_buffer, other_block_rank);
|
||||
int * remote_buffer = cluster.map_shared_rank(&receive_buffer[0], other_block_rank);
|
||||
|
||||
// Arrive on local barrier:
|
||||
uint64_t arrival_token;
|
||||
if (threadIdx.x == 0) {
|
||||
// Thread 0 arrives and indicates it expects to receive a certain number of bytes as well
|
||||
arrival_token = cuda::ptx::mbarrier_arrive_expect_tx(sem_release, scope_cluster, space_shared, cuda::device::barrier_native_handle(bar), sizeof(receive_buffer));
|
||||
} else {
|
||||
arrival_token = cuda::ptx::mbarrier_arrive(sem_release, scope_cluster, space_shared, cuda::device::barrier_native_handle(bar));
|
||||
}
|
||||
|
||||
if (threadIdx.x == 0) {
|
||||
printf("[block %d] arrived with expected tx count = %llu\n", cluster.block_rank(), sizeof(receive_buffer));
|
||||
}
|
||||
|
||||
// Send bytes to remote buffer, arriving on remote barrier
|
||||
if (threadIdx.x == 0) {
|
||||
cuda::ptx::st_async(remote_buffer, {int(cluster.block_rank()), 2, 3, 4}, remote_bar);
|
||||
}
|
||||
|
||||
if (threadIdx.x == 0) {
|
||||
printf("[block %d] st_async to %p, %p\n",
|
||||
cluster.block_rank(),
|
||||
remote_buffer,
|
||||
remote_bar
|
||||
);
|
||||
}
|
||||
|
||||
// Wait on local barrier:
|
||||
while(!cuda::ptx::mbarrier_try_wait(sem_acquire, scope_cluster, cuda::device::barrier_native_handle(bar), arrival_token)) {}
|
||||
|
||||
// Print received values:
|
||||
if (threadIdx.x == 0) {
|
||||
printf(
|
||||
"[block %d] receive_buffer = { %d, %d, %d, %d }\n",
|
||||
cluster.block_rank(),
|
||||
receive_buffer[0], receive_buffer[1], receive_buffer[2], receive_buffer[3]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
kernel<<<8, 128>>>();
|
||||
cudaDeviceSynchronize();
|
||||
}
|
||||
|
||||
`See it on Godbolt <https://cuda.godbolt.org/z/36GdbGdbf>`_
|
||||
Reference in New Issue
Block a user