MNN/source/backend/opencl/execution/image/CommonExecution.hpp

51 lines
1.4 KiB
C++
Raw Permalink Normal View History

2019-04-17 10:49:11 +08:00
//
// CommonExecution.hpp
// MNN
//
// Created by MNN on 2019/02/28.
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef CommonExecution_hpp
#define CommonExecution_hpp
2019-12-27 22:16:57 +08:00
#include "core/Execution.hpp"
2024-04-19 11:58:21 +08:00
#include "core/Macro.h"
#include "core/TensorUtils.hpp"
2019-12-27 22:16:57 +08:00
#include "backend/opencl/core/OpenCLBackend.hpp"
2023-06-16 09:42:45 +08:00
#include "backend/opencl/core/OpenCLRunningUtils.hpp"
2019-04-17 10:49:11 +08:00
namespace MNN {
namespace OpenCL {
2024-04-19 11:58:21 +08:00
struct Unit {
std::shared_ptr<KernelWrap> kernel;
cl::NDRange globalWorkSize;
cl::NDRange localWorkSize;
};
class CommonExecution : public Execution {
2019-04-17 10:49:11 +08:00
public:
2023-05-18 19:11:50 +08:00
CommonExecution(Backend *backend, const MNN::Op *Op);
2024-04-19 11:58:21 +08:00
virtual ~CommonExecution(){
if(mRecording != NULL){
#ifdef MNN_USE_LIB_WRAPPER
clReleaseRecordingQCOM(mRecording);
#endif
}
}
virtual ErrorCode onEncode(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) {
return NO_ERROR;
}
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
2019-04-17 10:49:11 +08:00
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
protected:
std::vector<Unit> mUnits;
2020-11-05 16:41:56 +08:00
const MNN::Op *mOp;
2023-04-27 15:11:05 +08:00
OpType mOpType;
2024-04-19 11:58:21 +08:00
cl_recording_qcom mRecording{NULL};
2024-05-11 19:17:02 +08:00
std::vector<RecordUpdateInfo*> mOpRecordUpdateInfo;
2019-04-17 10:49:11 +08:00
};
} // namespace OpenCL
} // namespace MNN
#endif /* CommonExecution_hpp */