1 //
2 //  PoolBufExecution.hpp
3 //  MNN
4 //
5 //  Created by MNN on 2019/01/31.
6 //  Copyright © 2018, Alibaba Group Holding Limited
7 //
8 
9 #ifndef MNN_OPENCL_BUFFER_CLOSED
10 
11 #ifndef PoolBufExecution_hpp
12 #define PoolBufExecution_hpp
13 
14 #include <array>
15 #include <memory>
16 #include <vector>
17 #include "core/Execution.hpp"
18 #include "backend/opencl/core/OpenCLBackend.hpp"
19 #include "backend/opencl/core/OpenCLRunningUtils.hpp"
20 namespace MNN {
21 namespace OpenCL {
22 
23 class PoolBufExecution : public Execution {
24 public:
25     PoolBufExecution(const std::vector<Tensor *> &inputs, const MNN::Op *op, Backend *backend);
26     virtual ~PoolBufExecution() = default;
27 
28     virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
29     virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
30 
31 private:
32     const Pool *mPoolParams;
33     std::vector<uint32_t> mGlobalWorkSize{1, 1, 1};
34     std::vector<uint32_t> mLocalWorkSize{1, 1, 1, 1};
35     PoolType mPoolType;
36     PoolPadType mPadType;
37     std::vector<int> mStrides{1, 1};
38     std::vector<int> mKernels{1, 1};
39     std::vector<int> mPaddings{0, 0};
40     std::vector<int> mDilations{1, 1};
41     cl::Kernel mKernel;
42     uint32_t mMaxWorkGroupSize;
43     OpenCLBackend *mOpenCLBackend;
44 };
45 
46 } // namespace OpenCL
47 } // namespace MNN
48 #endif /* PoolBufExecution_hpp */
49 #endif /* MNN_OPENCL_BUFFER_CLOSED */
50