Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
d1d7e5f
Add native Rust provider for CUB block load and store
tpn Oct 20, 2026
19060fb
Keep the Rust CI toolchain installation explicit
tpn Oct 20, 2026
bcec7ae
Connect native cooperative providers to Oxide library calls
tpn Oct 20, 2026
37ab288
Use inferred resources in the provider integration fixture
tpn Oct 20, 2026
39ec3f3
Add checked per-thread Rust payloads
tpn Oct 20, 2026
8faf14b
Qualify checked native block calls and rejection cases
tpn Oct 20, 2026
184a1c9
Add dimension-free CUDA hierarchy and group queries
tpn Oct 20, 2026
e8709f5
Exercise checked helpers shared by distinct kernel roots
tpn Oct 20, 2026
2a498e9
Anchor group queries and retain device payload checks
tpn Oct 20, 2026
4f7b74d
Integrate native fixture with the Rust group foundation
tpn Oct 20, 2026
a9a2c20
Declare native provider inputs for Cargo rebuilds
tpn Oct 20, 2026
ed1e7f0
Clarify the scope of Rust payload and group APIs
tpn Oct 20, 2026
ee77ca2
Clarify native provider timestamp freshness limits
tpn Oct 20, 2026
2e14aef
Qualify collective carrier ownership and full-block reuse
tpn Oct 20, 2026
e3ba389
Cover checked helper projections and rooted contexts
tpn Oct 20, 2026
6aadf22
Integrate carrier fixtures with checked helper corrections
tpn Oct 20, 2026
fb75080
Integrate native dependency tracking in checked fixtures
tpn Oct 20, 2026
e65f3be
Integrate published payload and group documentation
tpn Oct 20, 2026
bfadda2
Cover carrier ownership and aggregate mutation boundaries
tpn Oct 20, 2026
7fa1095
Exercise native storage composition and completion
tpn Oct 20, 2026
e20a3c8
Integrate carrier and storage validation fixtures
tpn Oct 20, 2026
a9b49d6
test(rust): check MaybeUninit collective compatibility
tpn Oct 20, 2026
6bd4cd4
Integrate inhabited value collective regressions
tpn Oct 20, 2026
2119cae
Add validity-aware Direct block Load and Store
tpn Oct 20, 2026
951b7b7
test(rust): exercise storage reuse across runtime loops
tpn Oct 20, 2026
5ce6a05
Keep payload indexing guards device-compatible
tpn Oct 20, 2026
63d58b8
Pack payload validity bits for device access
tpn Oct 20, 2026
8f2eeb4
Cover enum controls in checked collective calls
tpn Oct 20, 2026
ca1295a
Integrate enum control contrasts with storage qualification
tpn Oct 20, 2026
71a3580
Integrate packed validity across Rust and native Direct calls
tpn Oct 20, 2026
2c5b7f3
Integrate checked collective regressions with Direct validity
tpn Oct 20, 2026
95ebc3d
Expose Direct Load and Store with packed payload validity
tpn Oct 20, 2026
a092775
Check enum controls with production MIR optimization
tpn Oct 20, 2026
334f331
Merge commit 'a092775dc1a8d963e1995cf4a0b68b6295a49539' into codex/cu…
tpn Oct 20, 2026
a9e6ef3
Qualify Direct ownership and completion checks
tpn Oct 20, 2026
5c6e8a1
Merge commit 'a092775dc1a8d963e1995cf4a0b68b6295a49539' into codex/cu…
tpn Oct 20, 2026
fed23ef
Support typed Transpose payloads and validity in native CUB
tpn Oct 20, 2026
ed5cd46
Merge commit '334f3310df0527226c1da21396c03e2994df4662' into codex/cu…
tpn Oct 20, 2026
c7b6170
Merge commit 'fed23efcfdfe768ddc5ac90b4f32ed3fac38f0e3' into codex/cu…
tpn Oct 20, 2026
fb9b4c4
Pin public Load and Store to the reviewed collective compiler
tpn Oct 20, 2026
512456a
Add typed Transpose Load and Store with managed storage
tpn Oct 20, 2026
f138fa4
Merge commit 'fb9b4c49fd40a8dc0e3dbc1aac44db73993049a8' into codex/cu…
tpn Oct 20, 2026
ef81dc5
Pin Transpose operations to the published storage compiler
tpn Oct 20, 2026
a2553c9
Clarify Transpose examples and check participation
tpn Oct 20, 2026
41a9f11
Preserve exact block shapes in native Load and Store
tpn Oct 20, 2026
08fdb4b
Describe the public Transpose recipes in the Rust guide
tpn Oct 20, 2026
47861b6
Clarify block-shape ownership offsets and launch contracts
tpn Oct 20, 2026
20774bc
Describe the public Transpose recipes in the Rust guide
tpn Oct 20, 2026
d01d1ac
Add public temporary storage and typed reservations
tpn Oct 20, 2026
15a472e
Cover storage descriptor forwarding through wrappers
tpn Oct 20, 2026
4dfc6f3
Check wrapped storage identity across helper calls
tpn Oct 20, 2026
334d6d1
Use the compiler with wrapped storage origins
tpn Oct 20, 2026
31be177
Keep storage guards compatible with computed extents
tpn Oct 20, 2026
7e1f4d4
Add Rust Striped Load and Store
tpn Oct 20, 2026
1935155
Qualify Striped tests in the combined device image
tpn Oct 20, 2026
aaf03fc
Include Striped in the Rust development overview
tpn Oct 20, 2026
8bc907b
Add vectorized Rust block Load and Store
tpn Oct 20, 2026
101c0c4
Use a distinct Vectorize fixture kernel name
tpn Oct 20, 2026
acf9ab4
Distinguish unexpected Vectorize Store completion
tpn Oct 20, 2026
2e2d9fc
Add Rust block warp-transpose Load and Store
tpn Oct 21, 2026
14d389a
Support Rust Direct Load and Store within physical warps
tpn Oct 21, 2026
3d9ef73
Integrate Rust block algorithms with storage and warp support
tpn Oct 21, 2026
3e1403f
Add logical warp Direct Load and Store support
tpn Oct 21, 2026
d6094a3
Lead the Rust guide with the executable kernel example
tpn Oct 21, 2026
9fc295f
Convert algorithms into Load and Store options
tpn Oct 21, 2026
61c39fb
Cover finite sibling loops and wider collective completion
tpn Oct 21, 2026
f9edcd4
Join finite-cycle coverage with the logical warp example
tpn Oct 21, 2026
ce05dd2
Pin logical Warp examples to the matching Oxide revision
tpn Oct 21, 2026
121ee1b
Reuse the logical Warp fixture CUDA context for cycle checks
tpn Oct 21, 2026
370b747
Support Warp Transpose, Striped and Vectorize Load and Store
tpn Oct 21, 2026
2504857
Join remaining Warp algorithms with the qualified foundation
tpn Oct 21, 2026
1a1db7c
Pin Rust Warp algorithms to the matching Oxide compiler
tpn Oct 21, 2026
e5617f9
Cover Warp element widths and replicated storage
tpn Oct 21, 2026
f3d0000
Keep the query example on the matching Oxide revision
tpn Oct 21, 2026
294d335
Correct Rust cooperative Load/Store support docs
tpn Oct 21, 2026
48adea1
Add built-in Rust Block and Warp Scan
tpn Oct 21, 2026
4ff697f
Show the complete Rust Scan helper in the guide
tpn Oct 21, 2026
29ff3ea
Route non-exhaustive Warp membership through Oxide
tpn Oct 21, 2026
7df413f
Add Rust Block and Warp Reduce and Sum
tpn Oct 21, 2026
9158bf8
Guard uninitialized batched Redux output copies
tpn Oct 21, 2026
3a44cb4
Add Rust Warp batched reductions
tpn Oct 21, 2026
c2fbc80
Bind native specialization identity to exact block shape
tpn Oct 21, 2026
91d7c3a
Add Rust Block and Warp Exchange
tpn Oct 21, 2026
feec7ce
Add Block Shuffle with checked partial results
tpn Oct 21, 2026
4fa55e6
Align pr12088 with the stable compiler
tpn Oct 23, 2026
d3268d6
Align pr12091 with the stable compiler
tpn Oct 23, 2026
1cd5a73
Align pr12092 with the stable compiler
tpn Oct 23, 2026
9899a63
Align pr12099 with the stable compiler
tpn Oct 23, 2026
0c3398c
Align pr12099 with the stable compiler
tpn Oct 23, 2026
5c2692b
Align pr12101 with the stable compiler
tpn Oct 23, 2026
868a0d9
Align pr12102 with the stable compiler
tpn Oct 23, 2026
27f9c51
Align pr12104 with the stable compiler
tpn Oct 23, 2026
c962dd8
Align pr12105 with the stable compiler
tpn Oct 23, 2026
db21c13
Align pr12106 with the stable compiler
tpn Oct 23, 2026
7bb505e
Align pr12112 with the stable compiler
tpn Oct 23, 2026
2759b49
Align pr12113 with the stable compiler
tpn Oct 23, 2026
a46fdfe
Align pr12114 with the stable compiler
tpn Oct 23, 2026
55f5768
Align pr12114 with the stable compiler
tpn Oct 23, 2026
5330a81
Align pr12115 with the stable compiler
tpn Oct 23, 2026
eb609ab
Align pr12116 with the stable compiler
tpn Oct 23, 2026
472457d
Align pr12117 with the stable compiler
tpn Oct 23, 2026
1b536f6
Align pr12118 with the stable compiler
tpn Oct 23, 2026
338a1e3
Align pr12119 with the stable compiler
tpn Oct 23, 2026
c98ed86
Align pr12122 with the stable compiler
tpn Oct 23, 2026
7027b14
Align pr12123 with the stable compiler
tpn Oct 23, 2026
fc69368
Align pr12124 with the stable compiler
tpn Oct 23, 2026
077c4be
Align pr12126 with the stable compiler
tpn Oct 23, 2026
e753fe0
Use matching compiler artifact metadata
tpn Oct 23, 2026
b97fc3d
Carry the corrected artifact dependency
tpn Oct 23, 2026
297a0d8
Carry the corrected artifact dependency
tpn Oct 23, 2026
c5afee7
Carry the corrected artifact dependency
tpn Oct 23, 2026
8fe6c0c
Carry the corrected artifact dependency
tpn Oct 23, 2026
17c49ee
Carry the corrected artifact dependency
tpn Oct 23, 2026
629ef33
Carry the corrected artifact dependency
tpn Oct 23, 2026
c340f89
Carry the corrected artifact dependency
tpn Oct 23, 2026
6628fac
Carry the corrected artifact dependency
tpn Oct 23, 2026
aef1124
Carry the corrected artifact dependency
tpn Oct 23, 2026
9527299
Carry the corrected artifact dependency
tpn Oct 23, 2026
b077a1a
Carry the corrected artifact dependency
tpn Oct 23, 2026
e346067
Carry the corrected artifact dependency
tpn Oct 23, 2026
0cddb4b
Carry the corrected artifact dependency
tpn Oct 23, 2026
71e2a03
Carry the corrected artifact dependency
tpn Oct 23, 2026
7d2c104
Carry the corrected artifact dependency
tpn Oct 23, 2026
c902cfd
Carry the corrected artifact dependency
tpn Oct 23, 2026
b56bf49
Carry the corrected artifact dependency
tpn Oct 23, 2026
7d50da4
Carry the corrected artifact dependency
tpn Oct 23, 2026
549b1a7
Carry the corrected artifact dependency
tpn Oct 23, 2026
64f5d94
Retain the query provider build dependency
tpn Oct 23, 2026
7e9138e
Carry the complete query dependency graph
tpn Oct 23, 2026
59ec64a
Carry the complete query dependency graph
tpn Oct 23, 2026
afe5338
Carry the complete query dependency graph
tpn Oct 23, 2026
8cb40a8
Carry the complete query dependency graph
tpn Oct 23, 2026
ff3ac29
Carry the complete query dependency graph
tpn Oct 23, 2026
fecaab8
Carry the complete query dependency graph
tpn Oct 23, 2026
b9934a1
Carry the complete query dependency graph
tpn Oct 23, 2026
41c3620
Carry the complete query dependency graph
tpn Oct 23, 2026
53561f9
Carry the complete query dependency graph
tpn Oct 23, 2026
36fd834
Carry the complete query dependency graph
tpn Oct 23, 2026
ac7e978
Carry the complete query dependency graph
tpn Oct 23, 2026
91fa5de
Carry the complete query dependency graph
tpn Oct 23, 2026
0dd6bc0
Carry the complete query dependency graph
tpn Oct 23, 2026
2611d38
Carry the complete query dependency graph
tpn Oct 23, 2026
6ce6de9
Carry the complete query dependency graph
tpn Oct 23, 2026
f714570
Carry the complete query dependency graph
tpn Oct 23, 2026
89995f7
Carry the complete query dependency graph
tpn Oct 23, 2026
980428e
Carry the complete query dependency graph
tpn Oct 23, 2026
3275724
Align Direct resource-conflict diagnostics
tpn Oct 23, 2026
0785235
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
99042a5
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
fba9a5b
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
98b5e6b
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
3c7d4f3
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
9c316c9
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
0e581cf
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
7a6a095
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
3bf1440
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
8102054
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
be2b0f0
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
f4d9c45
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
b2fee69
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
93e2fbf
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
9c905a1
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
cf57ed4
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
8c6bc27
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
b994fc8
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
44f9876
Align Transpose completion diagnostic
tpn Oct 23, 2026
aa2d5fc
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
cd9649f
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
ac05285
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
092acc1
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
ef1c6e1
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
f924045
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
c795402
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
5ecccc3
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
8658c53
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
8eb328e
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
9c4523a
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
a25e8d1
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
8a50be3
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
9e54f31
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
999f29c
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
ed0a5f7
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
fd8bc1f
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
3afd04f
Align Striped completion diagnostic
tpn Oct 23, 2026
cda1a4a
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
658333d
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
78f5a32
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
4e036be
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
c403fc9
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
e7253ec
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
e23d23d
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
a687873
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
3b0e7f8
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
53cef59
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
1937978
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
388ce1d
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
e3f614b
Align storage completion diagnostic
tpn Oct 23, 2026
0a5e26a
Carry storage diagnostic compatibility
tpn Oct 23, 2026
15e1876
Carry storage diagnostic compatibility
tpn Oct 23, 2026
9d5f9e7
Carry storage diagnostic compatibility
tpn Oct 23, 2026
8e9ce1a
Carry storage diagnostic compatibility
tpn Oct 23, 2026
0596ba8
Carry storage diagnostic compatibility
tpn Oct 23, 2026
d9acf8c
Carry storage diagnostic compatibility
tpn Oct 23, 2026
8480ce6
Carry storage diagnostic compatibility
tpn Oct 23, 2026
230996e
Carry storage diagnostic compatibility
tpn Oct 23, 2026
30033c7
Carry storage diagnostic compatibility
tpn Oct 23, 2026
bd9ad6e
Carry storage diagnostic compatibility
tpn Oct 23, 2026
3748a74
Carry storage diagnostic compatibility
tpn Oct 23, 2026
e38a261
Align Vectorize completion diagnostic
tpn Oct 23, 2026
8ccaad5
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
6307f75
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
6201fe8
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
6e23f55
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
76fbf11
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
fbefecc
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
15c9f39
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
109e74e
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
fae7d86
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
af99877
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
28bc85f
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
7220806
Align Warp control expectations with migrated analysis
tpn Oct 23, 2026
bda8e20
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
dd0b646
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
74c1ac9
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
bb5032f
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
6903e44
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
e4fa18b
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
76c52cc
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
687dbdc
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
de33c46
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
538642b
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/rust-host.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: Rust host checks

