已合并
[v2.9.0] update dvm submodule and profiling headers #35625
[v2.9.0] update dvm submodule and profiling headers #35625
已合并
SorryNaCN创建于 5月14日
9 个文件变更+221-1460
@@ -1,254 +0,0 @@
1-/**
2- * @file prof_api.h
3- *
4- * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
5- *
6- * This program is distributed in the hope that it will be useful,
7- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9- *
10- */
11- 
12-#ifndef PROF_API_H
13-#define PROF_API_H
14- 
15-#include <stddef.h>
16-#include <stdint.h>
17-#include <stdbool.h>
18-#include "prof_common.h"
19- 
20-#ifdef __cplusplus
21-extern "C" {
22-#endif // __cplusplus
23- 
24-#if (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER))
25-#define MSVP_PROF_API __declspec(dllexport)
26-#else
27-#define MSVP_PROF_API __attribute__((visibility("default")))
28-#endif
29- 
30-/*
31- * @ingroup libprofapi
32- * @name profRegReporterCallback
33- * @brief register report callback interface for atlas
34- * @param [in] reporter: reporter callback handle
35- * @return 0:SUCCESS, !0:FAILED
36- */
37-MSVP_PROF_API int32_t profRegReporterCallback(MsprofReportHandle reporter);
38- 
39-/*
40- * @ingroup libprofapi
41- * @name profRegCtrlCallback
42- * @brief register control callback, interface for atlas
43- * @param [in] handle: control callback handle
44- * @return 0:SUCCESS, !0:FAILED
45- */
46-MSVP_PROF_API int32_t profRegCtrlCallback(MsprofCtrlHandle handle);
47- 
48-/*
49- * @ingroup libprofapi
50- * @name profRegDeviceStateCallback
51- * @brief register device state notify callback, interface for atlas
52- * @param [in] handle: handle of ProfNotifySetDevice
53- * @return 0:SUCCESS, !0:FAILED
54- */
55-MSVP_PROF_API int32_t profRegDeviceStateCallback(MsprofSetDeviceHandle handle);
56- 
57-/*
58- * @ingroup libprofapi
59- * @name profGetDeviceIdByGeModelIdx
60- * @brief get device id by model id, interface for atlas
61- * @param [in] modelIdx: ge model id
62- * @param [out] deviceId: device id
63- * @return 0:SUCCESS, !0:FAILED
64- */
65-MSVP_PROF_API int32_t profGetDeviceIdByGeModelIdx(const uint32_t modelIdx, uint32_t *deviceId);
66- 
67-/*
68- * @ingroup libprofapi
69- * @name profSetProfCommand
70- * @brief register set profiling command, interface for atlas
71- * @param [in] command: 0 isn't aging, !0 is aging
72- * @param [in] len: api of timestamp data
73- * @return 0:SUCCESS, !0:FAILED
74- */
75-MSVP_PROF_API int32_t profSetProfCommand(VOID_PTR command, uint32_t len);
76- 
77-/*
78- * @ingroup libprofapi
79- * @name profSetStepInfo
80- * @brief set step info for torch, interface for atlas
81- * @param [in] indexId: id of iteration index
82- * @param [in] tagId: id of tag
83- * @param [in] stream: api of timestamp data
84- * @return 0:SUCCESS, !0:FAILED
85- */
86-MSVP_PROF_API int32_t profSetStepInfo(const uint64_t indexId, const uint16_t tagId, void* const stream);
87- 
88-/*
89- * @ingroup libprofapi
90- * @name MsprofRegisterProfileCallback
91- * @brief register profile callback by callback type, interface for atlas
92- * @param [in] callbackType: type of callback(reporter/ctrl/device state/command)
93- * @param [in] callback: callback of profile
94- * @param [in] len: callback length
95- * @return 0:SUCCESS, !0:FAILED
96- */
97-MSVP_PROF_API int32_t MsprofRegisterProfileCallback(int32_t callbackType, VOID_PTR callback, uint32_t len);
98- 
99-/**
100- * @ingroup libprofapi
101- * @name MsprofInit
102- * @brief Profiling module init
103- * @param [in] dataType: profiling type: ACL Env/ACL Json/GE Option
104- * @param [in] data: profiling switch data
105- * @param [in] dataLen: Length of data
106- * @return 0:SUCCESS, >0:FAILED
107- */
108-MSVP_PROF_API int32_t MsprofInit(uint32_t dataType, VOID_PTR data, uint32_t dataLen);
109- 
110-/**
111- * @ingroup libprofapi
112- * @name MsprofSetConfig
113- * @brief Set profiling config
114- * @return 0:SUCCESS, !0:FAILED
115- */
116-MSVP_PROF_API int32_t MsprofSetConfig(uint32_t configType, const char *config, size_t configLength);
117- 
118-/**
119- * @ingroup libprofapi
120- * @name MsprofRegisterCallback
121- * @brief register profiling switch callback for module
122- * @param [in] agingFlag: 0 isn't aging, !0 is aging
123- * @param [in] api: api of timestamp data
124- * @return 0:SUCCESS, !0:FAILED
125- */
126-MSVP_PROF_API int32_t MsprofRegisterCallback(uint32_t moduleId, ProfCommandHandle handle);
127- 
128-/**
129- * @ingroup libprofapi
130- * @name MsprofReportData
131- * @brief report profiling data of module
132- * @param [in] moduleId: module id
133- * @param [in] type: report type(init/uninit/max length/hash)
134- * @param [in] data: profiling data
135- * @param [in] len: length of profiling data
136- * @return 0:SUCCESS, !0:FAILED
137- */
138-MSVP_PROF_API int32_t MsprofReportData(uint32_t moduleId, uint32_t type, VOID_PTR data, uint32_t len);
139- 
140-/*
141- * @ingroup libprofapi
142- * @name MsprofReportApi
143- * @brief report api timestamp
144- * @param [in] agingFlag: 0 isn't aging, !0 is aging
145- * @param [in] api: api of timestamp data
146- * @return 0:SUCCESS, !0:FAILED
147- */
148-MSVP_PROF_API int32_t MsprofReportApi(uint32_t agingFlag, const struct MsprofApi *api);
149- 
150-/*
151- * @ingroup libprofapi
152- * @name MsprofReportEvent
153- * @brief report event timestamp
154- * @param [in] agingFlag: 0 isn't aging, !0 is aging
155- * @param [in] event: event of timestamp data
156- * @return 0:SUCCESS, !0:FAILED
157- */
158-MSVP_PROF_API int32_t MsprofReportEvent(uint32_t agingFlag, const struct MsprofEvent *event);
159- 
160-/*
161- * @ingroup libprofapi
162- * @name MsprofReportCompactInfo
163- * @brief report profiling compact infomation
164- * @param [in] agingFlag: 0 isn't aging, !0 is aging
165- * @param [in] data: profiling data of compact infomation
166- * @param [in] length: length of profiling data
167- * @return 0:SUCCESS, !0:FAILED
168- */
169-MSVP_PROF_API int32_t MsprofReportCompactInfo(uint32_t agingFlag, const VOID_PTR data, uint32_t length);
170- 
171-/*
172- * @ingroup libprofapi
173- * @name MsprofReportAdditionalInfo
174- * @brief report profiling additional infomation
175- * @param [in] agingFlag: 0 isn't aging, !0 is aging
176- * @param [in] data: profiling data of additional infomation
177- * @param [in] length: length of profiling data
178- * @return 0:SUCCESS, !0:FAILED
179- */
180-MSVP_PROF_API int32_t MsprofReportAdditionalInfo(uint32_t agingFlag, const VOID_PTR data, uint32_t length);
181- 
182-/*
183- * @ingroup libprofapi
184- * @name MsprofRegTypeInfo
185- * @brief reg mapping info of type id and type name
186- * @param [in] level: level is the report struct's level
187- * @param [in] typeId: type id is the report struct's type
188- * @param [in] typeName: label of type id for presenting user
189- * @return 0:SUCCESS, !0:FAILED
190- */
191-MSVP_PROF_API int32_t MsprofRegTypeInfo(uint16_t level, uint32_t typeId, const char *typeName);
192- 
193-/*
194- * @ingroup libprofapi
195- * @name MsprofGetHashId
196- * @brief return hash id of hash info
197- * @param [in] hashInfo: infomation to be hashed
198- * @param [in] length: the length of infomation to be hashed
199- * @return hash id
200- */
201-MSVP_PROF_API uint64_t MsprofGetHashId(const char *hashInfo, size_t length);
202- 
203-/**
204- * @ingroup libprofapi
205- * @name MsprofSetDeviceIdByGeModelIdx
206- * @brief insert device id by model id
207- * @param [in] geModelIdx: ge model id
208- * @param [in] deviceId: device id
209- * @return 0:SUCCESS, !0:FAILED
210- */
211-MSVP_PROF_API int32_t MsprofSetDeviceIdByGeModelIdx(const uint32_t geModelIdx, const uint32_t deviceId);
212- 
213-/**
214- * @ingroup libprofapi
215- * @name MsprofUnsetDeviceIdByGeModelIdx
216- * @brief delete device id by model id
217- * @param [in] geModelIdx: ge model id
218- * @param [in] deviceId: device id
219- * @return 0:SUCCESS, !0:FAILED
220- */
221-MSVP_PROF_API int32_t MsprofUnsetDeviceIdByGeModelIdx(const uint32_t geModelIdx, const uint32_t deviceId);
222- 
223-/**
224- * @ingroup libprofapi
225- * @name register report interface for atlas
226- * @brief report api timestamp
227- * @param [in] chipId: multi die's chip
228- * @param [in] deviceId: device id
229- * @param [in] isOpen: device is open
230- * @return 0:SUCCESS, !0:FAILED
231- */
232-MSVP_PROF_API int32_t MsprofNotifySetDevice(uint32_t chipId, uint32_t deviceId, bool isOpen);
233- 
234-/**
235- * @ingroup libprofapi
236- * @name MsprofFinalize
237- * @brief profiling finalize
238- * @return 0:SUCCESS, !0:FAILED
239- */
240-MSVP_PROF_API int32_t MsprofFinalize();
241- 
242-/*
243- * @ingroup libprofapi
244- * @name MsprofSysCycleTime
245- * @brief get systime cycle time of CPU
246- * @return system cycle time of CPU
247- */
248-MSVP_PROF_API uint64_t MsprofSysCycleTime();
249- 
250-#ifdef __cplusplus
251-}
252-#endif
253- 
254-#endif
@@ -1,1101 +0,0 @@
1-/**
2- * @file prof_common.h
3- *
4- * Copyright (c) Huawei Technologies Co., Ltd. 2019-2024. All rights reserved.
5- *
6- * This program is distributed in the hope that it will be useful,
7- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9- *
10- */
11-#ifndef MSPROFILER_PROF_COMMON_H
12-#define MSPROFILER_PROF_COMMON_H
13- 
14-#include <stdint.h>
15-#include <stddef.h>
16- 
17-#ifdef __cplusplus
18-extern "C" {
19-#endif // __cplusplus
20- 
21-#define MSPROF_DATA_HEAD_MAGIC_NUM 0x5A5AU
22-#define MSPROF_REPORT_DATA_MAGIC_NUM 0x5A5AU
23-#define MSPROF_TASK_TIME_L0 0x00000800ULL // mean PROF_TASK_TIME
24-#define MSPROF_EVENT_FLAG 0xFFFFFFFFFFFFFFFFULL
25-typedef void* VOID_PTR;
26-typedef const void* ConstVoidPtr;
27-typedef int32_t (*MsprofReportHandle)(uint32_t moduleId, uint32_t type, VOID_PTR data, uint32_t len);
28-typedef int32_t (*MsprofCtrlHandle)(uint32_t type, VOID_PTR data, uint32_t len);
29-typedef int32_t (*MsprofSetDeviceHandle)(VOID_PTR data, uint32_t len);
30-typedef int32_t (*MsprofCtrlCallback)(uint32_t type, void *data, uint32_t len);
31-typedef int32_t (*MsprofReporterCallback)(uint32_t moduleId, uint32_t type, void *data, uint32_t len);
32- 
33-/**
34- * @name ProfCommandHandle
35- * @brief callback to start/stop profiling
36- * @param type [IN] enum call back type
37- * @param data [IN] callback data
38- * @param len [IN] callback data size
39- * @return enum MsprofErrorCode
40- */
41-typedef int32_t (*ProfCommandHandle)(uint32_t type, VOID_PTR data, uint32_t len);
42- 
43-/* Msprof report level */
44-#define MSPROF_REPORT_PYTORCH_LEVEL 30000U
45-#define MSPROF_REPORT_PTA_LEVEL 25000U
46-#define MSPROF_REPORT_ACL_LEVEL 20000U
47-#define MSPROF_REPORT_MODEL_LEVEL 15000U
48-#define MSPROF_REPORT_NODE_LEVEL 10000U
49-#define MSPROF_REPORT_AICPU_LEVEL 6000U
50-#define MSPROF_REPORT_HCCL_NODE_LEVEL 5500U
51-#define MSPROF_REPORT_RUNTIME_LEVEL 5000U
52-#define MSPROF_REPORT_PROF_LEVEL 4500U
53-#define MSPROF_REPORT_DPU_LEVEL 4000U
54- 
55-/* Msprof report type of acl(20000) level(acl), offset: 0x000000 */
56-#define MSPROF_REPORT_ACL_OP_BASE_TYPE 0x010000U
57-#define MSPROF_REPORT_ACL_MODEL_BASE_TYPE 0x020000U
58-#define MSPROF_REPORT_ACL_RUNTIME_BASE_TYPE 0x030000U
59-#define MSPROF_REPORT_ACL_OTHERS_BASE_TYPE 0x040000U
60- 
61- 
62-/* Msprof report type of acl(20000) level(host api), offset: 0x050000 */
63-#define MSPROF_REPORT_ACL_NN_BASE_TYPE 0x050000U
64-#define MSPROF_REPORT_ACL_ASCENDC_TYPE 0x060000U
65-#define MSPROF_REPORT_ACL_HOST_HCCL_BASE_TYPE 0x070000U
66-#define MSPROF_REPORT_ACL_DVPP_BASE_TYPE 0x090000U
67-#define MSPROF_REPORT_ACL_GRAPH_BASE_TYPE 0x0A0000U
68- 
69-/* Msprof report type of model(15000) level, offset: 0x000000 */
70-#define MSPROF_REPORT_MODEL_GRAPH_ID_MAP_TYPE 0U /* type info: graph_id_map */
71-#define MSPROF_REPORT_MODEL_EXECUTE_TYPE 1U /* type info: execute */
72-#define MSPROF_REPORT_MODEL_LOAD_TYPE 2U /* type info: load */
73-#define MSPROF_REPORT_MODEL_INPUT_COPY_TYPE 3U /* type info: IntputCopy */
74-#define MSPROF_REPORT_MODEL_OUTPUT_COPY_TYPE 4U /* type info: OutputCopy */
75-#define MSPROF_REPORT_MODEL_LOGIC_STREAM_TYPE 7U /* type info: logic_stream_info */
76-#define MSPROF_REPORT_MODEL_EXEOM_TYPE 8U /* type info: exeom */
77-#define MSPROF_REPORT_MODEL_UDF_BASE_TYPE 0x010000U /* type info: udf_info */
78-#define MSPROF_REPORT_MODEL_AICPU_BASE_TYPE 0x020000U /* type info: aicpu */
79- 
80-/* Msprof report type of node(10000) level, offset: 0x000000 */
81-#define MSPROF_REPORT_NODE_BASIC_INFO_TYPE 0U /* type info: node_basic_info */
82-#define MSPROF_REPORT_NODE_TENSOR_INFO_TYPE 1U /* type info: tensor_info */
83-#define MSPROF_REPORT_NODE_FUSION_OP_INFO_TYPE 2U /* type info: funsion_op_info */
84-#define MSPROF_REPORT_NODE_CONTEXT_ID_INFO_TYPE 4U /* type info: context_id_info */
85-#define MSPROF_REPORT_NODE_LAUNCH_TYPE 5U /* type info: launch */
86-#define MSPROF_REPORT_NODE_TASK_MEMORY_TYPE 6U /* type info: task_memory_info */
87-#define MSPROF_REPORT_NODE_HOST_OP_EXEC_TYPE 8U /* type info: op exec */
88-#define MSPROF_REPORT_NODE_ATTR_INFO_TYPE 9U /* type info: node_attr_info */
89-#define MSPROF_REPORT_NODE_HCCL_OP_INFO_TYPE 10U /* type info: hccl_op_info */
90-#define MSPROF_REPORT_NODE_STATIC_OP_MEM_TYPE 11U /* type info: static_op_mem */
91-#define MSPROF_REPORT_NODE_MC2_COMMINFO_TYPE 12U /* type info: mc2_comm_info */
92- 
93-/* Msprof report type of node(10000) level(ge api), offset: 0x010000 */
94-#define MSPROF_REPORT_NODE_GE_API_BASE_TYPE 0x010000U /* type info: ge api */
95-#define MSPROF_REPORT_NODE_HCCL_BASE_TYPE 0x020000U /* type info: hccl api */
96-#define MSPROF_REPORT_NODE_DVPP_API_BASE_TYPE 0x030000U /* type info: dvpp api */
97-/* Msprof report type of aicpu(6000), offset: 0x000000 */
98-#define MSPROF_REPORT_AICPU_NODE_TYPE 0U /* type info: DATA_PREPROCESS.AICPU */
99-#define MSPROF_REPORT_AICPU_DP_TYPE 1U /* type info: DATA_PREPROCESS.DP */
100-#define MSPROF_REPORT_AICPU_MODEL_TYPE 2U /* type info: DATA_PREPROCESS.AICPU_MODEL */
101-#define MSPROF_REPORT_AICPU_MI_TYPE 3U /* type info: DATA_PREPROCESS.AICPUMI */
102-#define MSPROF_REPORT_AICPU_MC2_EXECUTE_COMM_TIME 4U /* 通信时刻信息 */
103-#define MSPROF_REPORT_AICPU_MC2_EXECUTE_COMP_TIME 5U /* 计算时刻信息 */
104-#define MSPROF_REPORT_AICPU_MC2_HCCL_INFO 6U /* task信息 */
105- 
106-/* Msprof report type of hccl(5500) level(op api), offset: 0x010000 */
107-#define MSPROF_REPORT_HCCL_NODE_BASE_TYPE 0x010000U
108-#define MSPROF_REPORT_HCCL_MASTER_TYPE 0x010001U
109-#define MSPROF_REPORT_HCCL_SLAVE_TYPE 0x010002U
110- 
111-/* Msprof report type of hccl(4000U) level(dpu), offset: 0x000000 */
112-#define MSPROF_REPORT_DPU_TRACK_TYPE 0U /* type info: dpu_track */
113- 
114-/* use with AdprofCheckFeatureIsOn */
115-#define ADPROF_TASK_TIME_L0 0x00000008ULL
116-#define ADPROF_TASK_TIME_L1 0x00000010ULL
117-#define ADPROF_TASK_TIME_L2 0x00000020ULL
118- 
119-/* Msprof report type of profiling(4500) */
120-#define MSPROF_REPORT_DIAGNOSTIC_INFO_TYPE 0x010000U
121- 
122-enum ProfileCallbackType {
123- PROFILE_CTRL_CALLBACK = 0,
124- PROFILE_DEVICE_STATE_CALLBACK,
125- PROFILE_REPORT_API_CALLBACK,
126- PROFILE_REPORT_EVENT_CALLBACK,
127- PROFILE_REPORT_COMPACT_CALLBACK,
128- PROFILE_REPORT_ADDITIONAL_CALLBACK,
129- PROFILE_REPORT_REG_TYPE_INFO_CALLBACK,
130- PROFILE_REPORT_GET_HASH_ID_CALLBACK,
131- PROFILE_HOST_FREQ_IS_ENABLE_CALLBACK,
132- PROFILE_REPORT_API_C_CALLBACK,
133- PROFILE_REPORT_EVENT_C_CALLBACK,
134- PROFILE_REPORT_REG_TYPE_INFO_C_CALLBACK,
135- PROFILE_REPORT_GET_HASH_ID_C_CALLBACK,
136- PROFILE_HOST_FREQ_IS_ENABLE_C_CALLBACK,
137-};
138- 
139-enum MsprofDataTag {
140- MSPROF_ACL_DATA_TAG = 0, // acl data tag, range: 0~19
141- MSPROF_GE_DATA_TAG_MODEL_LOAD = 20, // ge data tag, range: 20~39
142- MSPROF_GE_DATA_TAG_FUSION = 21,
143- MSPROF_GE_DATA_TAG_INFER = 22,
144- MSPROF_GE_DATA_TAG_TASK = 23,
145- MSPROF_GE_DATA_TAG_TENSOR = 24,
146- MSPROF_GE_DATA_TAG_STEP = 25,
147- MSPROF_GE_DATA_TAG_ID_MAP = 26,
148- MSPROF_GE_DATA_TAG_HOST_SCH = 27,
149- MSPROF_RUNTIME_DATA_TAG_API = 40, // runtime data tag, range: 40~59
150- MSPROF_RUNTIME_DATA_TAG_TRACK = 41,
151- MSPROF_AICPU_DATA_TAG = 60, // aicpu data tag, range: 60~79
152- MSPROF_AICPU_MODEL_TAG = 61,
153- MSPROF_HCCL_DATA_TAG = 80, // hccl data tag, range: 80~99
154- MSPROF_DP_DATA_TAG = 100, // dp data tag, range: 100~119
155- MSPROF_MSPROFTX_DATA_TAG = 120, // hccl data tag, range: 120~139
156- MSPROF_DATA_TAG_MAX = 65536, // data tag value type is uint16_t
157-};
158- 
159-enum MsprofMindsporeNodeTag {
160- GET_NEXT_DEQUEUE_WAIT = 1,
161-};
162- 
163-/**
164- * @brief struct of mixed data
165- */
166-#define MSPROF_MIX_DATA_RESERVE_BYTES 7
167-#define MSPROF_MIX_DATA_STRING_LEN 120
168-enum MsprofMixDataType {
169- MSPROF_MIX_DATA_HASH_ID = 0,
170- MSPROF_MIX_DATA_STRING,
171-};
172-struct MsprofMixData {
173- uint8_t type; // MsprofMixDataType
174- uint8_t rsv[MSPROF_MIX_DATA_RESERVE_BYTES];
175- union {
176- uint64_t hashId;
177- char dataStr[MSPROF_MIX_DATA_STRING_LEN];
178- } data;
179-};
180- 
181-#define PATH_LEN_MAX 1023
182-#define PARAM_LEN_MAX 4095
183-struct MsprofCommandHandleParams {
184- uint32_t pathLen;
185- uint32_t storageLimit; // MB
186- uint32_t profDataLen;
187- char path[PATH_LEN_MAX + 1];
188- char profData[PARAM_LEN_MAX + 1];
189-};
190- 
191-/**
192- * @brief profiling command info
193- */
194-#define MSPROF_MAX_DEV_NUM 64
195-struct MsprofCommandHandle {
196- uint64_t profSwitch;
197- uint64_t profSwitchHi;
198- uint32_t devNums;
199- uint32_t devIdList[MSPROF_MAX_DEV_NUM];
200- uint32_t modelId;
201- uint32_t type;
202- uint32_t cacheFlag;
203- struct MsprofCommandHandleParams params;
204-};
205- 
206-/**
207- * @brief struct of data reported by acl
208- */
209-#define MSPROF_ACL_DATA_RESERVE_BYTES 32
210-#define MSPROF_ACL_API_NAME_LEN 64
211-enum MsprofAclApiType {
212- MSPROF_ACL_API_TYPE_OP = 1,
213- MSPROF_ACL_API_TYPE_MODEL,
214- MSPROF_ACL_API_TYPE_RUNTIME,
215- MSPROF_ACL_API_TYPE_OTHERS,
216-};
217-struct MsprofAclProfData {
218-#ifdef __cplusplus
219- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
220- uint16_t dataTag = MSPROF_ACL_DATA_TAG;
221-#else
222- uint16_t magicNumber;
223- uint16_t dataTag;
224-#endif
225- uint32_t apiType; // enum MsprofAclApiType
226- uint64_t beginTime;
227- uint64_t endTime;
228- uint32_t processId;
229- uint32_t threadId;
230- char apiName[MSPROF_ACL_API_NAME_LEN];
231- uint8_t reserve[MSPROF_ACL_DATA_RESERVE_BYTES];
232-};
233- 
234-/**
235- * @brief struct of data reported by GE
236- */
237-#define MSPROF_GE_MODELLOAD_DATA_RESERVE_BYTES 104
238-struct MsprofGeProfModelLoadData {
239-#ifdef __cplusplus
240- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
241- uint16_t dataTag = MSPROF_GE_DATA_TAG_MODEL_LOAD;
242-#else
243- uint16_t magicNumber;
244- uint16_t dataTag;
245-#endif
246- uint32_t modelId;
247- struct MsprofMixData modelName;
248- uint64_t startTime;
249- uint64_t endTime;
250- uint8_t reserve[MSPROF_GE_MODELLOAD_DATA_RESERVE_BYTES];
251-};
252- 
253-#define MSPROF_GE_FUSION_DATA_RESERVE_BYTES 8
254-#define MSPROF_GE_FUSION_OP_NUM 8
255-struct MsprofGeProfFusionData {
256-#ifdef __cplusplus
257- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
258- uint16_t dataTag = MSPROF_GE_DATA_TAG_FUSION;
259-#else
260- uint16_t magicNumber;
261- uint16_t dataTag;
262-#endif
263- uint32_t modelId;
264- struct MsprofMixData fusionName;
265- uint64_t inputMemSize;
266- uint64_t outputMemSize;
267- uint64_t weightMemSize;
268- uint64_t workspaceMemSize;
269- uint64_t totalMemSize;
270- uint64_t fusionOpNum;
271- uint64_t fusionOp[MSPROF_GE_FUSION_OP_NUM];
272- uint8_t reserve[MSPROF_GE_FUSION_DATA_RESERVE_BYTES];
273-};
274- 
275-#define MSPROF_GE_INFER_DATA_RESERVE_BYTES 64
276-struct MsprofGeProfInferData {
277-#ifdef __cplusplus
278- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
279- uint16_t dataTag = MSPROF_GE_DATA_TAG_INFER;
280-#else
281- uint16_t magicNumber;
282- uint16_t dataTag;
283-#endif
284- uint32_t modelId;
285- struct MsprofMixData modelName;
286- uint32_t requestId;
287- uint32_t threadId;
288- uint64_t inputDataStartTime;
289- uint64_t inputDataEndTime;
290- uint64_t inferStartTime;
291- uint64_t inferEndTime;
292- uint64_t outputDataStartTime;
293- uint64_t outputDataEndTime;
294- uint8_t reserve[MSPROF_GE_INFER_DATA_RESERVE_BYTES];
295-};
296- 
297-#define MSPROF_GE_TASK_DATA_RESERVE_BYTES 12
298-#define MSPROF_GE_OP_TYPE_LEN 56
299-enum MsprofGeTaskType {
300- MSPROF_GE_TASK_TYPE_AI_CORE = 0,
301- MSPROF_GE_TASK_TYPE_AI_CPU,
302- MSPROF_GE_TASK_TYPE_AIV,
303- MSPROF_GE_TASK_TYPE_WRITE_BACK,
304- MSPROF_GE_TASK_TYPE_MIX_AIC,
305- MSPROF_GE_TASK_TYPE_MIX_AIV,
306- MSPROF_GE_TASK_TYPE_FFTS_PLUS,
307- MSPROF_GE_TASK_TYPE_DSA,
308- MSPROF_GE_TASK_TYPE_DVPP,
309- MSPROF_GE_TASK_TYPE_HCCL,
310- MSPROF_GE_TASK_TYPE_FUSION,
311- MSPROF_GE_TASK_TYPE_INVALID
312-};
313- 
314-enum MsprofGeShapeType {
315- MSPROF_GE_SHAPE_TYPE_STATIC = 0,
316- MSPROF_GE_SHAPE_TYPE_DYNAMIC,
317-};
318-struct MsprofGeOpType {
319- uint8_t type; // MsprofMixDataType
320- uint8_t rsv[MSPROF_MIX_DATA_RESERVE_BYTES];
321- union {
322- uint64_t hashId;
323- char dataStr[MSPROF_GE_OP_TYPE_LEN];
324- } data;
325-};
326-struct MsprofGeProfTaskData {
327-#ifdef __cplusplus
328- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
329- uint16_t dataTag = MSPROF_GE_DATA_TAG_TASK;
330-#else
331- uint16_t magicNumber;
332- uint16_t dataTag;
333-#endif
334- uint32_t taskType; // MsprofGeTaskType
335- struct MsprofMixData opName;
336- struct MsprofGeOpType opType;
337- uint64_t curIterNum;
338- uint64_t timeStamp;
339- uint32_t shapeType; // MsprofGeShapeType
340- uint32_t blockDims;
341- uint32_t modelId;
342- uint32_t streamId;
343- uint32_t taskId;
344- uint32_t threadId;
345- uint32_t contextId;
346- uint8_t reserve[MSPROF_GE_TASK_DATA_RESERVE_BYTES];
347-};
348- 
349-#define MSPROF_GE_TENSOR_DATA_RESERVE_BYTES 8
350-#define MSPROF_GE_TENSOR_DATA_SHAPE_LEN 8
351-#define MSPROF_GE_TENSOR_DATA_NUM 5
352-enum MsprofGeTensorType {
353- MSPROF_GE_TENSOR_TYPE_INPUT = 0,
354- MSPROF_GE_TENSOR_TYPE_OUTPUT,
355-};
356-struct MsprofGeTensorData {
357- uint32_t tensorType; // MsprofGeTensorType
358- uint32_t format;
359- uint32_t dataType;
360- uint32_t shape[MSPROF_GE_TENSOR_DATA_SHAPE_LEN];
361-};
362- 
363-struct MsprofGeProfTensorData {
364-#ifdef __cplusplus
365- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
366- uint16_t dataTag = MSPROF_GE_DATA_TAG_TENSOR;
367-#else
368- uint16_t magicNumber;
369- uint16_t dataTag;
370-#endif
371- uint32_t modelId;
372- uint64_t curIterNum;
373- uint32_t streamId;
374- uint32_t taskId;
375- uint32_t tensorNum;
376- struct MsprofGeTensorData tensorData[MSPROF_GE_TENSOR_DATA_NUM];
377- uint8_t reserve[MSPROF_GE_TENSOR_DATA_RESERVE_BYTES];
378-};
379- 
380-#define MSPROF_GE_STEP_DATA_RESERVE_BYTES 27
381-enum MsprofGeStepTag {
382- MSPROF_GE_STEP_TAG_BEGIN = 0,
383- MSPROF_GE_STEP_TAG_END,
384-};
385-struct MsprofGeProfStepData {
386-#ifdef __cplusplus
387- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
388- uint16_t dataTag = MSPROF_GE_DATA_TAG_STEP;
389-#else
390- uint16_t magicNumber;
391- uint16_t dataTag;
392-#endif
393- uint32_t modelId;
394- uint32_t streamId;
395- uint32_t taskId;
396- uint64_t timeStamp;
397- uint64_t curIterNum;
398- uint32_t threadId;
399- uint8_t tag; // MsprofGeStepTag
400- uint8_t reserve[MSPROF_GE_STEP_DATA_RESERVE_BYTES];
401-};
402- 
403-#define MSPROF_GE_ID_MAP_DATA_RESERVE_BYTES 6
404-struct MsprofGeProfIdMapData {
405-#ifdef __cplusplus
406- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
407- uint16_t dataTag = MSPROF_GE_DATA_TAG_ID_MAP;
408-#else
409- uint16_t magicNumber;
410- uint16_t dataTag;
411-#endif
412- uint32_t graphId;
413- uint32_t modelId;
414- uint32_t sessionId;
415- uint64_t timeStamp;
416- uint16_t mode;
417- uint8_t reserve[MSPROF_GE_ID_MAP_DATA_RESERVE_BYTES];
418-};
419- 
420-#define MSPROF_GE_HOST_SCH_DATA_RESERVE_BYTES 24
421-struct MsprofGeProfHostSchData {
422-#ifdef __cplusplus
423- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
424- uint16_t dataTag = MSPROF_GE_DATA_TAG_HOST_SCH;
425-#else
426- uint16_t magicNumber;
427- uint16_t dataTag;
428-#endif
429- uint32_t threadId; // record in start event
430- uint64_t element;
431- uint64_t event;
432- uint64_t startTime; // record in start event
433- uint64_t endTime; // record in end event
434- uint8_t reserve[MSPROF_GE_HOST_SCH_DATA_RESERVE_BYTES];
435-};
436- 
437-/**
438- * @brief struct of data reported by RunTime
439- */
440-#define MSPROF_AICPU_DATA_RESERVE_BYTES 9
441-struct MsprofAicpuProfData {
442-#ifdef __cplusplus
443- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
444- uint16_t dataTag = MSPROF_AICPU_DATA_TAG;
445-#else
446- uint16_t magicNumber;
447- uint16_t dataTag;
448-#endif
449- uint16_t streamId;
450- uint16_t taskId;
451- uint64_t runStartTime;
452- uint64_t runStartTick;
453- uint64_t computeStartTime;
454- uint64_t memcpyStartTime;
455- uint64_t memcpyEndTime;
456- uint64_t runEndTime;
457- uint64_t runEndTick;
458- uint32_t threadId;
459- uint32_t deviceId;
460- uint64_t submitTick;
461- uint64_t scheduleTick;
462- uint64_t tickBeforeRun;
463- uint64_t tickAfterRun;
464- uint32_t kernelType;
465- uint32_t dispatchTime;
466- uint32_t totalTime;
467- uint16_t fftsThreadId;
468- uint8_t version;
469- uint8_t reserve[MSPROF_AICPU_DATA_RESERVE_BYTES];
470-};
471- 
472-struct MsprofAicpuModelProfData {
473-#ifdef __cplusplus
474- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
475- uint16_t dataTag = MSPROF_AICPU_MODEL_TAG;
476-#else
477- uint16_t magicNumber;
478- uint16_t dataTag;
479-#endif
480- uint32_t rsv; // Ensure 8-byte alignment
481- uint64_t timeStamp;
482- uint64_t indexId;
483- uint32_t modelId;
484- uint16_t tagId;
485- uint16_t rsv1;
486- uint64_t eventId;
487- uint8_t reserve[24];
488-};
489- 
490-/**
491- * @brief struct of data reported by DP
492- */
493-#define MSPROF_DP_DATA_RESERVE_BYTES 16
494-#define MSPROF_DP_DATA_ACTION_LEN 16
495-#define MSPROF_DP_DATA_SOURCE_LEN 64
496-#define MSPROF_CTX_ID_MAX_NUM 55
497- 
498-struct MsprofDpProfData {
499-#ifdef __cplusplus
500- uint16_t magicNumber = MSPROF_DATA_HEAD_MAGIC_NUM;
501- uint16_t dataTag = MSPROF_DP_DATA_TAG;
502-#else
503- uint16_t magicNumber;
504- uint16_t dataTag;
505-#endif
506- uint32_t rsv; // Ensure 8-byte alignment
507- uint64_t timeStamp;
508- char action[MSPROF_DP_DATA_ACTION_LEN];
509- char source[MSPROF_DP_DATA_SOURCE_LEN];
510- uint64_t index;
511- uint64_t size;
512- uint8_t reserve[MSPROF_DP_DATA_RESERVE_BYTES];
513-};
514- 
515-struct MsprofAicpuNodeAdditionalData {
516- uint16_t streamId;
517- uint16_t taskId;
518- uint64_t runStartTime;
519- uint64_t runStartTick;
520- uint64_t computeStartTime;
521- uint64_t memcpyStartTime;
522- uint64_t memcpyEndTime;
523- uint64_t runEndTime;
524- uint64_t runEndTick;
525- uint32_t threadId;
526- uint32_t deviceId;
527- uint64_t submitTick;
528- uint64_t scheduleTick;
529- uint64_t tickBeforeRun;
530- uint64_t tickAfterRun;
531- uint32_t kernelType;
532- uint32_t dispatchTime;
533- uint32_t totalTime;
534- uint16_t fftsThreadId;
535- uint8_t version;
536- uint8_t reserve[MSPROF_AICPU_DATA_RESERVE_BYTES];
537-};
538- 
539-struct MsprofAicpuModelAdditionalData {
540- uint64_t indexId;
541- uint32_t modelId;
542- uint16_t tagId;
543- uint16_t rsv1;
544- uint64_t eventId;
545- uint8_t reserve[24];
546-};
547- 
548-struct MsprofAicpuDpAdditionalData {
549- char action[MSPROF_DP_DATA_ACTION_LEN];
550- char source[MSPROF_DP_DATA_SOURCE_LEN];
551- uint64_t index;
552- uint64_t size;
553- uint8_t reserve[MSPROF_DP_DATA_RESERVE_BYTES];
554-};
555- 
556-struct MsprofAicpuMiAdditionalData {
557- uint32_t nodeTag; // MsprofMindsporeNodeTag:1
558- uint32_t reserve;
559- uint64_t queueSize;
560- uint64_t runStartTime;
561- uint64_t runEndTime;
562-};
563- 
564-// AICPU kfc算子执行时间
565-struct AicpuKfcProfCommTurn {
566- uint64_t waitNotifyStartTime; // 开始等待通信参数
567- uint64_t kfcAlgExeStartTime; // 开始通信算法执行
568- uint64_t sendTaskStartTime; // 开始下发task
569- uint64_t waitActiveStartTime; // 开始等待激活
570- uint64_t acitveStartTime; // 开始激活处理
571- uint64_t waitExeEndStartTime; // 开始等待任务执行结束
572- uint64_t rtsqExeEndTime; // 任务执行结束时间
573- uint64_t dataLen; // 本轮通信数据长度
574- uint32_t deviceId;
575- uint16_t streamId;
576- uint16_t taskId;
577- uint8_t version;
578- uint8_t commTurn; // 总通信轮次
579- uint8_t currentTurn;
580- uint8_t reserve[5];
581-};
582- 
583-// Aicore算子执行时间
584-struct AicpuKfcProfComputeTurn {
585- uint64_t waitComputeStartTime; // 开始等待计算
586- uint64_t computeStartTime; // 开始计算
587- uint64_t computeExeEndTime; // 计算执行结束
588- uint64_t dataLen; // 本轮计算数据长度
589- uint32_t deviceId;
590- uint16_t streamId;
591- uint16_t taskId;
592- uint8_t version;
593- uint8_t computeTurn; // 总计算轮次
594- uint8_t currentTurn;
595- uint8_t reserve[5];
596-};
597- 
598-/**
599- * @brief struct of data reported by HCCL
600- */
601-#pragma pack(4)
602-struct MsprofHcclProfNotify {
603- uint32_t taskID;
604- uint64_t notifyID;
605- uint32_t stage;
606- uint32_t remoteRank;
607- uint32_t transportType;
608- uint32_t role; // role {0: dst, 1:src}
609- double durationEstimated;
610-};
611- 
612-struct MsprofHcclProfReduce {
613- uint32_t taskID;
614- uint64_t src;
615- uint64_t dst;
616- uint64_t size;
617- uint32_t op; // {0: sum, 1: mul, 2: max, 3: min}
618- uint32_t dataType; // data type {0: INT8, 1: INT16, 2: INT32, 3: FP16, 4:FP32, 5:INT64, 6:UINT64}
619- uint32_t linkType; // link type {0: 'OnChip', 1: 'HCCS', 2: 'PCIe', 3: 'RoCE'}
620- uint32_t remoteRank;
621- uint32_t transportType; // transport type {0: SDMA, 1: RDMA, 2:LOCAL}
622- uint32_t role; // role {0: dst, 1:src}
623- double durationEstimated;
624-};
625- 
626-struct MsprofHcclProfRDMA {
627- uint32_t taskID;
628- uint64_t src;
629- uint64_t dst;
630- uint64_t size;
631- uint64_t notifyID;
632- uint32_t linkType; // link type {0: 'OnChip', 1: 'HCCS', 2: 'PCIe', 3: 'RoCE'}
633- uint32_t remoteRank;
634- uint32_t transportType; // transport type {0: RDMA, 1:SDMA, 2:LOCAL}
635- uint32_t role; // role {0: dst, 1:src}
636- uint32_t type; // RDMA type {0: RDMASendNotify, 1:RDMASendPayload}
637- double durationEstimated;
638-};
639- 
640-struct MsprofHcclProfMemcpy {
641- uint32_t taskID;
642- uint64_t src;
643- uint64_t dst;
644- uint64_t size;
645- uint64_t notifyID;
646- uint32_t linkType; // link type {0: 'OnChip', 1: 'HCCS', 2: 'PCIe', 3: 'RoCE'}
647- uint32_t remoteRank;
648- uint32_t transportType; // transport type {0: RDMA, 1:SDMA, 2:LOCAL}
649- uint32_t role; // role {0: dst, 1:src}
650- double durationEstimated;
651-};
652- 
653-struct MsprofHcclProfStageStep {
654- uint32_t rank;
655- uint32_t rankSize;
656-};
657- 
658-struct MsprofHcclProfFlag {
659- uint64_t cclTag;
660- uint64_t groupName;
661- uint32_t localRank;
662- uint32_t workFlowMode;
663-};
664- 
665-#define MSPROF_HCCL_INVALID_UINT 0xFFFFFFFFU
666-struct MsprofHcclInfo {
667- uint64_t itemId;
668- uint64_t cclTag;
669- uint64_t groupName;
670- uint32_t localRank;
671- uint32_t remoteRank;
672- uint32_t rankSize;
673- uint32_t workFlowMode;
674- uint32_t planeID;
675- uint32_t ctxId;
676- uint64_t notifyID;
677- uint32_t stage;
678- uint32_t role; // role {0: dst, 1:src}
679- double durationEstimated;
680- uint64_t srcAddr;
681- uint64_t dstAddr;
682- uint64_t dataSize; // bytes
683- uint32_t opType; // {0: sum, 1: mul, 2: max, 3: min}
684- uint32_t dataType; // data type {0: INT8, 1: INT16, 2: INT32, 3: FP16, 4:FP32, 5:INT64, 6:UINT64}
685- uint32_t linkType; // link type {0: 'OnChip', 1: 'HCCS', 2: 'PCIe', 3: 'RoCE'}
686- uint32_t transportType; // transport type {0: SDMA, 1: RDMA, 2:LOCAL}
687- uint32_t rdmaType; // RDMA type {0: RDMASendNotify, 1:RDMASendPayload}
688- uint32_t reserve2;
689-#ifdef __cplusplus
690- MsprofHcclInfo() : role(MSPROF_HCCL_INVALID_UINT), opType(MSPROF_HCCL_INVALID_UINT),
691- dataType(MSPROF_HCCL_INVALID_UINT), linkType(MSPROF_HCCL_INVALID_UINT),
692- transportType(MSPROF_HCCL_INVALID_UINT), rdmaType(MSPROF_HCCL_INVALID_UINT)
693- {
694- }
695-#endif
696-};
697- 
698-struct MsprofAicpuMC2HcclInfo {
699- uint64_t itemId;
700- uint64_t cclTag;
701- uint64_t groupName;
702- uint32_t localRank;
703- uint32_t remoteRank;
704- uint32_t rankSize;
705- uint32_t workFlowMode;
706- uint32_t planeID;
707- uint32_t ctxId;
708- uint64_t notifyID;
709- uint32_t stage;
710- uint32_t role; // role {0: dst, 1:src}
711- double durationEstimated;
712- uint64_t srcAddr;
713- uint64_t dstAddr;
714- uint64_t dataSize; // bytes
715- uint32_t opType; // {0: sum, 1: mul, 2: max, 3: min}
716- uint32_t dataType; // data type {0: INT8, 1: INT16, 2: INT32, 3: FP16, 4:FP32, 5:INT64, 6:UINT64}
717- uint32_t linkType; // link type {0: 'OnChip', 1: 'HCCS', 2: 'PCIe', 3: 'RoCE'}
718- uint32_t transportType; // transport type {0: SDMA, 1: RDMA, 2:LOCAL}
719- uint32_t rdmaType; // RDMA type {0: RDMASendNotify, 1:RDMASendPayload}
720- uint32_t taskId;
721- uint16_t streamId;
722- uint16_t reserve[3];
723-};
724- 
725-struct ProfilingDeviceCommResInfo {
726- uint64_t groupName; // 通信域
727- uint32_t rankSize; // 通信域内rank总数
728- uint32_t rankId; // 当前device rankId,通信域内编号
729- uint32_t usrRankId; // 当前device rankId,全局编号
730- uint32_t aicpuKfcStreamId; // MC2中launch aicpu kfc算子的stream
731- uint32_t commStreamSize; // 当前device侧使用的通信stream数量
732- uint32_t commStreamIds[8]; // 具体streamId
733- uint32_t reserve;
734-};
735- 
736-#define MSPROF_MULTI_THREAD_MAX_NUM 25
737-struct MsprofMultiThread {
738- uint32_t threadNum;
739- uint32_t threadId[MSPROF_MULTI_THREAD_MAX_NUM];
740-};
741-#pragma pack()
742- 
743- 
744-#pragma pack(1)
745-struct MsprofNodeBasicInfo {
746- uint64_t opName;
747- uint32_t taskType;
748- uint64_t opType;
749- uint32_t blockDim;
750- uint32_t opFlag;
751-};
752- 
753-enum AttrType {
754- OP_ATTR = 0,
755-};
756- 
757-struct MsprofAttrInfo {
758- uint64_t opName;
759- uint32_t attrType;
760- uint64_t hashId;
761-};
762- 
763-struct MsrofTensorData {
764- uint32_t tensorType;
765- uint32_t format;
766- uint32_t dataType;
767- uint32_t shape[MSPROF_GE_TENSOR_DATA_SHAPE_LEN];
768-};
769- 
770-struct MsprofTensorInfo {
771- uint64_t opName;
772- uint32_t tensorNum;
773- struct MsrofTensorData tensorData[MSPROF_GE_TENSOR_DATA_NUM];
774-};
775- 
776-struct MsprofHCCLOPInfo { // for MsprofReportCompactInfo buffer data
777- uint8_t relay : 1; // 借轨通信
778- uint8_t retry : 1; // 重传标识
779- uint8_t dataType; // 跟HcclDataType类型保存一致
780- uint16_t algType; // algtype 每4位表示一个算法阶段
781- uint64_t count; // 发送数据个数
782- uint64_t groupName; // group hash id
783-};
784- 
785-struct ProfFusionOpInfo {
786-uint64_t opName;
787-uint32_t fusionOpNum;
788-uint64_t inputMemsize;
789-uint64_t outputMemsize;
790-uint64_t weightMemSize;
791-uint64_t workspaceMemSize;
792-uint64_t totalMemSize;
793-uint64_t fusionOpId[MSPROF_GE_FUSION_OP_NUM];
794-};
795- 
796-struct MsprofContextIdInfo {
797- uint64_t opName;
798- uint32_t ctxIdNum;
799- uint32_t ctxIds[MSPROF_CTX_ID_MAX_NUM];
800-};
801- 
802-struct MsprofGraphIdInfo {
803- uint64_t modelName;
804- uint32_t graphId;
805- uint32_t modelId;
806-};
807- 
808-struct MsprofMemoryInfo {
809- uint64_t addr;
810- int64_t size;
811- uint64_t nodeId; // op name hash id
812- uint64_t totalAllocateMemory;
813- uint64_t totalReserveMemory;
814- uint32_t deviceId;
815- uint32_t deviceType;
816-};
817- 
818-/**
819- * @name MsprofStampInfo
820- * @brief struct of data reported by msproftx
821- */
822-struct MsprofStampInfo {
823- uint16_t magicNumber;
824- uint16_t dataTag;
825- uint32_t processId;
826- uint32_t threadId;
827- uint32_t category; // marker category
828- uint32_t eventType;
829- int32_t payloadType;
830- union PayloadValue {
831- uint64_t ullValue;
832- int64_t llValue;
833- double dValue;
834- uint32_t uiValue[2];
835- int32_t iValue[2];
836- float fValue[2];
837- } payload; // payload info for marker
838- uint64_t startTime;
839- uint64_t endTime;
840- int32_t messageType;
841- char message[128];
842-};
843- 
844-struct MsprofStaticOpMem {
845- int64_t size; // op memory size
846- uint64_t opName; // op name hash id
847- uint64_t lifeStart; // serial number of op memory used
848- uint64_t lifeEnd; // serial number of op memory used
849- uint64_t totalAllocateMemory; // static graph total allocate memory
850- uint64_t dynOpName; // 0: invalid, other: dynamic op name of root
851- uint32_t graphId; // multipe model
852-};
853- 
854-#define MSPROF_PHYSIC_STREAM_ID_MAX_NUM 56
855-struct MsprofLogicStreamInfo {
856- uint32_t logicStreamId;
857- uint32_t physicStreamNum;
858- uint32_t physicStreamId[MSPROF_PHYSIC_STREAM_ID_MAX_NUM];
859-};
860- 
861-struct MsprofExeomLoadInfo {
862- uint32_t modelId;
863- uint32_t reserve;
864- uint64_t modelName; /* name hash */
865-};
866-#pragma pack()
867- 
868-struct MsprofApi { // for MsprofReportApi
869-#ifdef __cplusplus
870- uint16_t magicNumber = MSPROF_REPORT_DATA_MAGIC_NUM;
871-#else
872- uint16_t magicNumber;
873-#endif
874- uint16_t level;
875- uint32_t type;
876- uint32_t threadId;
877- uint32_t reserve;
878- uint64_t beginTime;
879- uint64_t endTime;
880- uint64_t itemId;
881-};
882- 
883-struct MsprofEvent { // for MsprofReportEvent
884-#ifdef __cplusplus
885- uint16_t magicNumber = MSPROF_REPORT_DATA_MAGIC_NUM;
886-#else
887- uint16_t magicNumber;
888-#endif
889- uint16_t level;
890- uint32_t type;
891- uint32_t threadId;
892- uint32_t requestId; // 0xFFFF means single event
893- uint64_t timeStamp;
894-#ifdef __cplusplus
895- uint64_t eventFlag = MSPROF_EVENT_FLAG;
896-#else
897- uint64_t eventFlag;
898-#endif
899- uint64_t itemId;
900-};
901- 
902-struct MsprofRuntimeTrack { // for MsprofReportCompactInfo buffer data
903- uint16_t deviceId;
904- uint16_t streamId;
905- uint32_t taskId;
906- uint64_t taskType; // task message hash id
907-};
908- 
909-struct MsprofDpuTrack { // for MsprofReportCompactInfo buffer data
910- uint16_t deviceId; // high 4 bits, devType: dpu: 1, low 12 bits device id
911- uint16_t streamId;
912- uint32_t taskId;
913- uint32_t taskType; // task type enum
914- uint32_t res;
915- uint64_t startTime; // start time
916-};
917- 
918-#define MSPROF_COMPACT_INFO_DATA_LENGTH (40)
919-struct MsprofCompactInfo { // for MsprofReportCompactInfo buffer data
920-#ifdef __cplusplus
921- uint16_t magicNumber = MSPROF_REPORT_DATA_MAGIC_NUM;
922-#else
923- uint16_t magicNumber;
924-#endif
925- uint16_t level;
926- uint32_t type;
927- uint32_t threadId;
928- uint32_t dataLen;
929- uint64_t timeStamp;
930- union {
931- uint8_t info[MSPROF_COMPACT_INFO_DATA_LENGTH];
932- struct MsprofRuntimeTrack runtimeTrack;
933- struct MsprofNodeBasicInfo nodeBasicInfo;
934- struct MsprofHCCLOPInfo hcclopInfo;
935- struct MsprofDpuTrack dpuTack;
936- } data;
937-};
938- 
939-#define MSPROF_ADDTIONAL_INFO_DATA_LENGTH (232)
940-struct MsprofAdditionalInfo { // for MsprofReportAdditionalInfo buffer data
941-#ifdef __cplusplus
942- uint16_t magicNumber = MSPROF_REPORT_DATA_MAGIC_NUM;
943-#else
944- uint16_t magicNumber;
945-#endif
946- uint16_t level;
947- uint32_t type;
948- uint32_t threadId;
949- uint32_t dataLen;
950- uint64_t timeStamp;
951- uint8_t data[MSPROF_ADDTIONAL_INFO_DATA_LENGTH];
952-};
953- 
954-/**
955- * @name MsprofErrorCode
956- * @brief error code
957- */
958-enum MsprofErrorCode {
959- MSPROF_ERROR_NONE = 0,
960- MSPROF_ERROR_MEM_NOT_ENOUGH,
961- MSPROF_ERROR_GET_ENV,
962- MSPROF_ERROR_CONFIG_INVALID,
963- MSPROF_ERROR_ACL_JSON_OFF,
964- MSPROF_ERROR,
965- MSPROF_ERROR_UNINITIALIZE,
966-};
967- 
968-#define MSPROF_ENGINE_MAX_TAG_LEN (63)
969- 
970-/**
971- * @name ReporterData
972- * @brief struct of data to report
973- */
974-struct ReporterData {
975- char tag[MSPROF_ENGINE_MAX_TAG_LEN + 1]; // the sub-type of the module, data with different tag will be writen
976- int32_t deviceId; // the index of device
977- size_t dataLen; // the length of send data
978- uint8_t *data; // the data content
979-};
980- 
981-/**
982- * @name MsprofHashData
983- * @brief struct of data to hash
984- */
985-struct MsprofHashData {
986- int32_t deviceId; // the index of device
987- size_t dataLen; // the length of data
988- uint8_t *data; // the data content
989- uint64_t hashId; // the id of hashed data
990-};
991- 
992-enum MsprofConfigParamType {
993- DEV_CHANNEL_RESOURCE = 0, // device channel resource
994- HELPER_HOST_SERVER // helper host server
995-};
996- 
997-/**
998- * @name MsprofConfigParam
999- * @brief struct of set config
1000- */
1001-struct MsprofConfigParam {
1002- uint32_t deviceId; // the index of device
1003- uint32_t type; // DEV_CHANNEL_RESOURCE; HELPER_HOST_SERVER
1004- uint32_t value; // DEV_CHANNEL_RESOURCE: 1 off; HELPER_HOST_SERVER: 1 on
1005-};
1006- 
1007-/**
1008- * @name MsprofReporterModuleId
1009- * @brief module id of data to report
1010- */
1011-enum MsprofReporterModuleId {
1012- MSPROF_MODULE_DATA_PREPROCESS = 0, // DATA_PREPROCESS
1013- MSPROF_MODULE_HCCL, // HCCL
1014- MSPROF_MODULE_ACL, // AclModule
1015- MSPROF_MODULE_FRAMEWORK, // Framework
1016- MSPROF_MODULE_RUNTIME, // runtime
1017- MSPROF_MODULE_MSPROF // msprofTx
1018-};
1019- 
1020-/**
1021- * @name MsprofReporterCallbackType
1022- * @brief reporter callback request type
1023- */
1024-enum MsprofReporterCallbackType {
1025- MSPROF_REPORTER_REPORT = 0, // report data
1026- MSPROF_REPORTER_INIT, // init reporter
1027- MSPROF_REPORTER_UNINIT, // uninit reporter
1028- MSPROF_REPORTER_DATA_MAX_LEN, // data max length for calling report callback
1029- MSPROF_REPORTER_HASH // hash data to id
1030-};
1031- 
1032-#define MSPROF_OPTIONS_DEF_LEN_MAX (2048U)
1033- 
1034-/**
1035- * @name MsprofGeOptions
1036- * @brief struct of MSPROF_CTRL_INIT_GE_OPTIONS
1037- */
1038-struct MsprofGeOptions {
1039- char jobId[MSPROF_OPTIONS_DEF_LEN_MAX];
1040- char options[MSPROF_OPTIONS_DEF_LEN_MAX];
1041-};
1042- 
1043-/**
1044- * @name MsprofCtrlCallbackType
1045- * @brief ctrl callback request type
1046- */
1047-enum MsprofCtrlCallbackType {
1048- MSPROF_CTRL_INIT_ACL_ENV = 0, // start profiling with acl env
1049- MSPROF_CTRL_INIT_ACL_JSON = 1, // start pro with acl.json
1050- MSPROF_CTRL_INIT_GE_OPTIONS = 2, // start profiling with ge env and options
1051- MSPROF_CTRL_FINALIZE = 3, // stop profiling
1052- MSPROF_CTRL_INIT_HELPER = 4, // start profiling in helper device
1053- MSPROF_CTRL_INIT_PURE_CPU = 5, // start profiling in pure cpu
1054- MSPROF_CTRL_INIT_DYNA = 0xFF, // start profiling for dynamic profiling
1055-};
1056- 
1057-enum MsprofCommandHandleType {
1058- PROF_COMMANDHANDLE_TYPE_INIT = 0,
1059- PROF_COMMANDHANDLE_TYPE_START,
1060- PROF_COMMANDHANDLE_TYPE_STOP,
1061- PROF_COMMANDHANDLE_TYPE_FINALIZE,
1062- PROF_COMMANDHANDLE_TYPE_MODEL_SUBSCRIBE,
1063- PROF_COMMANDHANDLE_TYPE_MODEL_UNSUBSCRIBE,
1064- PROF_COMMANDHANDLE_TYPE_MAX
1065-};
1066- 
1067-enum MsprofConfigType {
1068- MSPROF_CONFIG_HELPER_HOST = 0
1069-};
1070- 
1071-/**
1072- * @brief profiling command type
1073- */
1074-enum ProfCtrlType {
1075- PROF_CTRL_INVALID = 0,
1076- PROF_CTRL_SWITCH,
1077- PROF_CTRL_REPORTER,
1078- PROF_CTRL_STEPINFO,
1079- PROF_CTRL_BUTT
1080-};
1081- 
1082-/**
1083- * @brief Prof Chip ID
1084- */
1085-enum Prof_Chip_ID {
1086- PROF_CHIP_ID0 = 0
1087-};
1088- 
1089-/**
1090- * @brief the struct of profiling set setp info
1091- */
1092-typedef struct ProfStepInfoCmd {
1093- uint64_t index_id;
1094- uint16_t tag_id;
1095- void *stream;
1096-} ProfStepInfoCmd_t;
1097- 
1098-#ifdef __cplusplus
1099-}
1100-#endif
1101-#endif // MSPROFILER_PROF_COMMON_H_
@@ -1,99 +0,0 @@
1-/**
2- * @file prof_data_config.h
3- *
4- * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
5- *
6- * This program is distributed in the hope that it will be useful,
7- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9- *
10- */
11- 
12-#ifndef MSPROFILER_API_PROF_DATA_CONFIG_H
13-#define MSPROFILER_API_PROF_DATA_CONFIG_H
14- 
15-// DataTypeConfig
16-#define PROF_ACL_API 0x00000001ULL
17-#define PROF_TASK_TIME_L1 0x00000002ULL
18-#define PROF_AICORE_METRICS 0x00000004ULL
19-#define PROF_AICPU_TRACE 0x00000008ULL
20-#define PROF_L2CACHE 0x00000010ULL
21-#define PROF_HCCL_TRACE 0x00000020ULL
22-#define PROF_TRAINING_TRACE 0x00000040ULL
23-#define PROF_MSPROFTX 0x00000080ULL
24-#define PROF_RUNTIME_API 0x00000100ULL
25-#define PROF_FWK_SCHEDULE_L0 0x00000200ULL
26-#define PROF_TASK_TSFW 0x00000400ULL
27-#define PROF_TASK_TIME 0x00000800ULL
28-#define PROF_TASK_MEMORY 0x00001000ULL
29-#define PROF_TASK_TIME_L2 0x00002000ULL
30-#define PROF_OP_ATTR 0x00004000ULL
31- 
32-// system profilinig switch
33-#define PROF_CPU 0x00010000ULL
34-#define PROF_HARDWARE_MEMORY 0x00020000ULL
35-#define PROF_IO 0x00040000ULL
36-#define PROF_INTER_CONNECTION 0x00080000ULL
37-#define PROF_DVPP 0x00100000ULL
38-#define PROF_SYS_AICORE_SAMPLE 0x00200000ULL
39-#define PROF_AIVECTORCORE_SAMPLE 0x00400000ULL
40-#define PROF_INSTR 0x00800000ULL
41- 
42-#define PROF_FWK_SCHEDULE_L1 0x0000001000000ULL
43-#define PROF_PURE_CPU 0x0000002000000ULL
44-#define PROF_RUNTIME_TRACE 0x0000004000000ULL
45-#define PROF_SCHEDULE_TIMELINE 0x0000008000000ULL
46-#define PROF_SCHEDULE_TRACE 0x0000010000000ULL
47-#define PROF_AIVECTORCORE_METRICS 0x0000020000000ULL
48-#define PROF_SUBTASK_TIME 0x0000040000000ULL
49-#define PROF_OP_DETAIL 0x0000080000000ULL
50- 
51-#define PROF_AICPU_MODEL 0x4000000000000000ULL
52-#define PROF_MODEL_LOAD 0x8000000000000000ULL
53- 
54-#define PROF_TASK_TRACE PROF_RUNTIME_TRACE | PROF_TASK_TIME | PROF_TRAINING_TRACE | PROF_HCCL_TRACE | PROF_TASK_TIME_L1
55- 
56-// DataTypeConfig MASK
57-#define PROF_ACL_API_MASK 0x00000001ULL
58-#define PROF_TASK_TIME_L1_MASK 0x00000002ULL
59-#define PROF_AICORE_METRICS_MASK 0x00000004ULL
60-#define PROF_AICPU_TRACE_MASK 0x00000008ULL
61-#define PROF_L2CACHE_MASK 0x00000010ULL
62-#define PROF_HCCL_TRACE_MASK 0x00000020ULL
63-#define PROF_TRAINING_TRACE_MASK 0x00000040ULL
64-#define PROF_MSPROFTX_MASK 0x00000080ULL
65-#define PROF_RUNTIME_API_MASK 0x00000100ULL
66-#define PROF_TASK_FRAMEWORK_MASK 0x00000200ULL
67-#define PROF_FWK_SCHEDULE_L0_MASK 0x00000200ULL
68-#define PROF_TASK_TSFW_MASK 0x00000400ULL
69-#define PROF_TASK_TIME_MASK 0x00000800ULL
70-#define PROF_TASK_MEMORY_MASK 0x00001000ULL
71-#define PROF_TASK_TIME_L2_MASK 0x00002000ULL
72-#define PROF_OP_ATTR_MASK 0x00004000ULL
73- 
74-// system profilinig mask
75-#define PROF_CPU_MASK 0x00010000ULL
76-#define PROF_HARDWARE_MEMORY_MASK 0x00020000ULL
77-#define PROF_IO_MASK 0x00040000ULL
78-#define PROF_INTER_CONNECTION_MASK 0x00080000ULL
79-#define PROF_DVPP_MASK 0x00100000ULL
80-#define PROF_SYS_AICORE_SAMPLE_MASK 0x00200000ULL
81-#define PROF_AIVECTORCORE_SAMPLE_MASK 0x00400000ULL
82-#define PROF_INSTR_MASK 0x00800000ULL
83- 
84-#define PROF_MODEL_EXECUTE_MASK 0x0000001000000ULL
85-#define PROF_FWK_SCHEDULE_L1_MASK 0x0000001000000ULL
86-#define PROF_RUNTIME_TRACE_MASK 0x0000004000000ULL
87-#define PROF_SCHEDULE_TIMELINE_MASK 0x0000008000000ULL
88-#define PROF_SCHEDULE_TRACE_MASK 0x0000010000000ULL
89-#define PROF_AIVECTORCORE_METRICS_MASK 0x0000020000000ULL
90-#define PROF_SUBTASK_TIME_MASK 0x0000040000000ULL
91-#define PROF_OP_DETAIL_MASK 0x0000080000000ULL
92- 
93-#define PROF_AICPU_MODEL_MASK 0x4000000000000000ULL
94-#define PROF_MODEL_LOAD_MASK 0x8000000000000000ULL
95- 
96-// devprof config
97-#define PROF_HI_MC2 0x1000000000000ULL // bit0 of the upper 16 bits of profSwitchHi means MC2 switch
98- 
99-#endif // MSPROFILER_API_PROF_DATA_CONFIG_H_
@@ -0,0 +1,180 @@
1+/**
2+ * @file aprof_pub.h
3+ *
4+ * Minimal profiling declarations required by DVM and MLIR launcher code.
5+ */
6+#ifndef APROF_PUB_H
7+#define APROF_PUB_H
8+ 
9+#include <stddef.h>
10+#include <stdint.h>
11+ 
12+#ifdef __cplusplus
13+extern "C" {
14+#endif
15+ 
16+#if (defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER))
17+#define MSVP_PROF_API __declspec(dllexport)
18+#else
19+#define MSVP_PROF_API __attribute__((visibility("default")))
20+#endif
21+ 
22+typedef void *VOID_PTR;
23+ 
24+#define MSPROF_REPORT_DATA_MAGIC_NUM 0x5A5AU
25+#define MSPROF_COMPACT_INFO_DATA_LENGTH 40
26+#define PATH_LEN_MAX 1023
27+#define PARAM_LEN_MAX 4095
28+#define MSPROF_MAX_DEV_NUM 64
29+#define MSPROF_GE_TENSOR_DATA_SHAPE_LEN 8
30+#define MSPROF_GE_TENSOR_DATA_NUM 5
31+#define MSPROF_CTX_ID_MAX_NUM 55
32+#define MSPROF_ADDTIONAL_INFO_DATA_LENGTH 232
33+ 
34+#define MSPROF_REPORT_NODE_LEVEL 10000U
35+#define MSPROF_REPORT_NODE_BASIC_INFO_TYPE 0U
36+#define MSPROF_REPORT_NODE_TENSOR_INFO_TYPE 1U
37+#define MSPROF_REPORT_NODE_CONTEXT_ID_INFO_TYPE 4U
38+#define MSPROF_REPORT_NODE_LAUNCH_TYPE 5U
39+ 
40+#define PROF_TASK_TIME_L1_MASK 0x00000002ULL
41+#define PROF_TASK_TIME_MASK 0x00000800ULL
42+ 
43+enum MsprofErrorCode {
44+ MSPROF_ERROR_NONE = 0,
45+};
46+ 
47+enum MsprofCommandHandleType {
48+ PROF_COMMANDHANDLE_TYPE_INIT = 0,
49+ PROF_COMMANDHANDLE_TYPE_START,
50+ PROF_COMMANDHANDLE_TYPE_STOP,
51+ PROF_COMMANDHANDLE_TYPE_FINALIZE,
52+ PROF_COMMANDHANDLE_TYPE_MODEL_SUBSCRIBE,
53+ PROF_COMMANDHANDLE_TYPE_MODEL_UNSUBSCRIBE,
54+ PROF_COMMANDHANDLE_TYPE_MAX
55+};
56+ 
57+enum MsprofGeTaskType {
58+ MSPROF_GE_TASK_TYPE_AI_CORE = 0,
59+};
60+ 
61+enum MsprofGeTensorType {
62+ MSPROF_GE_TENSOR_TYPE_INPUT = 0,
63+ MSPROF_GE_TENSOR_TYPE_OUTPUT,
64+};
65+ 
66+enum ProfCtrlType {
67+ PROF_CTRL_INVALID = 0,
68+ PROF_CTRL_SWITCH,
69+};
70+ 
71+struct MsprofCommandHandleParams {
72+ uint32_t pathLen;
73+ uint32_t storageLimit;
74+ uint32_t profDataLen;
75+ char path[PATH_LEN_MAX + 1];
76+ char profData[PARAM_LEN_MAX + 1];
77+};
78+ 
79+struct MsprofCommandHandle {
80+ uint64_t profSwitch;
81+ uint64_t profSwitchHi;
82+ uint32_t devNums;
83+ uint32_t devIdList[MSPROF_MAX_DEV_NUM];
84+ uint32_t modelId;
85+ uint32_t type;
86+ uint32_t cacheFlag;
87+ struct MsprofCommandHandleParams params;
88+};
89+ 
90+#pragma pack(1)
91+ 
92+struct MsprofNodeBasicInfo {
93+ uint64_t opName;
94+ uint32_t taskType;
95+ uint64_t opType;
96+ uint32_t blockDim;
97+ uint32_t opFlag;
98+};
99+ 
100+struct MsrofTensorData {
101+ uint32_t tensorType;
102+ uint32_t format;
103+ uint32_t dataType;
104+ uint32_t shape[MSPROF_GE_TENSOR_DATA_SHAPE_LEN];
105+};
106+ 
107+struct MsprofTensorInfo {
108+ uint64_t opName;
109+ uint32_t tensorNum;
110+ struct MsrofTensorData tensorData[MSPROF_GE_TENSOR_DATA_NUM];
111+};
112+ 
113+struct MsprofContextIdInfo {
114+ uint64_t opName;
115+ uint32_t ctxIdNum;
116+ uint32_t ctxIds[MSPROF_CTX_ID_MAX_NUM];
117+};
118+ 
119+#pragma pack()
120+ 
121+struct MsprofApi {
122+#ifdef __cplusplus
123+ uint16_t magicNumber = MSPROF_REPORT_DATA_MAGIC_NUM;
124+#else
125+ uint16_t magicNumber;
126+#endif
127+ uint16_t level;
128+ uint32_t type;
129+ uint32_t threadId;
130+ uint32_t reserve;
131+ uint64_t beginTime;
132+ uint64_t endTime;
133+ uint64_t itemId;
134+};
135+ 
136+struct MsprofCompactInfo {
137+#ifdef __cplusplus
138+ uint16_t magicNumber = MSPROF_REPORT_DATA_MAGIC_NUM;
139+#else
140+ uint16_t magicNumber;
141+#endif
142+ uint16_t level;
143+ uint32_t type;
144+ uint32_t threadId;
145+ uint32_t dataLen;
146+ uint64_t timeStamp;
147+ union {
148+ uint8_t info[MSPROF_COMPACT_INFO_DATA_LENGTH];
149+ struct MsprofNodeBasicInfo nodeBasicInfo;
150+ } data;
151+};
152+ 
153+struct MsprofAdditionalInfo {
154+#ifdef __cplusplus
155+ uint16_t magicNumber = MSPROF_REPORT_DATA_MAGIC_NUM;
156+#else
157+ uint16_t magicNumber;
158+#endif
159+ uint16_t level;
160+ uint32_t type;
161+ uint32_t threadId;
162+ uint32_t dataLen;
163+ uint64_t timeStamp;
164+ uint8_t data[MSPROF_ADDTIONAL_INFO_DATA_LENGTH];
165+};
166+ 
167+typedef int32_t (*ProfCommandHandle)(uint32_t type, void *data, uint32_t len);
168+ 
169+MSVP_PROF_API int32_t MsprofRegisterCallback(uint32_t moduleId, ProfCommandHandle handle);
170+MSVP_PROF_API int32_t MsprofReportApi(uint32_t nonPersistantFlag, const struct MsprofApi *api);
171+MSVP_PROF_API int32_t MsprofReportCompactInfo(uint32_t nonPersistantFlag, const VOID_PTR data, uint32_t length);
172+MSVP_PROF_API int32_t MsprofReportAdditionalInfo(uint32_t nonPersistantFlag, const VOID_PTR data, uint32_t length);
173+MSVP_PROF_API uint64_t MsprofGetHashId(const char *hashInfo, size_t length);
174+MSVP_PROF_API uint64_t MsprofSysCycleTime(void);
175+ 
176+#ifdef __cplusplus
177+}
178+#endif
179+ 
180+#endif
@@ -0,0 +1,11 @@
1+/**
2+ * @file prof_api.h
3+ *
4+ * Minimal profiling API declarations required by DVM and MLIR launcher code.
5+ */
6+#ifndef PROF_API_H
7+#define PROF_API_H
8+ 
9+#include "prof_common.h"
10+ 
11+#endif
@@ -0,0 +1,24 @@
1+/**
2+ * @file prof_common.h
3+ *
4+ * Minimal common profiling declarations required by DVM and MLIR launcher code.
5+ */
6+#ifndef MSPROFILER_PROF_COMMON_H
7+#define MSPROFILER_PROF_COMMON_H
8+ 
9+#include "aprof_pub.h"
10+ 
11+#ifdef __cplusplus
12+extern "C" {
13+#endif
14+ 
15+#define MSPROF_DATA_HEAD_MAGIC_NUM 0x5A5AU
16+#define MSPROF_TASK_TIME_L0 0x00000800ULL
17+ 
18+typedef const void *ConstVoidPtr;
19+ 
20+#ifdef __cplusplus
21+}
22+#endif
23+ 
24+#endif
@@ -1 +1 @@
1-Subproject commit 0a731c41c5537d365ba739d037913a61fffd27c11+Subproject commit fe91de40ccbb3d9fbb2077423ee0f109760fb2f6
@@ -219,10 +219,10 @@ def refresh_input_meta_with_buffer_layout(node):
219 return val219 return val
220 220 
221 size, stride = tuple(layout.size), tuple(layout.stride)221 size, stride = tuple(layout.size), tuple(layout.stride)
222- if any(not isinstance(x, int) for x in (*size, *stride)):222+ if any(not isinstance(x, (int, sympy.Integer)) for x in (*size, *stride)):
223 return val223 return val
224 224 
225- if val.size() != size or val.stride() != stride:225+ if tuple(val.size()) != size or tuple(val.stride()) != stride:
226 with V.graph.fake_mode:226 with V.graph.fake_mode:
227 val = torch.empty_strided(227 val = torch.empty_strided(
228 size,228 size,
@@ -8,8 +8,8 @@
8#include <torch_npu/csrc/framework/OpCommand.h>8#include <torch_npu/csrc/framework/OpCommand.h>
9#include <torch_npu/csrc/profiler/profiler_mgr.h>9#include <torch_npu/csrc/profiler/profiler_mgr.h>
10 10 
11-#include "third_party/acl/inc/experiment/msprof/toolchain/prof_api.h"11+#include "third_party/acl/inc/profiling/prof_api.h"
12-#include "third_party/acl/inc/experiment/msprof/toolchain/prof_common.h"12+#include "third_party/acl/inc/profiling/prof_common.h"
13 13 
14struct TilingMem {14struct TilingMem {
15 std::unique_ptr<void, decltype(&aclrtFreeHost)> arg_tiling_host;15 std::unique_ptr<void, decltype(&aclrtFreeHost)> arg_tiling_host;
@@ -167,4 +167,4 @@ void TORCH_NPU_API opcommand_call(const char* name, std::function<int()> launch_
167 at_npu::native::OpCommand cmd;167 at_npu::native::OpCommand cmd;
168 cmd.Name(name).SetCustomHandler(launch_call).Run();168 cmd.Name(name).SetCustomHandler(launch_call).Run();
169}169}
170-#endif // BUILD_LIBTORCH170+#endif // BUILD_LIBTORCH