Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Fix warp scan exlusive sum for vector types #611

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions cub/warp/warp_scan.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public:
T input, ///< [in] Calling thread's input item.
T &exclusive_output) ///< [out] Calling thread's output item. May be aliased with \p input.
{
T initial_value = 0;
T initial_value {};
gevtushenko marked this conversation as resolved.
Show resolved Hide resolved
ExclusiveScan(input, exclusive_output, initial_value, cub::Sum());
}

Expand Down Expand Up @@ -393,7 +393,7 @@ public:
T &exclusive_output, ///< [out] Calling thread's output item. May be aliased with \p input.
T &warp_aggregate) ///< [out] Warp-wide aggregate reduction of input items.
{
T initial_value = 0;
T initial_value {};
ExclusiveScan(input, exclusive_output, initial_value, cub::Sum(), warp_aggregate);
}

Expand Down
10 changes: 6 additions & 4 deletions test/test_warp_scan.cu
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,16 @@ __device__ __forceinline__ void DeviceTest(
/// Exclusive sum basic
template <
typename WarpScanT,
typename T>
typename T,
typename IsPrimitiveT>
__device__ __forceinline__ void DeviceTest(
WarpScanT &warp_scan,
T &data,
T &initial_value,
Sum &scan_op,
T &aggregate,
Int2Type<BASIC> test_mode,
Int2Type<true> is_primitive)
IsPrimitiveT is_primitive)
{
// Test basic warp scan
warp_scan.ExclusiveSum(data, data);
Expand All @@ -142,15 +143,16 @@ __device__ __forceinline__ void DeviceTest(
/// Exclusive sum aggregate
template <
typename WarpScanT,
typename T>
typename T,
typename IsPrimitiveT>
__device__ __forceinline__ void DeviceTest(
WarpScanT &warp_scan,
T &data,
T &initial_value,
Sum &scan_op,
T &aggregate,
Int2Type<AGGREGATE> test_mode,
Int2Type<true> is_primitive)
IsPrimitiveT is_primitive)
{
// Test with cumulative aggregate
warp_scan.ExclusiveSum(data, data, aggregate);
Expand Down