| 5 | namespace cuda { |
| 6 | |
| 7 | void TQTForwardImpl::exec( |
| 8 | _megdnn_tensor_in input, _megdnn_tensor_in scale, _megdnn_tensor_out output, |
| 9 | _megdnn_workspace workspace) { |
| 10 | check_exec(input.layout, scale.layout, output.layout, workspace.size); |
| 11 | |
| 12 | if (!input.layout.is_contiguous() || !output.layout.is_contiguous()) |
| 13 | return exec_noncontig(input, scale, output); |
| 14 | |
| 15 | ElemwiseOpParamN<1> ele_param; |
| 16 | ele_param[0] = scale; |
| 17 | ele_param[0].layout = ele_param[0].layout.broadcast(input.layout); |
| 18 | ele_param.init_from_given_tensor(); |
| 19 | auto m_param = param(); |
| 20 | auto stream = cuda_stream(handle()); |
| 21 | |
| 22 | #define cb(DType) \ |
| 23 | if (input.layout.dtype == DType()) { \ |
| 24 | using T = typename DTypeTrait<DType>::ctype; \ |
| 25 | run_elemwise<TQTKernOp<T>, T, 1>(ele_param, stream, {input, output, m_param}); \ |
| 26 | return; \ |
| 27 | } |
| 28 | cb(megdnn::dtype::Float32) |
| 29 | #undef cb |
| 30 | } |
| 31 | |
| 32 | void TQTForwardImpl::exec_noncontig( |
| 33 | _megdnn_tensor_in input, _megdnn_tensor_in scale, _megdnn_tensor_out output) { |
nothing calls this directly
no test coverage detected