/** * Copyright 2020 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MINDSPORE_MINDSPORE_CCSRC_KERNEL_AICPU_AICPU_KERNEL_MOD_H_ #define MINDSPORE_MINDSPORE_CCSRC_KERNEL_AICPU_AICPU_KERNEL_MOD_H_ #include #include #include #include "kernel/ascend_kernel_mod.h" #include "kernel/aicpu/aicpu_util.h" namespace mindspore { namespace kernel { class AicpuOpKernelMod : public AscendKernelMod { public: AicpuOpKernelMod(); ~AicpuOpKernelMod() override; bool Launch(const std::vector &inputs, const std::vector &workspace, const std::vector &outputs, void *stream_ptr) override; std::vector GenTask(const std::vector &inputs, const std::vector &workspace, const std::vector &outputs, uint32_t stream_id) override; void SetInputList(const std::vector &inputList); void SetOutputList(const std::vector &outputList); void SetAnfNode(const AnfNodePtr &anf_node); void SetNodeDef(const std::string &nodeDef); void SetNodeName(const std::string &node_name); /** * @brief Build AICPU Engine kernel structure, and allocate device memory for offline task generate * @return SUCCESS * @return FAIL * */ void CreateCpuKernelInfo(const std::vector &inputs, const std::vector &outputs); void SetInputSizeList(const std::vector &size_list); void SetOutputSizeList(const std::vector &size_list); void SetWorkspaceSizeList(const std::vector &size_list); const std::vector &GetInputSizeList() const override; const std::vector &GetOutputSizeList() const override; const std::vector &GetWorkspaceSizeList() const override; private: std::string args_; std::string node_def_str_; std::string node_name_; std::string node_so_; std::vector inputList_; std::vector outputList_; AnfNodePtr anf_node_; std::vector input_size_list_; std::vector output_size_list_; std::vector workspace_size_list_; }; using AicpuOpKernelModPtr = std::shared_ptr; using AicputOpKernelModPtrList = std::vector; } // namespace kernel } // namespace mindspore #endif // MINDSPORE_MINDSPORE_CCSRC_KERNEL_AICPU_AICPU_KERNEL_MOD_H_