on:
push:
branches:
- main
- "pull-request/[0-9]+"
paths:
- "rust/**"
- ".github/workflows/rust-host.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
host:
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust
shell: bash --noprofile --norc -euo pipefail {0}
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Check the pinned Rust workspace
run: |
rustup toolchain install --no-self-update
rustup show active-toolchain
cargo fmt --all -- --check
cargo test --workspace --locked
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo doc --workspace --no-deps --locked
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ struct warp_reduce_batched_wspro
_CCCL_PRAGMA_UNROLL_FULL()
for (int i = 0; i < max_out_per_thread; ++i)
{
outputs[i] = intermediate_outputs[i];
const auto batch_idx =
ToBlocked ? logical_lane_id * max_out_per_thread + i : i * LogicalWarpThreads + logical_lane_id;
if (batch_idx < Batches)
{
outputs[i] = intermediate_outputs[i];
}
}
}
return true;
Expand Down
79 changes: 79 additions & 0 deletions cub/test/warp/catch2_test_warp_reduce_batched.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <cub/util_device.cuh>
#include <cub/util_macro.cuh>
#include <cub/warp/warp_reduce.cuh>
#include <cub/warp/warp_reduce_batched.cuh>
Expand All @@ -9,6 +10,8 @@
#include <cuda/functional>
#include <cuda/iterator>
#include <cuda/ptx>
#include <cuda/std/array>
#include <cuda/std/cstddef>
#include <cuda/std/functional>
#include <cuda/std/limits>
#include <cuda/std/mdspan>
Expand Down Expand Up @@ -40,6 +43,82 @@ enum class WarpReduceBatchedMode
ToBlocked
};

