* Copyright (c) 2026 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 GE_FRAMEWORK_RUNTIME_DUMP_MODEL_DUMP_MANAGER_H_
#define GE_FRAMEWORK_RUNTIME_DUMP_MODEL_DUMP_MANAGER_H_
#include <cstdint>
#include <memory>
#include "framework/common/ge_types.h"
#include "framework/common/ge_visibility.h"
#include "framework/runtime/dump/model_dump_c_api.h"
#include "runtime/base.h"
namespace ge {
namespace dump {
class DataDumpImpl;
class ExceptionDumpImpl;
class OverflowDumpImpl;
using Om2Tensor = ::Om2Tensor;
using Om2TaskIoEntry = ::Om2TaskIoEntry;
using Om2TaskInfo = ::Om2TaskInfo;
struct ModelDumpInfo {
uint32_t model_id;
const char* model_name;
const char* root_graph_name;
uint32_t device_id;
void* rt_model_handle;
uint64_t step_id_addr;
uint64_t loop_cond_addr;
uint64_t iterations_per_loop_addr;
};
class VISIBILITY_EXPORT ModelDumpManager {
public:
static Status GlobalInit();
explicit ModelDumpManager(uint32_t model_id);
~ModelDumpManager();
ModelDumpManager(const ModelDumpManager&) = delete;
ModelDumpManager& operator=(const ModelDumpManager&) = delete;
Status SetModelDumpInfo(const ModelDumpInfo& model_info);
Status AddOm2TaskInfo(const Om2TaskInfo& task_info);
Status PreprocessOm2TaskInfo(const Om2TaskInfo& task_info);
Status IsDataDumpEnabled(const char* op_name, uint8_t* is_data_dump) const;
Status DispatchDumpInfo();
bool GetOpDescInfo(const OpDescInfoId& op_id, ge::OpDescInfo& op_info) const;
void Clear();
private:
uint32_t model_id_;
ModelDumpInfo model_info_{};
std::unique_ptr<DataDumpImpl> data_dump_impl_;
std::unique_ptr<ExceptionDumpImpl> exception_impl_;
std::unique_ptr<OverflowDumpImpl> overflow_impl_;
};
}
}
#endif