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

Commit

Permalink
Merge pull request #611 from kaatish/bug-fix/github/warp-scan-vector-…
Browse files Browse the repository at this point in the history
…type

Fix warp scan exlusive sum for vector types
  • Loading branch information
gevtushenko authored Jan 7, 2023
2 parents 12332f0 + 074ce95 commit 8bdb54d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
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 {};
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

0 comments on commit 8bdb54d

Please sign in to comment.