LCOV - code coverage report
Current view: top level - legacy/ascend910/framework/device/inc - task_exception.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef TASK_EXCEPTION_H
      12              : #define TASK_EXCEPTION_H
      13              : 
      14              : #include "hccl_types.h"
      15              : #include "hccl_common.h"
      16              : #include "aicpu_operator_pub.h"
      17              : #include "hcomm_diag.h"
      18              : 
      19              : namespace hccl {
      20              : constexpr u32 OP_INFO_MAX_SIZE = 2048;
      21              : struct IndOpInfo {
      22              :     uint8_t opInfo[OP_INFO_MAX_SIZE]{0};
      23              :     HcommGetOpInfoCallback callback = nullptr;
      24              :     uint32_t opIndex = 0; // 记录算子下发index
      25              : };
      26              : 
      27              : class TaskException {
      28              : public:
      29              :     TaskException();
      30              :     ~TaskException();
      31              : 
      32              :     HcclResult Init(u32 devId, u32 localUserRank, const std::string& identifier);
      33              :     HcclResult RegisterOpInfo(void* opInfo, u32 size);
      34              :     HcclResult RegisterOpInfoCallback(HcommGetOpInfoCallback callback);
      35              :     HcclResult PrintTaskException(Stream& stream);
      36              :     HcclResult PrintTaskExceptionByTaskId(u8 sqeType, u16 taskId, hccl::Stream& stream, u32 tail);
      37              : 
      38            0 :     inline u32 GetOpRingBufferIdx() const { return opRingBufferIdx_; }
      39              : 
      40              : private:
      41              :     std::string GetTaskExceptionTaskInfo(u32 sqHead, SqeRingBuffer* sqeContextBuffer);
      42              :     void PrintTaskExceptionTaskQue(u32 sqIdx, SqeRingBuffer* sqeContextBuffer); // 打印当前位置的前序task
      43              :     std::string GetTaskBriefsInfo(u32 idx, SqeRingBuffer* sqeContextBuffer);
      44              :     void PrintTaskExceptionOpInfo(IndOpInfo& indOp);
      45              : 
      46              :     bool IsRepeatPrint(u32 streamId, u32 opIndex, u32 sqHead);
      47              : 
      48              :     IndOpInfo indOpInfos_[OPINFO_RING_BUFFER_MAX];
      49              :     u32 opRingBufferIdx_ = OPINFO_RING_BUFFER_MAX - 1;
      50              :     u32 devId_ = 0;
      51              :     u32 localUserRank_ = 0;
      52              :     std::string identifier_;
      53              :     // streamId -> <opIndex, sqHead> : 记录每条流上一次打印taskException的opIndex和head,避免重复打印
      54              :     std::unordered_map<u32, std::pair<u32, u32>> threadPrintState_;
      55              : };
      56              : } // namespace hccl
      57              : #endif
        

Generated by: LCOV version 2.0-1