MNN/source/backend/cuda/execution/RasterExecution.hpp

49 lines
1.5 KiB
C++
Raw Normal View History

2020-11-05 16:41:56 +08:00
//
// RasterExecution.hpp
// MNN
//
2022-02-18 11:30:27 +08:00
// Created by MNN on b'2020/04/02'.
2020-11-05 16:41:56 +08:00
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef RasterExecution_hpp
#define RasterExecution_hpp
#include "backend/cuda/core/CUDABackend.hpp"
2022-02-18 11:30:27 +08:00
#include <map>
#include <set>
2020-11-05 16:41:56 +08:00
#include "core/TensorUtils.hpp"
2023-06-16 09:42:45 +08:00
#include "core/OpCommonUtils.hpp"
2020-11-05 16:41:56 +08:00
namespace MNN {
namespace CUDA {
class RasterExecution : public Execution {
public:
2022-02-18 11:30:27 +08:00
RasterExecution(Backend* bn) : Execution(bn) {
// Do nothing
}
virtual ~ RasterExecution() {
// Do nothing
}
2020-11-05 16:41:56 +08:00
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;
2022-02-18 11:30:27 +08:00
void executeFaster(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) const;
2020-11-05 16:41:56 +08:00
private:
2023-06-16 09:42:45 +08:00
std::map<Tensor*, Tensor*> mTempInput;
2022-02-18 11:30:27 +08:00
std::vector<std::pair<const Tensor*, Tensor::InsideDescribe::Region*>> mTempInputCopy;
std::vector<std::pair<const Tensor*, Tensor::InsideDescribe::Region>> mFastBlit;
std::shared_ptr<Tensor> mTempOutput;
Tensor* mOutputPtr;
2020-11-05 16:41:56 +08:00
bool mNeedZero = false;
2022-02-18 11:30:27 +08:00
bool mFast = false;
2023-06-16 09:42:45 +08:00
OpCommonUtils::TensorConvertParameter mSingleConvert;
2022-02-18 11:30:27 +08:00
int32_t mZeroPoint = 0;
2022-06-27 10:51:38 +08:00
// First: type, 0: not , 1: unit, 4:unitc4
// Second: count
std::pair<int, int> mFuseRaster;
void *mOffset;
2023-06-16 09:42:45 +08:00
std::shared_ptr<Tensor> mOffsetTensor;
std::shared_ptr<Tensor> mTempInputTensor;
2020-11-05 16:41:56 +08:00
};
2022-02-18 11:30:27 +08:00
}
}
2020-11-05 16:41:56 +08:00
#endif