LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/dfx/common - task_info.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 1 1

            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_INFO_H
      12              : #define TASK_INFO_H
      13              : #include <string>
      14              : #include <memory>
      15              : #include <functional>
      16              : #include "task_param.h"
      17              : #include "coll_operator.h"
      18              : 
      19              : namespace Hccl {
      20              : 
      21              : class DfxOpInfo {
      22              : public:
      23              :     CollOperator op_;
      24              :     std::string tag_; // 实际是opType
      25              :     std::string algType_;
      26              :     u32 commIndex_;
      27              :     u64 beginTime_;
      28              :     u64 endTime_;
      29              :     void* comm_{nullptr};
      30              :     bool isIndop_{false};
      31              :     std::string algTag_;
      32              :     std::string groupName_;
      33              :     u32 rankSize_{0};
      34              :     u32 cpuWaitAicpuNotifyId_{0};
      35              :     std::string commId_{};
      36              :     u32 opIndex_{0};           // 下发算子总计数(单算子/图模式/CCU快速下发)
      37              :     u64 headOpCounterAddr_{0}; // 执行算子头计数器地址(执行前加一)
      38              :     u64 tailOpCounterAddr_{0}; // 执行算子尾计数器地址(执行后加一)
      39              :     CommEngine engine{CommEngine::COMM_ENGINE_RESERVED};
      40              : 
      41              : public:
      42           14 :     std::string Describe() const
      43              :     {
      44              :         return StringFormat(
      45              :             "DfxOpInfo: [collOperator:[%s], tag:[%s], algType:[%s], commIndex:[%u], commId[%s], "
      46              :             "beginTime:[%llu], endTime:[%llu], opIndex[%u], headOpCounterAddr[%llx], "
      47              :             "tailOpCounterAddr[%llx], groupName[%s], rankSize[%u], myRank[%d], dataType[%s]]",
      48           28 :             CollOpToString(op_).c_str(), tag_.c_str(), algType_.c_str(), commIndex_, commId_.c_str(), beginTime_,
      49           28 :             endTime_, opIndex_, headOpCounterAddr_, tailOpCounterAddr_, groupName_.c_str(), rankSize_, op_.myRank,
      50           42 :             DataTypeToSerialString(static_cast<uint32_t>(op_.dataType)).c_str());
      51              :     }
      52              : };
      53              : 
      54              : class TaskInfo {
      55              : public:
      56              :     u32 streamId_;
      57              :     u32 taskId_;
      58              :     u32 remoteRank_{0xffffffff};
      59              :     TaskParam taskParam_;
      60              :     std::shared_ptr<DfxOpInfo> dfxOpInfo_;
      61              :     bool isMaster_;
      62              :     u64 channelHandle_{INVALID_U64};
      63              :     std::function<u32(u64)> getRemoteRankByHandle_{nullptr};
      64              : 
      65              : public:
      66              :     TaskInfo(
      67              :         u32 streamId, u32 taskId, u32 remoteRank, const TaskParam& taskParam,
      68              :         const std::shared_ptr<DfxOpInfo>& dfxOpInfo = nullptr, bool isMaster = false);
      69              : 
      70              :     std::string Describe() const;
      71              : 
      72              :     std::string GetAlgTypeName() const;
      73              :     std::string GetBaseInfo() const;
      74              :     std::string GetConciseBaseInfo() const;
      75              :     std::string GetParaInfo() const;
      76              :     std::string GetOpInfo() const;
      77              : 
      78              :     std::string GetIndopDataInfo() const;
      79              :     std::string GetIndopBaseInfo() const;
      80              :     u32 GetRemoteRankId() const;
      81              : 
      82              : private:
      83              :     std::string GetParaDMA() const;
      84              :     std::string GetParaReduce() const;
      85              :     std::string GetParaNotify() const;
      86              :     std::string GetParaAiv() const;
      87              :     std::string GetRemoteRankInfo(bool needConcise = false) const;
      88              :     std::string GetTaskConciseName() const;
      89              :     std::string GetNotifyInfo() const;
      90              :     std::string GetReduceOp() const;
      91              : };
      92              : 
      93              : void PrintTaskLog(u32 streamId, u32 taskId, const TaskParam& taskParam, u32 remoteRankId);
      94              : 
      95              : } // namespace Hccl
      96              : 
      97              : #endif
        

Generated by: LCOV version 2.0-1