// // MetalRaster.hpp // MNN // // Created by MNN on 2020/05/09. // Copyright © 2018, Alibaba Group Holding Limited // #ifndef MetalRaster_hpp #define MetalRaster_hpp #import "MetalExecution.hpp" #include #if MNN_METAL_ENABLED namespace MNN { class MetalRaster : public MetalExecution { public: MetalRaster(Backend *backend); virtual ~MetalRaster(); virtual ErrorCode onResize(const std::vector &inputs, const std::vector &outputs) override; virtual void onEncode(const std::vector &inputs, const std::vector &outputs, id encoder) override; static id getBlitPipeline(int bytes, Backend* backend, bool multiRegion); struct BlitInfo { std::pair blit; MTLSize local; MTLSize global; }; private: void _clear(); std::vector> mTempInputCopy; bool mNeedZero = false; bool mFastC4ToNCHW = false; bool mFastRawCopy = false; Tensor* mFastInput = nullptr; Tensor* mOutputPtr = nullptr; std::vector> mBlitPipeline; id mZeroCopy = nil; id mFastC4ToNCHWParam = nil; id mFastRawCopyParam = nil; id mFastC4ToNCHWPipeline = nil; id mFastRawCopyPipeline = nil; std::pair mFastC4ToNCHWThreads; std::pair mFastRawCopyThreads; id mZeroPipeline; }; } // namespace MNN #endif /* MNN_METAL_ENABLED */ #endif /* MetalRaster_hpp */