LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/ccu/ccu_ins - ccu_ins_group.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 86.5 % 37 32
Test Date: 2026-08-18 17:47:01 Functions: 81.8 % 11 9

            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              : #include "ccu_ins_group.h"
      12              : 
      13              : namespace Hccl {
      14              : 
      15            1 : void CcuInsGroup::SetExecId(u64 id)
      16              : {
      17            2 :     for (auto& ins : ccuInstructions) {
      18            1 :         ins->SetExecId(id);
      19              :     }
      20              : 
      21            1 :     execId = id;
      22            1 : }
      23              : 
      24           17 : u64 CcuInsGroup::GetExecId() const { return execId; }
      25              : 
      26           22 : void CcuInsGroup::Append(std::unique_ptr<CcuInstruction> ins) { ccuInstructions.emplace_back(std::move(ins)); }
      27              : 
      28            2 : const std::vector<std::unique_ptr<CcuInstruction>>& CcuInsGroup::GetCcuInstructions() const { return ccuInstructions; }
      29              : 
      30            2 : CcuCtxSignature CcuInsGroup::GetCtxSignature() const
      31              : {
      32            6 :     HCCL_INFO("[CcuInsGroup::GetCtxSignature] start");
      33            2 :     CcuCtxSignature ctxSignature;
      34            4 :     for (auto& ins : ccuInstructions) {
      35            2 :         ctxSignature.Append(ins->GetCtxArg()->GetCtxSignature());
      36            6 :         HCCL_INFO(
      37              :             "[CcuInsGroup::GetCtxSignature] ins->GetCtxSignature()[%s], ctxSignature[%s]",
      38              :             ins->GetCtxSignature().Describe().c_str(), ctxSignature.Describe().c_str());
      39              :     }
      40            6 :     HCCL_INFO("[CcuInsGroup::GetCtxSignature] end, ctxSignature[%s]", ctxSignature.Describe().c_str());
      41            2 :     return ctxSignature;
      42            0 : }
      43              : 
      44            7 : std::string CcuInsGroup::Describe() const
      45              : {
      46            7 :     return StringFormat("CcuInsGroup[ccuInstructions_size=%zu, execId=%llu]", ccuInstructions.size(), execId);
      47              : }
      48              : 
      49            0 : CcuInstType CcuInsGroup::GetInstType() const { return CcuInstType::CCU_INS_GROUP; }
      50              : 
      51           10 : std::unique_ptr<CcuTaskArg> CcuInsGroup::GetTaskArg() const
      52              : {
      53           10 :     if (ccuInstructions.size() == 0) {
      54            1 :         THROW<InternalException>("[CcuInsGroup] size is 0");
      55              :     }
      56            9 :     return ccuInstructions[0]->GetTaskArg();
      57              : }
      58              : 
      59            1 : std::unique_ptr<CcuCtxArg> CcuInsGroup::GetCtxArg() const
      60              : {
      61            1 :     THROW<NotSupportException>("[CcuInsGroup] not support GetCtxArg");
      62              :     return nullptr;
      63              : }
      64              : 
      65            1 : std::vector<LinkData> CcuInsGroup::GetLinks() const
      66              : {
      67            1 :     vector<LinkData> links;
      68            2 :     for (const auto& ins : GetCcuInstructions()) {
      69            1 :         vector<LinkData> tmpLinks = ins->GetLinks();
      70            1 :         links.insert(links.end(), tmpLinks.begin(), tmpLinks.end());
      71            1 :     }
      72            3 :     HCCL_INFO("[CcuInsGroup][GetInsLinks] Get all ins ccuLinks of ccuInsGroup, links size[%zu]", links.size());
      73            1 :     return links;
      74            0 : }
      75              : 
      76            0 : RankGroup CcuInsGroup::GetRankGroup() const
      77              : {
      78            0 :     THROW<NotSupportException>("[CcuInsGroup]  not support GetRankGroup");
      79              :     return RankGroup();
      80              : }
      81              : 
      82              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1