| 102 | namespace cuda { |
| 103 | |
| 104 | void ReduceForwardImpl::exec( |
| 105 | _megdnn_tensor_in src, _megdnn_tensor_out dst, _megdnn_workspace workspace) { |
| 106 | using namespace device_reduce; |
| 107 | check_exec(src.layout, dst.layout, workspace.size); |
| 108 | size_t A, B, C; |
| 109 | reduce::get_ABC(src.layout, A, B, C, param().axis); |
| 110 | auto stream = cuda_stream(this->handle()); |
| 111 | #define CASE(_mode, _op) \ |
| 112 | case _mode: \ |
| 113 | return dispatch_dtype<_op>( \ |
| 114 | stream, src, dst, workspace, A, B, C, param().data_type); |
| 115 | switch (param().mode) { |
| 116 | CASE(Mode::SUM, SumOp) |
| 117 | CASE(Mode::SUM_SQR, SumSqrOp) |
| 118 | CASE(Mode::PRODUCT, ProdOp) |
| 119 | CASE(Mode::MIN, MinOp) |
| 120 | CASE(Mode::MAX, MaxOp) |
| 121 | CASE(Mode::MEAN, MeanOp) |
| 122 | default: |
| 123 | megdnn_assert_internal(false); |
| 124 | #undef CASE |
| 125 | } |
| 126 | } |
| 127 | } // namespace cuda |
| 128 | |
| 129 | size_t ReduceForwardImpl::get_workspace_in_bytes( |
nothing calls this directly
no test coverage detected