2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// ConvExecution.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2019/01/31.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ConvExecution_hpp
|
|
|
|
#define ConvExecution_hpp
|
|
|
|
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "core/Execution.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "backend/opencl/core/OpenCLBackend.hpp"
|
|
|
|
#include "backend/opencl/core/OpenCLRunningUtils.hpp"
|
2023-06-16 09:42:45 +08:00
|
|
|
#include "backend/opencl/execution/image/CommonExtension.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
namespace MNN {
|
|
|
|
namespace OpenCL {
|
|
|
|
|
2023-06-16 09:42:45 +08:00
|
|
|
class ConvCommonExecution : public Execution, public CommonExtension {
|
2019-04-17 10:49:11 +08:00
|
|
|
public:
|
|
|
|
ConvCommonExecution(const Convolution2D *op, Backend *backend);
|
|
|
|
virtual ~ConvCommonExecution();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<Tensor> mBias;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ConvExecution : public ConvCommonExecution {
|
|
|
|
public:
|
2020-11-05 11:10:27 +08:00
|
|
|
ConvExecution(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs, const MNN::Op *op, Backend *backend);
|
2019-04-17 10:49:11 +08:00
|
|
|
virtual ~ConvExecution();
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
static std::shared_ptr<Tensor> getBias(OpenCLBackend *backend, const Convolution2D *conv);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Convolution2DCommon *mConv2dCommonParams;
|
|
|
|
std::vector<int> mStrides{1, 1};
|
|
|
|
std::vector<int> mPaddings{0, 0};
|
|
|
|
std::vector<int> mDilations{1, 1};
|
|
|
|
std::vector<uint32_t> mGlobalWorkSize{1, 1, 1};
|
|
|
|
std::vector<uint32_t> mLocalWorkSize{1, 1, 1, 1};
|
|
|
|
std::shared_ptr<Tensor> mFilter;
|
|
|
|
cl::Kernel mKernel;
|
|
|
|
uint32_t mMaxWorkGroupSize;
|
|
|
|
bool mIsTurn = false;
|
|
|
|
OpenCLBackend *mOpenCLBackend;
|
- dynamic computation graph (beta)
- add supports (/express)
- add tests
- add benchmarks with it (/benchmark/exprModels)
- Python
- MNN engine and tools were submitted to pip
- available on Windows/macOS/Linux
- Engine/Converter
- add supports for each op benchmarking
- refactor optimizer by separating steps
- CPU
- add supports for Conv3D, Pool3D, ELU, ReverseSequence
- fix ArgMax, Permute, Scale, BinaryOp, Slice, SliceTf
- OpenCL
- add half transform in CPU
- add broadcast supports for binary
- optimize Conv2D, Reshape, Eltwise, Gemm, etc.
- OpenGL
- add sub, real div supports for binary
- add supports for unary
- optimize Conv2D, Reshape
- Vulkan
- add max supports for eltwise
- Metal
- fix metallib missing problem
- Train/Quantization
- use express to refactor training codes
2019-09-26 21:02:07 +08:00
|
|
|
bool mConv1x1Opt{false};
|
|
|
|
bool mUseLocalMem{false};
|
|
|
|
std::shared_ptr<cl::Buffer> mKernelBuffer;
|
|
|
|
std::shared_ptr<cl::Buffer> mBiasBuffer;
|
2023-02-28 10:41:24 +08:00
|
|
|
std::set<std::string> mBuildOptions;
|
2019-04-17 10:49:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace OpenCL
|
|
|
|
} // namespace MNN
|
|
|
|
#endif /* ConvExecution_hpp */
|