MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / exec

Method exec

dnn/src/cuda/tqt/opr_impl.cpp:7–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5namespace cuda {
6
7void 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
32void TQTForwardImpl::exec_noncontig(
33 _megdnn_tensor_in input, _megdnn_tensor_in scale, _megdnn_tensor_out output) {

Callers

nothing calls this directly

Calls 6

cuda_streamFunction · 0.85
paramFunction · 0.50
cbFunction · 0.50
is_contiguousMethod · 0.45
broadcastMethod · 0.45

Tested by

no test coverage detected