2020-11-05 16:41:56 +08:00
|
|
|
//
|
|
|
|
// ConvSingleInputExecution.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2020/08/22.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ConvSingleInputExecution_hpp
|
|
|
|
#define ConvSingleInputExecution_hpp
|
|
|
|
|
|
|
|
#include "backend/cuda/core/CUDABackend.hpp"
|
|
|
|
#include "core/Execution.hpp"
|
2022-01-04 10:50:40 +08:00
|
|
|
#include "TensorCoreGemm.cuh"
|
2020-11-05 16:41:56 +08:00
|
|
|
namespace MNN {
|
|
|
|
namespace CUDA {
|
|
|
|
|
|
|
|
struct KernelInfo {
|
|
|
|
int groups = 0;
|
|
|
|
int kernelN = 0;
|
|
|
|
int kernelC = 0;
|
|
|
|
int kernelX = 0;
|
|
|
|
int kernelY = 0;
|
|
|
|
int strideX = 0;
|
|
|
|
int strideY = 0;
|
|
|
|
int dilateX = 0;
|
|
|
|
int dilateY = 0;
|
|
|
|
int activationType = 0;
|
|
|
|
};//
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
class ConvSingleInputExecution : public Execution {
|
|
|
|
public:
|
2021-11-30 10:10:53 +08:00
|
|
|
struct Resource {
|
|
|
|
Resource(Backend* bn, const MNN::Op* op);
|
|
|
|
~ Resource();
|
|
|
|
void* mFilter;
|
|
|
|
void* mBias;
|
|
|
|
std::shared_ptr<Tensor> weightTensor;
|
|
|
|
std::shared_ptr<Tensor> biasTensor;
|
|
|
|
KernelInfo mKernelInfo;
|
|
|
|
Backend* mBackend = nullptr;
|
|
|
|
};
|
|
|
|
ConvSingleInputExecution(Backend* backend, const MNN::Op* op, std::shared_ptr<Resource> res);
|
2020-11-05 16:41:56 +08:00
|
|
|
virtual ~ConvSingleInputExecution();
|
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor*> &inputs, const std::vector<Tensor*> &outputs) override;
|
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor*> &inputs, const std::vector<Tensor*> &outputs) override;
|
2021-11-30 10:10:53 +08:00
|
|
|
virtual bool onClone(Backend* bn, const Op* op, Execution** dst) override;
|
2020-11-05 16:41:56 +08:00
|
|
|
|
|
|
|
private:
|
2021-11-30 10:10:53 +08:00
|
|
|
std::shared_ptr<Resource> mResource;
|
2020-11-05 16:41:56 +08:00
|
|
|
|
2022-01-04 10:50:40 +08:00
|
|
|
const Op* mOp = nullptr;
|
|
|
|
MatMulParam mMatMulParam;
|
|
|
|
std::pair<void*, int> mGpuMatMulParam;
|
2020-11-05 16:41:56 +08:00
|
|
|
|
2022-01-04 10:50:40 +08:00
|
|
|
ConvolutionCommon::Im2ColParameter mIm2ColParamter;
|
|
|
|
std::pair<void*, int> mGpuIm2ColParam;
|
2020-11-05 16:41:56 +08:00
|
|
|
|
2022-01-04 10:50:40 +08:00
|
|
|
__half* mIm2ColBuffer;
|
2020-11-05 16:41:56 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace CUDA
|
|
|
|
} // namespace MNN
|
|
|
|
|
|
|
|
#endif /* ConvSingleInputExecution */
|