handle_create.cpp 11.8 KB
Newer Older
1
// #include "src/common/handle_impl.h"
2

3
#include "src/cuda/adaptive_pooling/opr_impl.h"
4 5 6
#include "src/cuda/add_update/opr_impl.h"
#include "src/cuda/argmxx/opr_impl.h"
#include "src/cuda/argsort/opr_impl.h"
M
Megvii Engine Team 已提交
7
#include "src/cuda/batch_conv_bias/opr_impl.h"
8 9
#include "src/cuda/batch_normalization/opr_impl.h"
#include "src/cuda/batched_matrix_mul/opr_impl.h"
10
#include "src/cuda/check_non_finite/opr_impl.h"
11 12 13 14 15 16 17
#include "src/cuda/checksum/opr_impl.h"
#include "src/cuda/concat/opr_impl.h"
#include "src/cuda/cond_take/opr_impl.h"
#include "src/cuda/conv_bias/opr_impl.h"
#include "src/cuda/convolution/opr_impl.h"
#include "src/cuda/convolution3d/opr_impl.h"
#include "src/cuda/convpooling/opr_impl.h"
18
#include "src/cuda/correlation/opr_impl.h"
19 20
#include "src/cuda/cumsum/opr_impl.h"
#include "src/cuda/cvt_color/opr_impl.h"
21
#include "src/cuda/dct/opr_impl.h"
22 23
#include "src/cuda/deformable_conv/opr_impl.h"
#include "src/cuda/deformable_ps_roi_pooling/opr_impl.h"
24
#include "src/cuda/diag/opr_impl.h"
25
#include "src/cuda/dot/opr_impl.h"
26
#include "src/cuda/dropout/opr_impl.h"
27 28 29
#include "src/cuda/elemwise/opr_impl.h"
#include "src/cuda/elemwise_multi_type/opr_impl.h"
#include "src/cuda/eye/opr_impl.h"
M
Megvii Engine Team 已提交
30
#include "src/cuda/fake_quant/opr_impl.h"
M
Megvii Engine Team 已提交
31
#include "src/cuda/fill/opr_impl.h"
32 33
#include "src/cuda/flip/opr_impl.h"
#include "src/cuda/gaussian_blur/opr_impl.h"
34
#include "src/cuda/general_norm/opr_impl.h"
35
#include "src/cuda/group_local/opr_impl.h"
36
#include "src/cuda/group_norm/opr_impl.h"
37 38 39
#include "src/cuda/images2neibs/opr_impl.h"
#include "src/cuda/indexing_multi_axis_vec/opr_impl.h"
#include "src/cuda/indexing_one_hot/opr_impl.h"
40
#include "src/cuda/lamb/opr_impl.h"
41
#include "src/cuda/layer_norm/opr_impl.h"
42 43 44 45
#include "src/cuda/linspace/opr_impl.h"
#include "src/cuda/local/opr_impl.h"
#include "src/cuda/local_share/opr_impl.h"
#include "src/cuda/lrn/opr_impl.h"
M
Megvii Engine Team 已提交
46
#include "src/cuda/lsq/opr_impl.h"
47
#include "src/cuda/mask_conv/opr_impl.h"
M
Megvii Engine Team 已提交
48
#include "src/cuda/masked_fill/opr_impl.h"
49 50 51 52
#include "src/cuda/matrix_inverse/opr_impl.h"
#include "src/cuda/matrix_mul/opr_impl.h"
#include "src/cuda/max_tensor_diff/opr_impl.h"
#include "src/cuda/mesh_indexing/opr_impl.h"
53
#include "src/cuda/multi_head_attn/opr_impl.h"
54
#include "src/cuda/norm/opr_impl.h"
M
Megvii Engine Team 已提交
55
#include "src/cuda/padding/opr_impl.h"
56 57 58 59
#include "src/cuda/param_pack/opr_impl.h"
#include "src/cuda/pooling/opr_impl.h"
#include "src/cuda/powc/opr_impl.h"
#include "src/cuda/reduce/opr_impl.h"
60
#include "src/cuda/region_restricted_convolution/opr_impl.h"
61 62
#include "src/cuda/relayout/opr_impl.h"
#include "src/cuda/relayout_format/opr_impl.h"
M
Megvii Engine Team 已提交
63
#include "src/cuda/remap/opr_impl.h"
64 65 66
#include "src/cuda/repeat/opr_impl.h"
#include "src/cuda/resize/opr_impl.h"
#include "src/cuda/rng/opr_impl.h"
M
Megvii Engine Team 已提交
67
#include "src/cuda/roi_align/opr_impl.h"
68 69 70 71 72 73
#include "src/cuda/roi_copy/opr_impl.h"
#include "src/cuda/roi_pooling/opr_impl.h"
#include "src/cuda/rotate/opr_impl.h"
#include "src/cuda/separable_conv/opr_impl.h"
#include "src/cuda/separable_filter/opr_impl.h"
#include "src/cuda/sleep/opr_impl.h"
74
#include "src/cuda/sliding_window_transpose/opr_impl.h"
75
#include "src/cuda/softmax/opr_impl.h"
76 77 78 79 80
#include "src/cuda/split/opr_impl.h"
#include "src/cuda/svd/opr_impl.h"
#include "src/cuda/tensor_remap/opr_impl.h"
#include "src/cuda/tile/opr_impl.h"
#include "src/cuda/topk/opr_impl.h"
M
Megvii Engine Team 已提交
81
#include "src/cuda/tqt/opr_impl.h"
82 83 84 85 86 87 88 89
#include "src/cuda/transpose/opr_impl.h"
#include "src/cuda/type_cvt/opr_impl.h"
#include "src/cuda/warp_affine/opr_impl.h"
#include "src/cuda/warp_perspective/opr_impl.h"

