Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
333 commits
Select commit Hold shift + click to select a range
feec7ce
Add Block Shuffle with checked partial results
tpn Oct 21, 2026
33e7ebb
Add Rust Block Adjacent Difference
tpn Oct 21, 2026
187841f
Add Rust Block Discontinuity
tpn Oct 22, 2026
b04a65d
Add block Histogram with independent output counters
tpn Oct 22, 2026
7e7f05f
Add stable block Radix Sort for keys
tpn Oct 22, 2026
1a05d0d
Add Rust block radix sorting for key-value pairs
tpn Oct 22, 2026
0923caa
Add Rust block radix ranking
tpn Oct 22, 2026
9b65e95
Add Block and Warp merge sort keys
tpn Oct 22, 2026
c6e7ac3
Add Rust Merge Sort Pairs collectives
tpn Oct 22, 2026
bb8da6b
Add Rust block TopK operations
tpn Oct 23, 2026
b3c7536
Add checked Block Run Length Decode operations
tpn Oct 23, 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
92ba6ea
Align pr12132 with the stable compiler
tpn Oct 23, 2026
ee4b522
Align discontinuity with the stable compiler
tpn Oct 23, 2026
eaf99a9
Align histogram with the stable compiler
tpn Oct 23, 2026
e88adaf
Align radix-sort-keys with the stable compiler
tpn Oct 23, 2026
a087461
Align radix-sort-pairs with the stable compiler
tpn Oct 23, 2026
e687235
Align radix-rank-keys with the stable compiler
tpn Oct 23, 2026
9469bb1
Align merge-sort-keys with the stable compiler
tpn Oct 23, 2026
d609e61
Align merge-sort-pairs with the stable compiler
tpn Oct 23, 2026
e00740e
Align topk with the stable compiler
tpn Oct 23, 2026
89a5bc7
Align run-length-decode 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
696cca0
Carry the corrected artifact dependency
tpn Oct 23, 2026
2112a0a
Carry the corrected artifact dependency
tpn Oct 23, 2026
7c3a8b7
Carry the corrected artifact dependency
tpn Oct 23, 2026
f3554b1
Carry the corrected artifact dependency
tpn Oct 23, 2026
df09532
Carry the corrected artifact dependency
tpn Oct 23, 2026
36cae77
Carry the corrected artifact dependency
tpn Oct 23, 2026
c2de0e2
Carry the corrected artifact dependency
tpn Oct 23, 2026
105e2e0
Carry the corrected artifact dependency
tpn Oct 23, 2026
2715a1c
Carry the corrected artifact dependency
tpn Oct 23, 2026
0da1b38
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
8d4ecdb
Carry the complete query dependency graph
tpn Oct 23, 2026
6ba30f0
Carry the complete query dependency graph
tpn Oct 23, 2026
fed7e91
Carry the complete query dependency graph
tpn Oct 23, 2026
50273ca
Carry the complete query dependency graph
tpn Oct 23, 2026
19be82a
Carry the complete query dependency graph
tpn Oct 23, 2026
438434b
Carry the complete query dependency graph
tpn Oct 23, 2026
0d99f3c
Carry the complete query dependency graph
tpn Oct 23, 2026
7fb1096
Carry the complete query dependency graph
tpn Oct 23, 2026
ab46f76
Carry the complete query dependency graph
tpn Oct 23, 2026
6e147bc
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
f034370
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
8fb7fc5
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
501358b
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
404c609
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
31f8271
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
4eadb3e
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
94c9874
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
9d221de
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
8784942
Carry Direct diagnostic compatibility
tpn Oct 23, 2026
6439ba4
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
1b30967
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
a125e03
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
832f86e
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
5eae1c1
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
ee11056
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
0a59e6c
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
1009c33
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
184e517
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
aac3a7e
Carry Transpose diagnostic compatibility
tpn Oct 23, 2026
4dbf9e3
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
0c9c7c3
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
17fddfa
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
47a7a93
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
4e3d019
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
fb7bb3d
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
8e4005a
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
b5d764e
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
d83e4ec
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
6484660
Carry Striped diagnostic compatibility
tpn Oct 23, 2026
16abfc0
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
f0b7fb2
Carry storage diagnostic compatibility
tpn Oct 23, 2026
e5540be
Carry storage diagnostic compatibility
tpn Oct 23, 2026
83bc780
Carry storage diagnostic compatibility
tpn Oct 23, 2026
5c3190e
Carry storage diagnostic compatibility
tpn Oct 23, 2026
4673526
Carry storage diagnostic compatibility
tpn Oct 23, 2026
8fbaa85
Carry storage diagnostic compatibility
tpn Oct 23, 2026
d545f7b
Carry storage diagnostic compatibility
tpn Oct 23, 2026
f3ff615
Carry storage diagnostic compatibility
tpn Oct 23, 2026
f36aedb
Carry storage diagnostic compatibility
tpn Oct 23, 2026
c023548
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
307fa3a
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
464ac5c
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
5a37c54
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
9a3e7fb
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
086671e
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
36333f1
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
63f9cc7
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
2235fa5
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
d35f4ef
Carry Vectorize diagnostic compatibility
tpn Oct 23, 2026
a910653
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
2513649
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
e12dda5
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
48ee91e
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
84cd28d
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
35f7e2f
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
42c11c4
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
7a8a828
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
18998f2
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
53a495d
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
4c5794c
Carry Physical-Warp expectation correction
tpn Oct 23, 2026
67d2513
Support stateless callable Block reduction
tpn Oct 23, 2026
a30ee29
Support uniform scalar captures in Rust Block Reduce
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
91 changes: 91 additions & 0 deletions docs/rust/adjacent_difference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.. Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
.. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Differences between neighboring values
=======================================