#if TEST_TYPES == 1
struct assignment_counter_reference
{
int* count;

// Binding the source by reference observes the copy without reading an uninitialized scalar.
_CCCL_DEVICE_API void operator=(const int&) const noexcept
{
++*count;
}
};

struct assignment_counter_accessor
{
using offset_policy = assignment_counter_accessor;
using element_type = int;
using reference = assignment_counter_reference;
using data_handle_type = int*;

[[nodiscard]] _CCCL_DEVICE_API reference access(data_handle_type counts, cuda::std::size_t index) const noexcept
{
return {counts + index};
}

[[nodiscard]] _CCCL_DEVICE_API data_handle_type offset(data_handle_type counts, cuda::std::size_t index) const noexcept
{
return counts + index;
}
};

__global__ void warp_reduce_batched_copy_count_kernel(int* counts, bool to_blocked)
{
using warp_reduce_batched_t = cub::WarpReduceBatched<int, 3, warp_size, false>;
__shared__ warp_reduce_batched_t::TempStorage temp_storage[block_size / warp_size];
const int tid = static_cast<int>(threadIdx.x);
const int logical_warp_id = tid / warp_size;
const cuda::std::array<int, 3> inputs{tid, tid + 1, tid + 2};
int assignments = 0;
cuda::std::mdspan<int, cuda::std::extents<int, 1>, cuda::std::layout_right, assignment_counter_accessor> outputs{
&assignments};
if (to_blocked)
{
warp_reduce_batched_t{temp_storage[logical_warp_id]}.ReduceToBlocked(inputs, outputs, cuda::std::plus<>{});
}
else
{
warp_reduce_batched_t{temp_storage[logical_warp_id]}.ReduceToStriped(inputs, outputs, cuda::std::plus<>{});
}
counts[tid] = assignments;
}

