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

Reenable CUB tests #188

Merged
merged 1 commit into from
Jun 2, 2022
Merged
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
30 changes: 14 additions & 16 deletions include/matx_reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -1064,15 +1064,14 @@ template <typename TensorType, typename InType, typename ReduceOp>
void inline reduce(TensorType &dest, const InType &in, ReduceOp op,
cudaStream_t stream = 0, [[maybe_unused]] bool init = true)
{
// Disable CUB until bug using 1D outputs is resolved
// constexpr bool use_cub = TensorType::Rank() == 0 || (TensorType::Rank() == 1 && InType::Rank() == 2);
// // Use CUB implementation if we have a tensor on the RHS and it's not blocked from using CUB
// if constexpr (!is_matx_no_cub_reduction_v<ReduceOp> && use_cub) {
// cub_reduce<TensorType, InType, ReduceOp>(dest, in, op.Init(), stream);
// }
// else { // Fall back to the slow path of custom implementation
constexpr bool use_cub = TensorType::Rank() == 0 || (TensorType::Rank() == 1 && InType::Rank() == 2);
// Use CUB implementation if we have a tensor on the RHS and it's not blocked from using CUB
if constexpr (!is_matx_no_cub_reduction_v<ReduceOp> && use_cub) {
cub_reduce<TensorType, InType, ReduceOp>(dest, in, op.Init(), stream);
}
else { // Fall back to the slow path of custom implementation
reduce(dest, std::nullopt, in, op, stream, init);
//}
}
}

/**
Expand Down Expand Up @@ -1214,15 +1213,14 @@ template <typename TensorType, typename InType>
void inline sum(TensorType &dest, const InType &in, cudaStream_t stream = 0)
{
#ifdef __CUDACC__
// Disable CUB until bug using 1D outputs is resolved
// constexpr bool use_cub = TensorType::Rank() == 0 || (TensorType::Rank() == 1 && InType::Rank() == 2);
// // Use CUB implementation if we have a tensor on the RHS
// if constexpr (use_cub) {
// cub_sum<TensorType, InType>(dest, in, stream);
// }
// else { // Fall back to the slow path of custom implementation
constexpr bool use_cub = TensorType::Rank() == 0 || (TensorType::Rank() == 1 && InType::Rank() == 2);
// Use CUB implementation if we have a tensor on the RHS
if constexpr (use_cub) {
cub_sum<TensorType, InType>(dest, in, stream);
}
else { // Fall back to the slow path of custom implementation
reduce(dest, in, detail::reduceOpSum<typename TensorType::scalar_type>(), stream, true);
//}
}
#endif
}

Expand Down