| @@ -268,8 +268,8 @@ void CANNTraceDBDumper::DumpOpDesc(const HostTasks &computeTasks) | |||
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | void CANNTraceDBDumper::AddTensorShapeInfo(const std::shared_ptr<ConcatTensorInfo> &tensorDesc, | 270 | void CANNTraceDBDumper::AddTensorShapeInfo(const std::shared_ptr<ConcatTensorInfo> &tensorDesc, |
| 271 | - MsprofNodeBasicInfo nodeBasicInfo, TaskInfoData &data, | 271 | + const MsprofNodeBasicInfo *nodeBasicInfo, TaskInfoData &data, |
| 272 | - const std::shared_ptr<HostTask> &task, bool isLevel0) | 272 | + const std::shared_ptr<HostTask> &task) |
| 273 | { | 273 | { |
| 274 | auto tensorNum = tensorDesc->tensorNum; | 274 | auto tensorNum = tensorDesc->tensorNum; |
| 275 | std::vector<std::string> inputFormat; | 275 | std::vector<std::string> inputFormat; |
| @@ -305,11 +305,15 @@ void CANNTraceDBDumper::AddTensorShapeInfo(const std::shared_ptr<ConcatTensorInf | |||
| 305 | } | 305 | } |
| 306 | auto desc = task->op->opDesc; | 306 | auto desc = task->op->opDesc; |
| 307 | auto attr = desc->nodeAttr; | 307 | auto attr = desc->nodeAttr; |
| 308 | - auto hashId = attr ? std::to_string(attr->data.nodeAttrInfo.hashId) : NA; | 308 | + const bool hasNodeBasicInfo = nodeBasicInfo != nullptr; |
| 309 | - uint32_t blockNum = nodeBasicInfo.blockNum & 0xffff; | 309 | + auto opName = HashData::GetInstance().Get(hasNodeBasicInfo ? nodeBasicInfo->opName : task->op->name); |
| 310 | - auto mixBlockNum = blockNum * (nodeBasicInfo.blockNum >> 16); | 310 | + auto hashId = hasNodeBasicInfo && attr ? std::to_string(attr->data.nodeAttrInfo.hashId) : NA; |
| 311 | - auto opFlag = nodeBasicInfo.opFlag ? "YES" : "NO"; | 311 | + uint32_t blockNum = hasNodeBasicInfo ? nodeBasicInfo->blockNum & 0xffff : 0; |
| 312 | - auto opState = std::to_string(nodeBasicInfo.opState); | 312 | + auto mixBlockNum = hasNodeBasicInfo ? blockNum * (nodeBasicInfo->blockNum >> 16) : 0; |
| 313 | + auto opFlag = hasNodeBasicInfo ? (nodeBasicInfo->opFlag ? "YES" : "NO") : NA; | ||
| 314 | + auto opState = hasNodeBasicInfo ? std::to_string(nodeBasicInfo->opState) : NA; | ||
| 315 | + auto taskType = hasNodeBasicInfo ? NumberMapping::Get(MappingType::GE_TASK_TYPE, nodeBasicInfo->taskType) : NA; | ||
| 316 | + auto opType = hasNodeBasicInfo ? HashData::GetInstance().Get(nodeBasicInfo->opType) : NA; | ||
| 313 | auto runtimeTrackDesc = desc->runtimeTrackDesc; | 317 | auto runtimeTrackDesc = desc->runtimeTrackDesc; |
| 314 | std::string gridDim = NA; | 318 | std::string gridDim = NA; |
| 315 | std::string blockDim = NA; | 319 | std::string blockDim = NA; |
| @@ -320,21 +324,10 @@ void CANNTraceDBDumper::AddTensorShapeInfo(const std::shared_ptr<ConcatTensorInf | |||
| 320 | auto outputFormatStr = outputFormat.empty() ? NA : Utils::Join(outputFormat, ";"); | 324 | auto outputFormatStr = outputFormat.empty() ? NA : Utils::Join(outputFormat, ";"); |
| 321 | auto outputDataTypeStr = outputDataType.empty() ? NA : Utils::Join(outputDataType, ";"); | 325 | auto outputDataTypeStr = outputDataType.empty() ? NA : Utils::Join(outputDataType, ";"); |
| 322 | auto outputShapeStr = outputShape.empty() ? NA : Utils::AddQuotation(Utils::Join(outputShape, ";")); | 326 | auto outputShapeStr = outputShape.empty() ? NA : Utils::AddQuotation(Utils::Join(outputShape, ";")); |
| 323 | - if (isLevel0) | 327 | + data.emplace_back(task->modelId, opName, task->streamId, task->taskId, blockNum, mixBlockNum, opState, taskType, |
| 324 | - { | 328 | + opType, task->requestId, task->thread_id, task->timeStamp, task->batchId, tensorNum, |
| 325 | - auto name = HashData::GetInstance().Get(task->op->name); | 329 | + inputFormatStr, inputDataTypeStr, inputShapeStr, outputFormatStr, outputDataTypeStr, |
| 326 | - data.emplace_back(task->modelId, name, task->streamId, task->taskId, blockNum, mixBlockNum, NA, NA, NA, | 330 | + outputShapeStr, task->deviceId, task->contextId, opFlag, hashId, gridDim, blockDim); |
| 327 | - task->requestId, task->thread_id, task->timeStamp, task->batchId, tensorNum, inputFormatStr, | ||
| 328 | - inputDataTypeStr, inputShapeStr, outputFormatStr, outputDataTypeStr, outputShapeStr, | ||
| 329 | - task->deviceId, task->contextId, NA, NA, gridDim, blockDim); | ||
| 330 | - return; | ||
| 331 | - } | ||
| 332 | - data.emplace_back( | ||
| 333 | - task->modelId, HashData::GetInstance().Get(nodeBasicInfo.opName), task->streamId, task->taskId, blockNum, | ||
| 334 | - mixBlockNum, opState, NumberMapping::Get(MappingType::GE_TASK_TYPE, nodeBasicInfo.taskType), | ||
| 335 | - HashData::GetInstance().Get(nodeBasicInfo.opType), task->requestId, task->thread_id, task->timeStamp, | ||
| 336 | - task->batchId, tensorNum, inputFormatStr, inputDataTypeStr, inputShapeStr, outputFormatStr, outputDataTypeStr, | ||
| 337 | - outputShapeStr, task->deviceId, task->contextId, opFlag, hashId, gridDim, blockDim); | ||
| 338 | } | 331 | } |
| 339 | 332 | ||
| 340 | std::string CANNTraceDBDumper::GetFormat(uint32_t oriFormat) | 333 | std::string CANNTraceDBDumper::GetFormat(uint32_t oriFormat) |
| @@ -387,12 +380,17 @@ void CANNTraceDBDumper::AddTaskInfoForOnlyTaskTrack(const std::shared_ptr<HostTa | |||
| 387 | auto runtimeTrackDesc = task->op->opDesc->runtimeTrackDesc; | 380 | auto runtimeTrackDesc = task->op->opDesc->runtimeTrackDesc; |
| 388 | if (isLevel0) | 381 | if (isLevel0) |
| 389 | { | 382 | { |
| 383 | + bool hasTensorInfo = info.isValid && info.tensorNum > 0; | ||
| 390 | uint32_t blockNum = 0; | 384 | uint32_t blockNum = 0; |
| 391 | uint32_t mixBlockNum = 0; | 385 | uint32_t mixBlockNum = 0; |
| 392 | ProcessRuntimeTrackInfo(runtimeTrackDesc, blockNum, mixBlockNum, gridDim, blockDim); | 386 | ProcessRuntimeTrackInfo(runtimeTrackDesc, blockNum, mixBlockNum, gridDim, blockDim); |
| 393 | data.emplace_back(info.modelId, opName, task->streamId, task->taskId, blockNum, mixBlockNum, NA, taskType, | 387 | data.emplace_back(info.modelId, opName, task->streamId, task->taskId, blockNum, mixBlockNum, NA, taskType, |
| 394 | - opType, task->requestId, task->thread_id, task->timeStamp, task->batchId, 0, NA, NA, NA, NA, | 388 | + opType, task->requestId, task->thread_id, task->timeStamp, task->batchId, |
| 395 | - NA, NA, task->deviceId, task->contextId, opFlag, info.hashId, NA, NA); | 389 | + hasTensorInfo ? info.tensorNum : 0, hasTensorInfo ? info.inputFormats : NA, |
| 390 | + hasTensorInfo ? info.inputDataTypes : NA, hasTensorInfo ? info.inputShapes : NA, | ||
| 391 | + hasTensorInfo ? info.outputFormats : NA, hasTensorInfo ? info.outputDataTypes : NA, | ||
| 392 | + hasTensorInfo ? info.outputShapes : NA, task->deviceId, task->contextId, opFlag, info.hashId, | ||
| 393 | + NA, NA); | ||
| 396 | } | 394 | } |
| 397 | else | 395 | else |
| 398 | { | 396 | { |
| @@ -451,9 +449,9 @@ void CANNTraceDBDumper::AddTaskInfo(const std::shared_ptr<HostTask> &task, TaskI | |||
| 451 | if (isLevel0) | 449 | if (isLevel0) |
| 452 | { | 450 | { |
| 453 | auto desc = task->op->opDesc; | 451 | auto desc = task->op->opDesc; |
| 454 | - if (desc->tensorDesc) | 452 | + if (desc->tensorDesc && desc->tensorDesc->tensorNum > 0) |
| 455 | { | 453 | { |
| 456 | - AddTensorShapeInfo(desc->tensorDesc, MsprofNodeBasicInfo{}, data, task, true); | 454 | + AddTensorShapeInfo(desc->tensorDesc, nullptr, data, task); |
| 457 | return; | 455 | return; |
| 458 | } | 456 | } |
| 459 | uint32_t blockNum = 0; | 457 | uint32_t blockNum = 0; |
| @@ -497,7 +495,7 @@ void CANNTraceDBDumper::AddTaskInfo(const std::shared_ptr<HostTask> &task, TaskI | |||
| 497 | opFlag, hashId, gridDim, blockDim); | 495 | opFlag, hashId, gridDim, blockDim); |
| 498 | return; | 496 | return; |
| 499 | } | 497 | } |
| 500 | - AddTensorShapeInfo(tensorDesc, nodeBasicInfo, data, task); | 498 | + AddTensorShapeInfo(tensorDesc, &nodeBasicInfo, data, task); |
| 501 | } | 499 | } |
| 502 | 500 | ||
| 503 | void CANNTraceDBDumper::DumpHcclTasks(const HostTasks &hcclTasks) | 501 | void CANNTraceDBDumper::DumpHcclTasks(const HostTasks &hcclTasks) |
| @@ -73,8 +73,9 @@ class CANNTraceDBDumper | |||
| 73 | void AddTaskInfo(const std::shared_ptr<HostTask> &task, TaskInfoData &data, bool isLevel0); | 73 | void AddTaskInfo(const std::shared_ptr<HostTask> &task, TaskInfoData &data, bool isLevel0); |
| 74 | void AddTaskInfoForOnlyTaskTrack(const std::shared_ptr<HostTask> &task, TaskInfoData &data, bool isLevel0); | 74 | void AddTaskInfoForOnlyTaskTrack(const std::shared_ptr<HostTask> &task, TaskInfoData &data, bool isLevel0); |
| 75 | 75 | ||
| 76 | - void AddTensorShapeInfo(const std::shared_ptr<ConcatTensorInfo> &tensorDesc, MsprofNodeBasicInfo nodeBasicInfo, | 76 | + void AddTensorShapeInfo(const std::shared_ptr<ConcatTensorInfo> &tensorDesc, |
| 77 | - TaskInfoData &data, const std::shared_ptr<HostTask> &task, bool isLevel0 = false); | 77 | + const MsprofNodeBasicInfo *nodeBasicInfo, TaskInfoData &data, |
| 78 | + const std::shared_ptr<HostTask> &task); | ||
| 78 | static void ProcessRuntimeTrackInfo(const std::shared_ptr<MsprofCompactInfo> &runtimeTrack, uint32_t &blockNum, | 79 | static void ProcessRuntimeTrackInfo(const std::shared_ptr<MsprofCompactInfo> &runtimeTrack, uint32_t &blockNum, |
| 79 | uint32_t &mixBlockNum, std::string &gridDimStr, std::string &blockDimStr); | 80 | uint32_t &mixBlockNum, std::string &gridDimStr, std::string &blockDimStr); |
| 80 | static std::string GetFormat(uint32_t oriFormat); | 81 | static std::string GetFormat(uint32_t oriFormat); |
| @@ -681,6 +681,7 @@ class TaskGear(CANNGear): | |||
| 681 | model_id = model_info[0] | 681 | model_id = model_info[0] |
| 682 | request_id = model_info[1] | 682 | request_id = model_info[1] |
| 683 | tensor_info_dto: TensorInfoDto = node_desc.tensor_info | 683 | tensor_info_dto: TensorInfoDto = node_desc.tensor_info |
| 684 | + has_tensor_info = tensor_info_dto.tensor_num is not None and tensor_info_dto.tensor_num > 0 | ||
| 684 | ctx_id_dto: CtxIdDto = node_desc.ctx_info | 685 | ctx_id_dto: CtxIdDto = node_desc.ctx_info |
| 685 | cxt_ids = str(ctx_id_dto.ctx_id).split(',') | 686 | cxt_ids = str(ctx_id_dto.ctx_id).split(',') |
| 686 | op_name = ctx_id_dto.op_name if ctx_id_dto.op_name else node_dto.item_id | 687 | op_name = ctx_id_dto.op_name if ctx_id_dto.op_name else node_dto.item_id |
| @@ -704,13 +705,13 @@ class TaskGear(CANNGear): | |||
| 704 | add_dto.thread_id, | 705 | add_dto.thread_id, |
| 705 | add_dto.timestamp, | 706 | add_dto.timestamp, |
| 706 | add_dto.batch_id, | 707 | add_dto.batch_id, |
| 707 | - tensor_info_dto.tensor_num, | 708 | + tensor_info_dto.tensor_num if has_tensor_info else None, |
W | |||
| 708 | - tensor_info_dto.input_formats, | 709 | + tensor_info_dto.input_formats if has_tensor_info else None, |
| 709 | - tensor_info_dto.input_data_types, | 710 | + tensor_info_dto.input_data_types if has_tensor_info else None, |
| 710 | - tensor_info_dto.input_shapes, | 711 | + tensor_info_dto.input_shapes if has_tensor_info else None, |
| 711 | - tensor_info_dto.output_formats, | 712 | + tensor_info_dto.output_formats if has_tensor_info else None, |
| 712 | - tensor_info_dto.output_data_types, | 713 | + tensor_info_dto.output_data_types if has_tensor_info else None, |
| 713 | - tensor_info_dto.output_shapes, | 714 | + tensor_info_dto.output_shapes if has_tensor_info else None, |
| 714 | add_dto.device_id, | 715 | add_dto.device_id, |
| 715 | int(cxt_id), | 716 | int(cxt_id), |
| 716 | Constant.NA, | 717 | Constant.NA, |
| @@ -798,6 +799,7 @@ class TaskGear(CANNGear): | |||
| 798 | op_flag = Constant.NA if (is_level0 or not op_info.is_valid) else ("YES" if op_info.op_flag else "NO") | 799 | op_flag = Constant.NA if (is_level0 or not op_info.is_valid) else ("YES" if op_info.op_flag else "NO") |
| 799 | 800 | ||
| 800 | if is_level0: | 801 | if is_level0: |
| 802 | + has_tensor_info = op_info.is_valid and op_info.tensor_num is not None and op_info.tensor_num > 0 | ||
| 801 | self.task_info.append( | 803 | self.task_info.append( |
| 802 | [ | 804 | [ |
| 803 | op_info.model_id, | 805 | op_info.model_id, |
| @@ -813,13 +815,13 @@ class TaskGear(CANNGear): | |||
| 813 | rts_trk.thread_id, | 815 | rts_trk.thread_id, |
| 814 | rts_trk.timestamp, | 816 | rts_trk.timestamp, |
| 815 | rts_trk.batch_id, | 817 | rts_trk.batch_id, |
| 816 | - None, | 818 | + op_info.tensor_num if has_tensor_info else None, |
| 817 | - None, | 819 | + op_info.input_formats if has_tensor_info else None, |
| 818 | - None, | 820 | + op_info.input_data_types if has_tensor_info else None, |
| 819 | - None, | 821 | + op_info.input_shapes if has_tensor_info else None, |
| 820 | - None, | 822 | + op_info.output_formats if has_tensor_info else None, |
| 821 | - None, | 823 | + op_info.output_data_types if has_tensor_info else None, |
| 822 | - None, | 824 | + op_info.output_shapes if has_tensor_info else None, |
| 823 | rts_trk.device_id, | 825 | rts_trk.device_id, |
| 824 | context_id, | 826 | context_id, |
| 825 | op_flag, | 827 | op_flag, |
| @@ -23,6 +23,7 @@ | |||||||||||
| 23 | 23 | ||||||||||
| 24 | 24 | ||||||||||
| 25 | 25 | ||||||||||
| 26 | + | ||||||||||
| 26 | 27 | ||||||||||
| 27 | 28 | ||||||||||
| 28 | using namespace Analysis::Utils; | 29 | using namespace Analysis::Utils; | ||||||||
| @@ -266,6 +267,11 @@ TEST_F(CannDBDumperUtest, TestCANNDumperShouldReturnTrueWhenComputeTaskDataIsL0T | |||||||||||
| 266 | EXPECT_EQ(std::get<TENSOR_NUM_POSITION>(taskInfoData[0]), 2); | 267 | EXPECT_EQ(std::get<TENSOR_NUM_POSITION>(taskInfoData[0]), 2); | ||||||||
| 267 | EXPECT_EQ(std::get<INPUT_SHAPE_POSITION>(taskInfoData[0]), "\"1,2,3\""); | 268 | EXPECT_EQ(std::get<INPUT_SHAPE_POSITION>(taskInfoData[0]), "\"1,2,3\""); | ||||||||
| 268 | EXPECT_EQ(std::get<OUTPUT_SHAPE_POSITION>(taskInfoData[0]), "\"4,5,6\""); | 269 | EXPECT_EQ(std::get<OUTPUT_SHAPE_POSITION>(taskInfoData[0]), "\"4,5,6\""); | ||||||||
| 270 | + EXPECT_EQ(std::get<6>(taskInfoData[0]), NA); | ||||||||||
| 271 | + EXPECT_EQ(std::get<7>(taskInfoData[0]), NA); | ||||||||||
| 272 | + EXPECT_EQ(std::get<8>(taskInfoData[0]), NA); | ||||||||||
| 273 | + EXPECT_EQ(std::get<22>(taskInfoData[0]), NA); | ||||||||||
| 274 | + EXPECT_EQ(std::get<23>(taskInfoData[0]), NA); | ||||||||||
| 269 | 275 | ||||||||||
| 270 | std::vector<std::tuple<uint32_t, uint32_t, std::string, std::string, uint32_t, std::string, | 276 | std::vector<std::tuple<uint32_t, uint32_t, std::string, std::string, uint32_t, std::string, | ||||||||
| 271 | double, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, | 277 | double, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, | ||||||||
| @@ -387,7 +393,7 @@ TEST_F(CannDBDumperUtest, TestAddTensorShapeInfoSuccess) | |||||||||||
| 387 | auto kernelDesc = std::make_shared<OpDesc>(); | 393 | auto kernelDesc = std::make_shared<OpDesc>(); | ||||||||
| 388 | auto kernelOp = std::make_shared<Operator>(kernelDesc, 0, OpType::OPTYPE_COMPUTE); | 394 | auto kernelOp = std::make_shared<Operator>(kernelDesc, 0, OpType::OPTYPE_COMPUTE); | ||||||||
| 389 | hostTaskPtr->op = kernelOp; | 395 | hostTaskPtr->op = kernelOp; | ||||||||
| 390 | - cannTraceDbDumper.AddTensorShapeInfo(tensorDescPtr, nodeBasicInfo, data, hostTaskPtr); | 396 | + cannTraceDbDumper.AddTensorShapeInfo(tensorDescPtr, &nodeBasicInfo, data, hostTaskPtr); | ||||||||
| 391 | EXPECT_EQ(std::get<13>(data[0]), 2); // 13 2 | 397 | EXPECT_EQ(std::get<13>(data[0]), 2); // 13 2 | ||||||||
| 392 | EXPECT_EQ(std::get<16>(data[0]), "\"1,2,3\""); | 398 | EXPECT_EQ(std::get<16>(data[0]), "\"1,2,3\""); | ||||||||
| 393 | EXPECT_EQ(std::get<19>(data[0]), "\"5,6,7\""); | 399 | EXPECT_EQ(std::get<19>(data[0]), "\"5,6,7\""); | ||||||||
| @@ -434,6 +440,28 @@ TEST_F(CannDBDumperUtest, TestAddTaskInfoWhenTypeIsReservedAndProfLevel0) | |||||||||||
| 434 | EXPECT_EQ(taskInfoData.size(), 1ul); | 440 | EXPECT_EQ(taskInfoData.size(), 1ul); | ||||||||
| 435 | } | 441 | } | ||||||||
| 436 | 442 | ||||||||||
| 443 | +TEST_F(CannDBDumperUtest, TestAddTaskInfoWhenTypeIsReservedAndProfLevel0WithTensorInfo) | ||||||||||
| 444 | +{ | ||||||||||
| 445 | + RuntimeOpInfo info{0, 2, 0, 0, 0, 2, 1, 4, NA, NA, "aclgraph_op", NA, NA, "NCHW", "FLOAT16", "\"1,2\"", | ||||||||||
| 446 | + "ND", "FLOAT32", "\"3,4\""}; | ||||||||||
| 447 | + MOCKER_CPP(&Analysis::Domain::Host::Cann::RTAddInfoCenter::Get).stubs().will(returnValue(info)); | ||||||||||
🟡 Medium Priority 新增测试用 19 参构造函数直接构造 RuntimeOpInfo: 被测试代码 失败链条:mock 返回 isValid=false 的 info → hasTensorInfo=false → 位置13(TENSOR_NUM_POSITION)实际写入 0、位置16/19 写入 "N/A" → 断言 建议:在构造 改动建议
![]() ![]() | |||||||||||
| 448 | + CANNTraceDBDumper cannTraceDbDumper(TEST_DB_FILE_PATH); | ||||||||||
| 449 | + auto hostTaskPtr = std::make_shared<HostTask>(); | ||||||||||
| 450 | + auto kernelDesc = std::make_shared<OpDesc>(); | ||||||||||
| 451 | + hostTaskPtr->op = std::make_shared<Operator>(kernelDesc, 0, OpType::OPTYPE_RESERVED); | ||||||||||
| 452 | + hostTaskPtr->kernelName = 1; | ||||||||||
| 453 | + hostTaskPtr->streamId = 1; | ||||||||||
| 454 | + hostTaskPtr->taskId = 2; | ||||||||||
| 455 | + CANNTraceDBDumper::TaskInfoData taskInfoData; | ||||||||||
| 456 | + | ||||||||||
| 457 | + cannTraceDbDumper.AddTaskInfo(hostTaskPtr, taskInfoData, true); | ||||||||||
| 458 | + | ||||||||||
| 459 | + ASSERT_EQ(taskInfoData.size(), 1ul); | ||||||||||
| 460 | + EXPECT_EQ(std::get<TENSOR_NUM_POSITION>(taskInfoData[0]), 2); | ||||||||||
| 461 | + EXPECT_EQ(std::get<INPUT_SHAPE_POSITION>(taskInfoData[0]), "\"1,2\""); | ||||||||||
| 462 | + EXPECT_EQ(std::get<OUTPUT_SHAPE_POSITION>(taskInfoData[0]), "\"3,4\""); | ||||||||||
| 463 | +} | ||||||||||
| 464 | + | ||||||||||
| 437 | TEST_F(CannDBDumperUtest, TestAddTaskInfoWhenTypeIsReservedAndProfLevel1) | 465 | TEST_F(CannDBDumperUtest, TestAddTaskInfoWhenTypeIsReservedAndProfLevel1) | ||||||||
| 438 | { | 466 | { | ||||||||
| 439 | CANNTraceDBDumper cannTraceDbDumper(TEST_DB_FILE_PATH); | 467 | CANNTraceDBDumper cannTraceDbDumper(TEST_DB_FILE_PATH); | ||||||||
| @@ -50,6 +50,7 @@ from profiling_bean.db_dto.hccl_op_info_dto import HCCLOpInfoDto | |||
| 50 | from profiling_bean.db_dto.mem_copy_info_dto import MemCopyInfoDto | 50 | from profiling_bean.db_dto.mem_copy_info_dto import MemCopyInfoDto |
| 51 | from profiling_bean.db_dto.node_attr_info_dto import NodeAttrInfoDto | 51 | from profiling_bean.db_dto.node_attr_info_dto import NodeAttrInfoDto |
| 52 | from profiling_bean.db_dto.node_basic_info_dto import NodeBasicInfoDto | 52 | from profiling_bean.db_dto.node_basic_info_dto import NodeBasicInfoDto |
| 53 | +from profiling_bean.db_dto.runtime_op_info_dto import RuntimeOpInfoDto | ||
| 53 | from profiling_bean.db_dto.task_track_dto import TaskTrackDto | 54 | from profiling_bean.db_dto.task_track_dto import TaskTrackDto |
| 54 | from profiling_bean.db_dto.tensor_info_dto import TensorInfoDto | 55 | from profiling_bean.db_dto.tensor_info_dto import TensorInfoDto |
| 55 | 56 | ||
| @@ -420,6 +421,34 @@ class TestCANNAnalysisGear(unittest.TestCase): | |||
| 420 | ge_info_db, DBNameConstant.TABLE_GE_TASK, 'output_shapes', '"3,4"')) | 421 | ge_info_db, DBNameConstant.TABLE_GE_TASK, 'output_shapes', '"3,4"')) |
| 421 | del InfoConfReader()._sample_json["profLevel"] | 422 | del InfoConfReader()._sample_json["profLevel"] |
| 422 | 423 | ||
| 424 | + def test_task_gear_should_save_runtime_tensor_info_for_aclgraph_in_prof_level0(self): | ||
| 425 | + gear = TaskGear(self.PROF_HOST_DIR) | ||
| 426 | + task_dto = TaskTrackDto() | ||
| 427 | + task_dto.device_id = 0 | ||
| 428 | + task_dto.stream_id = 1 | ||
| 429 | + task_dto.task_id = 2 | ||
| 430 | + task_dto.batch_id = 0 | ||
| 431 | + task_dto.thread_id = 3 | ||
| 432 | + task_dto.timestamp = 100 | ||
| 433 | + op_info = RuntimeOpInfoDto( | ||
| 434 | + is_valid=True, | ||
| 435 | + model_id=4, | ||
| 436 | + op_name="aclgraph_op", | ||
| 437 | + tensor_num=2, | ||
| 438 | + input_formats="NCHW", | ||
| 439 | + input_data_types="FLOAT16", | ||
| 440 | + input_shapes='"1,2"', | ||
| 441 | + output_formats="ND", | ||
| 442 | + output_data_types="FLOAT32", | ||
| 443 | + output_shapes='"3,4"', | ||
| 444 | + ) | ||
| 445 | + rt_add_info_center = RTAddInfoCenter("./test") | ||
| 446 | + | ||
| 447 | + with mock.patch.object(rt_add_info_center, "get_op_info_by_id", return_value=(4, op_info)): | ||
| 448 | + gear.add_kernel_task_only_task_track(task_dto, True) | ||
| 449 | + | ||
| 450 | + self.assertEqual(gear.task_info[0][13:20], [2, "NCHW", "FLOAT16", '"1,2"', "ND", "FLOAT32", '"3,4"']) | ||
| 451 | + | ||
| 423 | def test_task_gear_should_save_one_op_when_one_traditional_mode_node_event_FROM_PROF_LEVEL1(self): | 452 | def test_task_gear_should_save_one_op_when_one_traditional_mode_node_event_FROM_PROF_LEVEL1(self): |
| 424 | gear = TaskGear(self.PROF_HOST_DIR) | 453 | gear = TaskGear(self.PROF_HOST_DIR) |
| 425 | api_db = ApiDataDatabase(1) | 454 | api_db = ApiDataDatabase(1) |


[review] 当前分支是处理建树逻辑的l0的,需要确认aclGraph的流程,在建树层面的数据处理一致性。建议检查add_kernel_task_only_task_track方法的数据处理过程