CUB_TEST("WarpReduceBatched Redux copies only initialized intermediate outputs", "[warp][reduce][batched]", CUB_SMALL)
{
int ptx_version = 0;
REQUIRE(cudaSuccess == cub::PtxVersion(ptx_version));
if (ptx_version < 800)
{
SKIP("The Redux copy path requires SM80+; the fallback initializes every intermediate output.");
}

const bool to_blocked = GENERATE(false, true);
CAPTURE(to_blocked);
c2h::device_vector<int> counts(block_size);
warp_reduce_batched_copy_count_kernel<<<1, block_size>>>(thrust::raw_pointer_cast(counts.data()), to_blocked);
REQUIRE(cudaSuccess == cudaPeekAtLastError());
REQUIRE(cudaSuccess == cudaDeviceSynchronize());

c2h::host_vector<int> expected(block_size);
for (int tid = 0; tid < block_size; ++tid)
{
expected[tid] = tid % warp_size < 3 ? 1 : 0;
}
REQUIRE(expected == counts);
}
#endif // TEST_TYPES == 1

template <WarpReduceBatchedMode Mode,
bool SyncPhysicalWarp,
int Batches,
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CUDA Core Compute Libraries

cccl/index
python/index
rust/index
contributors/index
maintainers/index
infrastructure/index
Expand All @@ -18,6 +19,8 @@ make CUDA C++ and Python more delightful.

