NVIDIA / cccl

CUDA Core Compute Libraries
Other
1.1k stars 128 forks source link

Document and test WarpScan::Scan's treatment of `init` argument #850

Open jszuppe opened 6 years ago

jszuppe commented 6 years ago
...
int input = 1;
int init = 10;
int inclusive_output, exclusive_output;

using WarpScan = cub::WarpScan<int, 32>;
__shared__ typename WarpScan::TempStorage storage[warps_no];
WarpScan(storage[warp_id])
    .Scan(input, inclusive_output, exclusive_output, init, cub::Sum());
...

Should inclusive_output after calling WarpScan::Scan(..) function include init? Right now it does, but WarpScan::Scan's documentation is unclear about it.

alliepiper commented 3 years ago

We should update the docs and add a test, if needed.

nolmoonen commented 6 months ago

It it helps, it seems the current test for WarpScan::Scan with initial value does assert that the inclusive output should include the initial value (see https://github.com/NVIDIA/cccl/blob/main/cub/test/catch2_test_warp_scan.cu#L304). However, the documentation still states that initial value is "Initial value to seed the exclusive scan" and does not address whether it is included in the inclusive scan.