| 84 | class TargetProfile, |
| 85 | class BinaryOp = cute::plus> |
| 86 | CUTE_HOST_DEVICE constexpr |
| 87 | void |
| 88 | logical_reduce(Tensor<SrcEngine, SrcLayout> const& src, |
| 89 | Tensor<DstEngine, DstLayout> & dst, |
| 90 | TargetProfile const& target_profile, |
| 91 | BinaryOp op = {}) |
| 92 | { |
| 93 | // Precondition |
| 94 | assert(compatible(target_profile, shape(src))); |
| 95 | |
| 96 | auto diced_layout = dice(target_profile, src.layout()); |
| 97 | auto sliced_layout = slice(target_profile, src.layout()); |
| 98 | |
| 99 | auto red_mode = conditional_return<rank(diced_layout) == Int<0>{}>(Layout<_1,_0>{}, diced_layout); |
| 100 | auto batch_mode = conditional_return<rank(sliced_layout) == Int<0>{}>(Layout<_1,_0>{}, sliced_layout); |
| 101 | |
| 102 | auto src_tensor = make_tensor(src.data(), make_layout(red_mode, batch_mode)); |
| 103 | |
| 104 | batch_reduce(src_tensor, dst, op); |
| 105 | } |
| 106 | |
| 107 | } // end namespace cute |
no test coverage detected