- :doc:`Python Libraries <python/index>`

- :doc:`Rust Development <rust/index>`

- :doc:`Contributor Docs <contributors/index>`

- :doc:`Maintainer Docs <maintainers/index>`
Expand Down
114 changes: 114 additions & 0 deletions docs/rust/exchange.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
.. Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
.. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Exchange layouts
================

``exchange`` redistributes a group's per-thread values between striped and
blocked layouts. It preserves the input and returns a fresh ``ThreadData``
with the same element type, item count and alignment. The default converts
striped input to blocked output:

.. code-block:: rust

let blocked = coop::exchange(group, &striped, Default::default());
let striped_again = coop::exchange(group, &blocked,
coop::ExchangeOptions::default().mode(coop::BlockedToStriped));

Blocked order assigns consecutive items to each thread. Striped order assigns
consecutive items to consecutive threads. For four threads with two items each,
``StripedToBlocked`` produces:

.. list-table::
:header-rows: 1

* - Thread rank
- Striped input
- Blocked output
* - 0
- ``[0, 4]``
- ``[0, 1]``
* - 1
- ``[1, 5]``
- ``[2, 3]``
* - 2
- ``[2, 6]``
- ``[4, 5]``
* - 3
- ``[3, 7]``
- ``[6, 7]``

``BlockedToStriped`` reverses this conversion. Exchange operates on the values
already held by the threads; Load and Store handle global-memory access.