namespace megdnn {
namespace cuda {

90
// After Adding CUDA LSTM, the declaration of CUDA Backend should be restored
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
// MEGDNN_FOREACH_OPR_CLASS(MEGDNN_SPECIALIZE_CREATE_OPERATOR)
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ConvolutionForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ConvolutionBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ConvolutionBackwardFilter);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ConvPoolingForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ConvBiasForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Images2NeibsForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Images2NeibsBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SlidingWindowTransposeForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SlidingWindowTransposeBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ElemwiseForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ElemwiseMultiType);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(AddUpdateForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RelayoutForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(PoolingForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(PoolingBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LocalForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LocalBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LocalBackwardFilter);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LRNForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LRNBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ROIPoolingForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ROIPoolingBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(WarpPerspectiveForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(WarpPerspectiveBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(WarpPerspectiveBackwardMat);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DotForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MatrixInverse);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MatrixMulForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BatchedMatrixMulForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SVDForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ReduceForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(CondTake);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(CumsumForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ArgmaxForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ArgminForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(TransposeForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ConcatForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SplitForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(TileForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(TileBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RepeatForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RepeatBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ArgsortForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ArgsortBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(TypeCvt);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IndexingRemapForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IndexingRemapBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ChecksumForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IndexingOneHotForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IndexingSetOneHotForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IndexingMultiAxisVec);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IndexingSetMultiAxisVec);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IndexingIncrMultiAxisVec);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MeshIndexing);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(IncrMeshIndexing);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SetMeshIndexing);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BatchedMeshIndexing);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BatchedIncrMeshIndexing);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BatchedSetMeshIndexing);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Linspace);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Eye);
153
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Diag);
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SleepForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(UniformRNG);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GaussianRNG);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GammaRNG);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BetaRNG);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(PoissonRNG);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(PermutationRNG);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ShuffleRNGForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ShuffleRNGBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SeparableConvForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SeparableFilterForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BNForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BNBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GroupLocalForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GroupLocalBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GroupLocalBackwardFilter);
170 171
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GroupNormForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GroupNormBackward);
172 173 174 175 176 177 178 179
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Flip);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Rotate);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ROICopy);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(CvtColor);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(WarpAffine);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GaussianBlur);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Resize);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ResizeBackward);
180
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Resize3D);
181 182 183 184
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ParamPackConcat);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MaxTensorDiff);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MaskConvForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MaskPropagate);
M
Megvii Engine Team 已提交
185
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MaskedFill);
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Convolution3DForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Convolution3DBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Convolution3DBackwardFilter);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DeformableConvForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DeformableConvBackwardFilter);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DeformableConvBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DeformablePSROIPoolingForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DeformablePSROIPoolingBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RelayoutFormat);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(TopK);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(PowC);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LocalShareForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LocalShareBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LocalShareBackwardFilter);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ROIAlignForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(ROIAlignBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(CorrelationForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(CorrelationBackwardData1);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(CorrelationBackwardData2);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(BatchConvBiasForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Remap);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RemapBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RemapBackwardMat);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(AdaptivePoolingForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(AdaptivePoolingBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DctChannelSelectForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(FakeQuantForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(FakeQuantBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(TQTForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(TQTBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(CheckNonFinite);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LSQForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LSQBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(Fill);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(PaddingForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(PaddingBackward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LayerNormForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LayerNormBackward);
224 225
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GeneralNormForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(GeneralNormBackward);
226
MEGDNN_SPECIALIZE_CREATE_OPERATOR(LAMBUpdate);
227 228
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DropoutForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(DropoutBackward);
229 230
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SoftmaxForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(SoftmaxBackward);
231
MEGDNN_SPECIALIZE_CREATE_OPERATOR(NormForward);
232 233 234
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RegionRestrictedConvolutionForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RegionRestrictedConvolutionBackwardData);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(RegionRestrictedConvolutionBackwardFilter);
235 236
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MultiHeadAttnForward);
MEGDNN_SPECIALIZE_CREATE_OPERATOR(MultiHeadAttnBackward);
237 238 239

template <typename Opr>
std::unique_ptr<Opr> HandleImpl::create_operator() {
240 241 242
    megdnn_throw(
            "unsupported cuda opr, try export RUNTIME_OVERRIDE_LOG_LEVEL=0 to get more "
            "info");
243 244 245 246 247 248
    return nullptr;
}

#define MEGDNN_INST_CREATE_OPERATOR(opr) \
    template std::unique_ptr<megdnn::opr> HandleImpl::create_operator();

249 250 251
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Winstantiation-after-specialization"
252
MEGDNN_FOREACH_OPR_CLASS(MEGDNN_INST_CREATE_OPERATOR)
253
#pragma GCC diagnostic pop
254 255 256 257
}  // namespace cuda
}  // namespace megdnn

// vim: syntax=cpp.doxygen