Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix single-thread block reduction #287

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
27 changes: 25 additions & 2 deletions cub/cub/warp/warp_reduce.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,31 @@ private:
using _TempStorage = cub::NullType;

public:
struct TempStorage : Uninitialized<_TempStorage>
{};
struct InternalWarpReduce
{
struct TempStorage : Uninitialized<_TempStorage>
{};

__device__ __forceinline__ InternalWarpReduce(TempStorage & /*temp_storage */) {}

template <bool ALL_LANES_VALID, typename ReductionOp>
__device__ __forceinline__ T Reduce(T input,
int /* valid_items */,
ReductionOp /* reduction_op */)
{
return input;
}

template <bool HEAD_SEGMENTED, typename FlagT, typename ReductionOp>
__device__ __forceinline__ T SegmentedReduce(T input,
FlagT /* flag */,
ReductionOp /* reduction_op */)
{
return input;
}
};

using TempStorage = typename InternalWarpReduce::TempStorage;

__device__ __forceinline__ WarpReduce(TempStorage & /*temp_storage */) {}

Expand Down
2 changes: 1 addition & 1 deletion cub/test/catch2_test_block_reduce.cu
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ struct max_full_tile_op_t
using types = c2h::type_list<std::uint8_t, std::uint16_t, std::int32_t, std::int64_t, float, double>;
using vec_types = c2h::type_list<ulonglong4, uchar3, short2>;

// %PARAM% TEST_DIM_X dimx 7:32:65:128
// %PARAM% TEST_DIM_X dimx 1:7:32:65:128
// %PARAM% TEST_DIM_YZ dimyz 1:2

using block_dim_xs = c2h::enum_type_list<int, TEST_DIM_X>;
Expand Down
Loading