A complete program
------------------

This standalone Cargo example loads a tile in striped order, exchanges it to
blocked order, then uses Direct Store. Its reusable helper lives in a separate
crate. The element type is inferred, and ``ITEMS_PER_THREAD`` stays generic
through the host launch, kernel and helper. These same-extent signatures need
no ``generic_const_exprs`` feature in the consumer.

.. literalinclude:: ../../rust/cuda-coop/examples/exchange/helper/src/lib.rs
:language: rust
:start-after: // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

The host specializes one and four items per thread across three blocks. A
filled Load initializes the short final tile, and Store writes only its valid
prefix. The resulting global output matches the input even though the
per-thread layout changes between Load and Store.

.. literalinclude:: ../../rust/cuda-coop/examples/exchange/src/main.rs
:language: rust
:start-after: // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Use the Oxide revision selected by the manifests and ``1.99.1``.
With that toolchain installed, run from a complete CCCL checkout:

.. code-block:: shell

cd rust/cuda-coop/examples/exchange
CUDA_HOME=/usr/local/cuda-13.3 CUDA_PATH=/usr/local/cuda-13.3 \
cargo oxide run --arch sm_120 --materialize-cubin

Choose the architecture for your GPU. ``auto_shared`` uses the compiler's
inferred storage plan; the consumer does not calculate scratch bytes.

Supported groups and inputs
---------------------------

Exchange supports complete one-, two- and three-dimensional Blocks, physical
Warps and logical Warp groups of widths 1, 2, 4, 8, 16 and 32. Block thread rank
is x-fastest. Block size need not be a multiple of 32; Warp operations require
complete physical warps in the enclosing Block. Each Warp group converts its
own values independently.

The payload has a positive item count and one of the ten ``Numeric`` element
types: ``i8``, ``u8``, ``i16``, ``u16``, ``i32``, ``u32``, ``i64``, ``u64``,
``f32`` or ``f64``. Pass a shared borrow, or an ordinary mutable reborrow.
Every input slot must be initialized, including a one-item payload. A masked
Load without a default can leave unwritten slots; Exchange traps before
reading them. Every returned slot is initialized, and changing the result
does not change the input.

``ExchangeOptions::default()`` selects ``StripedToBlocked``. The consuming
``mode`` builder selects either direction at compile time. The API supports
these two payload conversions; scalar inputs, ranked scatter, algorithm and
explicit-storage options are unsupported.

Participation and storage
-------------------------

Every selected member must reach the same Exchange. Separate Warp groups may
take different paths, but members of one group must participate together.
Oxide checks participation and plans the actual CUB shared storage, including
independent regions for Warp groups and synchronization before reuse.

Exchange does not promise completion of earlier global-memory accesses. Use
the group's ``sync()`` when subsequent conflicting accesses need completion.
See :doc:`groups` and :doc:`load_store` for the participation and memory rules.

Generate the item reference with ``cargo doc --workspace --no-deps`` from
``rust/``. ``exchange``, ``ExchangeOptions``, ``ExchangeGroup`` and
``ExchangeMode`` document the full generic signatures and supported selectors.
107 changes: 107 additions & 0 deletions docs/rust/groups.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
.. Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
.. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Hierarchy and group queries
===========================

``cuda-coop`` describes the current CUDA launch without requiring dimensions in
the Rust source. ``this_thread()``, ``this_warp()``, ``this_block()``,
``this_cluster()`` and ``this_grid()`` return typed group descriptors.
``ThreadHierarchy::new()`` and ``ThreadHierarchy::current()`` provide the same
physical groups through ``thread()``, ``warp()``, ``block()``, ``cluster()`` and
``grid()``. ``Hierarchy`` aliases ``ThreadHierarchy``.