``adjacent_difference`` subtracts neighboring values in a block's blocked
order. It preserves the input and returns a fresh ``ThreadData`` with the
same element type, item count and alignment. The default ``Left`` direction
subtracts the previous item; ``Right`` subtracts the next item:

.. code-block:: rust

let left = coop::adjacent_difference(block, &values, Default::default());
let right = coop::adjacent_difference(block, &values,
coop::AdjacentDifferenceOptions::default().direction(coop::Right));

For ``[10, 20, 40, 70]``, Left produces ``[10, 10, 20, 30]`` and Right
produces ``[-10, -20, -30, 70]``. Neighbors cross thread boundaries. Without
an outside neighbor, the first Left item or last Right item is copied.

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

The helper keeps ``ITEMS_PER_THREAD`` generic and infers the element type
from the input slice. Load initializes the payload, Adjacent Difference
returns fresh values, and Store writes the result:

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

The host program specializes one and four items per thread:

.. literalinclude:: ../../rust/cuda-coop/examples/adjacent_difference/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/adjacent_difference
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
shared-storage plan, including the actual CUB temporary-storage requirement.

Counts and outside neighbors
-----------------------------

``valid_items(count)`` limits the subtraction to the first ``count`` items
of the whole block tile. Every later item is copied unchanged. With count
two, the example above produces ``[10, 10, 40, 70]`` for Left and
``[-10, 20, 40, 70]`` for Right. Count zero returns a copy of the whole input.
Counts must be block-uniform and lie between zero and the tile capacity.

Left accepts ``tile_predecessor_item(value)`` with or without a count.
Right accepts ``tile_successor_item(value)`` only when the count is omitted.
A supplied count and successor are rejected even when the count equals the
full tile size. Outside neighbors have exactly the input element type and
must be block-uniform. Changing direction preserves the option fields;
it does not reinterpret a predecessor as a successor.

Every input slot must be initialized, including the copied suffix and every
slot at count zero. Fill missing Load items or initialize them with ``write``
before calling. Every result slot is initialized; changing a result cannot
change the input. Arithmetic uses native subtraction in the input type.

Groups and temporary storage
----------------------------

