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

Generated by: LCOV version 2.0-1