Queries run in an Oxide-compiled kernel with the workspace's pinned
``1.99.1`` toolchain. The device dependency is pinned in Cargo; there
is no backend-selection feature. Plain Cargo commands need the workspace's
unstable-feature configuration; see :doc:`index` for standalone crate setup.
Host payload tests require no CUDA installation.
The host provider remains independently usable on Rust 1.85.

Rank and count
--------------

``group.rank()`` and ``group.count()`` default to the Thread level. Rust selects
an explicit level with ``rank_at::<coop::Warp>()`` or
``count_at::<coop::Warp>()``. An inner level queries constituents within the
group; an outer level queries that group within its parent. Equal levels have
rank zero and count one. Physical queries use x-fastest linearization within
each level, with blocks ordered before their constituent threads or warps.

For example, ``this_block().rank()`` is the current thread's linear rank in the
block, while ``this_block().rank_at::<coop::Grid>()`` is the block's linear rank
in the grid. The result is ``u64`` when either scope or query level is Grid,
and ``u32`` otherwise. Grid arithmetic promotes coordinates before multiplying.
``rank_as::<i16>()`` and ``count_as::<i16>()`` select one of the eight fixed-width
integer types; ``rank_at_as::<i16, coop::Warp>()`` also selects a level.
Conversions follow integer ``as`` semantics, so callers must choose a sufficient
width to avoid truncation.

A physical warp always counts 32 lanes. Block warp counts round up when the
last warp is partially occupied. On known targets below sm_90, cluster queries
describe one block per cluster.
On sm_90 and newer they describe the launch's cluster; an ordinary, unclustered
launch still has one block per cluster. An unknown target retains the sm_90
minimum for these queries. No query allocates storage or synchronizes threads.
Copying a descriptor preserves the
scope, and subsequent queries describe the thread executing them.

Mapped groups
-------------

``this_warp().group_by::<8>()`` partitions a physical warp into groups of eight
lanes. ``this_block().group_by::<2>()`` partitions a block into groups of two
**physical warps**, each containing 64 threads. The default is exhaustive:
partition size must divide the parent's unit count. Both forms require complete
physical warps in the enclosing block.

``group_by_non_exhaustive::<N>()`` excludes leftover units. Its ``is_member()``
query returns ``1u8`` for members and ``0u8`` for excluded threads. Counts remain
defined for nonmembers; rank queries on a nonmember trap. Lane groups accept
only Thread and Warp levels; warp groups accept Thread, Warp and Block levels.
Mapped groups cannot be partitioned again.

Sizes must be positive compile-time constants. Invalid static sizes fail during
compilation. Checks that depend on the actual block dimensions trap on device
when violated. These descriptors and checks provide no proof of collective
participation, uniform control flow, or scratch ownership. The Load/Store API
accepts power-of-two lane groups of widths 1, 2, 4, 8, 16 and 32 with Direct, Striped, Vectorize or
Transpose and implicit storage. Other mapped groups remain query-only. Canonical Warp-in-Block
and logical-group-in-Warp ranks preserve group uniformity in checked operations;
ordinary lane arithmetic does not receive that guarantee.

Run the native query checks
---------------------------

The standalone ``rust/cuda-coop/tests/device_queries`` package contains the
complete native program. It verifies all physical scope/level pairs with
multidimensional blocks and grids, a partial final warp, a clustered launch,
exhaustive and non-exhaustive mappings, and integer conversions. Raw CUDA
coordinates select output locations independently of the queries being checked.
The same program checks payload initialization, safe access and copying at
item counts 1 and 4. It uses the
same pinned public Oxide dependencies as the library. Keeping this native
package separate lets ordinary workspace tests run without CUDA host libraries.

With the matching ``cargo-oxide`` compiler installed, a CUDA toolkit, and an
sm_120 GPU, run from the CCCL checkout:

.. code-block:: shell

cd rust/cuda-coop/tests/device_queries
CUDA_HOME=/usr/local/cuda-13.3 cargo oxide run --arch sm_120 --materialize-cubin
compute-sanitizer --tool memcheck --error-exitcode 1 target/release/device_queries

The five rejection modes run in separate processes because a device trap makes
its CUDA context unusable:

.. code-block:: shell

for case in 0 1 2 3 4; do
target/release/device_queries "$case"
done

They check partial physical warps, an indivisible exhaustive partition, a
partition larger than its parent, and a rank query by an excluded lane. The
last mode indexes an unwritten payload slot. The program reports success only
when CUDA returns the expected device-trap error.
Loading
Loading