// // RopeBufExecution.hpp // MNN // // OpenCL buffer-path implementation of RoPE (Rotary Positional Embedding). // #ifdef MNN_SUPPORT_TRANSFORMER_FUSE #ifndef RopeBufExecution_hpp #define RopeBufExecution_hpp #include "backend/opencl/execution/image/CommonExecution.hpp" namespace MNN { namespace OpenCL { class RopeBufExecution : public CommonExecution { public: RopeBufExecution(const MNN::Op* op, Backend* backend); RopeBufExecution(const MNN::Op* op, Backend* backend, int ropeCutHeadDim, int numHead, int kvNumHead, int headDim, std::shared_ptr qGamma, float qEps, std::shared_ptr kGamma, float kEps); virtual ~RopeBufExecution() = 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: OpenCLBackend* mOpenCLBackend = nullptr; uint32_t mMaxWorkGroupSize = 0; std::vector mGlobalWorkSize = {1, 1, 1}; std::vector mLocalWorkSize = {1, 1, 1}; int mRopeCutHeadDim = 0; int mNumHead = 0; int mKvNumHead = 0; int mHeadDim = 0; std::shared_ptr mQGamma; std::shared_ptr mKGamma; float mQEps = 0.0f; float mKEps = 0.0f; }; } // namespace OpenCL } // namespace MNN #endif /* RopeBufExecution_hpp */ #endif /* MNN_SUPPORT_TRANSFORMER_FUSE */