The operation accepts complete one-, two- and three-dimensional Blocks and
all ten ``Numeric`` types. Rank is x-fastest; item count is positive and the
whole tile must fit CUB's signed 32-bit indexing range. All threads participate
with the same direction, type and extent. Scalars and Warp groups are not
supported. Same-extent generic helpers need no ``generic_const_exprs`` feature.

Omitted storage uses managed synchronization before scratch reuse. Borrow an
explicit descriptor with ``temp_storage(&mut scratch)`` to use the policies
described in :doc:`load_store`: manual reuse requires block completion,
``auto_sync()`` supplies a trailing barrier, and exclusive storage has its
own allocation. Adjacent Difference does not itself promise completion of
unrelated global-memory accesses; use ``cuda_device::thread::sync_threads()``
when those accesses need block completion.

See :doc:`payload` for checked access and :doc:`groups` for participation.
Generate the API reference with ``cargo doc --workspace --no-deps`` from
``rust/`` for the full signatures and legal option combinations.
90 changes: 90 additions & 0 deletions docs/rust/discontinuity.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
.. Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
.. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Flags at changes between values
===============================

``discontinuity`` marks changes between neighboring items in blocked order.
It preserves the input and returns fresh ``i32`` flags: one for unequal
neighbors, zero for equal neighbors. ``Heads`` is the default and compares
each item with its predecessor. ``Tails`` compares with its successor.
``HeadsAndTails`` returns two independent payloads, heads first:

.. code-block:: rust

let heads = coop::discontinuity(block, &values, Default::default());
let (heads, tails) = coop::discontinuity(block, &values,
coop::DiscontinuityOptions::default().mode(coop::HeadsAndTails));

For ``[2, 2, 5, 5]``, heads are ``[1, 0, 1, 0]`` and tails are
``[0, 1, 0, 1]``. Neighbors cross thread boundaries. Without an outside
neighbor, the first head and last tail are one.

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

The helper infers the input type and keeps ``ITEMS_PER_THREAD`` generic.
It loads a complete tile and returns both flag payloads and the preserved
input. The flag type is ``i32`` even when the input is ``f64``:

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

The host program uses a ``(4, 3, 2)`` block, specializes one and four items
per thread, and checks both flag arrays and the preserved input:

.. literalinclude:: ../../rust/cuda-coop/examples/discontinuity/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/discontinuity
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
plan for the actual CUB temporary-storage requirement.

Outside neighbors and initialized input
---------------------------------------

Heads accepts ``tile_predecessor_item(value)``; Tails accepts
``tile_successor_item(value)``. The combined mode accepts either, both or
neither. Outside neighbors have exactly the input type and are uniform
across the block. A supplied neighbor makes its edge flag a normal
comparison: predecessor two changes the example's first head to zero;
successor five changes its last tail to zero. Builders preserve both fields
when changing mode.

Every input slot must be initialized. There is no count option: all values,
including any fill supplied to Load, participate in comparisons. Floating
inequality treats NaNs as unequal and positive and negative zero as equal.
Every output slot is initialized. Both outputs retain the input's item
count and minimum alignment, with the natural alignment required by ``i32``.
Changing either result cannot change the input or the other result.

Groups and temporary storage
----------------------------

Complete one-, two- and three-dimensional Blocks and all ten ``Numeric``
input types are supported. Rank is x-fastest, item count is positive, and
the complete tile must fit CUB's signed 32-bit indexing range. Every thread
participates with the same mode, type and extent. Generic helpers can return
one payload or the pair without a ``generic_const_exprs`` feature.

Omitted storage uses managed synchronization before scratch reuse. Use
``temp_storage(&mut scratch)`` for an explicit descriptor: manual reuse
requires block completion, ``auto_sync()`` supplies a trailing barrier,
and exclusive storage keeps its existing allocation policy. For unrelated
global accesses that need block completion, use
``cuda_device::thread::sync_threads()``.

See :doc:`payload`, :doc:`groups` and :doc:`load_store` for checked access,
participation and storage. Generate the API reference with
``cargo doc --workspace --no-deps`` from ``rust/`` for the full signatures
and mode-dependent result types.
Loading
Loading