* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#ifndef INC_COMMON_OPSKERNEL_OPS_KERNEL_BUILDER_H_
#define INC_COMMON_OPSKERNEL_OPS_KERNEL_BUILDER_H_
#include "external/ge_common/ge_api_error_codes.h"
#include "aicpu_engine_struct.h"
#include "common/opskernel/ops_kernel_info_types.h"
#include "graph/node.h"
#include "external/ge_common/ge_api_types.h"
#include "proto/task.pb.h"
namespace ge {
class OpsKernelBuilder {
public:
enum class Mode : uint32_t {
kNormal,
kFfts,
kFftsPlus
};
OpsKernelBuilder() = default;
virtual ~OpsKernelBuilder() = default;
OpsKernelBuilder(const OpsKernelBuilder &) = delete;
OpsKernelBuilder(OpsKernelBuilder &&) = delete;
OpsKernelBuilder &operator=(const OpsKernelBuilder &)& = delete;
OpsKernelBuilder &operator=(OpsKernelBuilder &&)& = delete;
virtual Status Initialize(const std::map<std::string, std::string> &options) = 0;
virtual Status Finalize() = 0;
virtual Status CalcOpRunningParam(Node &node) = 0;
virtual Status GenerateTask(const Node &node, RunContext &context,
std::vector<domi::TaskDef> &tasks) = 0;
virtual Status GenerateTask(const Node &node, RunContext &context, std::vector<domi::TaskDef> &tasks,
OpsKernelBuilder::Mode) {
(void)node;
(void)context;
(void)tasks;
return SUCCESS;
}
virtual Status UpdateTask(const Node &node, std::vector<domi::TaskDef> &tasks) {
(void)node;
(void)tasks;
return SUCCESS;
}
virtual Status GenSingleOpRunTask(const NodePtr &node, STR_FWK_OP_KERNEL &task, std::string &task_info) {
(void)node;
(void)task;
(void)task_info;
return FAILED;
}
virtual Status GenMemCopyTask(const uint64_t count, STR_FWK_OP_KERNEL &task, std::string &task_info) {
(void)count;
(void)task;
(void)task_info;
return FAILED;
}
};
}
#endif