// // LayerNormBufExecution.hpp // MNN // // Created by MNN on 2023/07/05. // Copyright © 2018, Alibaba Group Holding Limited // #ifndef MNN_OPENCL_BUFFER_CLOSED #ifndef LayerNormBufExecution_hpp #define LayerNormBufExecution_hpp #include "backend/opencl/execution/image/CommonExecution.hpp" namespace MNN { namespace OpenCL { struct LayernormResource { std::shared_ptr mGammaBuffer; std::shared_ptr mBetaBuffer; bool has_gamma_beta_ = false; uint32_t mMaxWorkGroupSize; int axis_size ; int group_ ; float epsilon_; bool RMSNorm; }; class LayerNormBufExecution : public CommonExecution { public: LayerNormBufExecution(const std::vector &inputs, const MNN::Op *op, Backend *backend); LayerNormBufExecution(std::shared_ptr resource, const Op* op, Backend* backend); virtual ~LayerNormBufExecution() = default; virtual ErrorCode onEncode(const std::vector &inputs, const std::vector &outputs) override; virtual bool onClone(Backend* bn, const Op* op, Execution** dst) override; private: int getLocalSize(int size, int maxGroupSize); std::vector mLWS{0, 0, 0, 0}; std::vector mGWS{0, 0, 0, 0}; OpenCLBackend *mOpenCLBackend; std::shared_ptr mResource; }; } // namespace OpenCL } // namespace MNN #endif /* LayerNormBufExecution_hpp */ #endif /* MNN_OPENCL_BUFFER_CLOSED */