LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/loop - ccu_rep_loopblock.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 78.1 % 32 25
Test Date: 2026-08-04 10:52:23 Functions: 85.7 % 7 6

            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_rep.h"
      12              : 
      13              : #include "string_util.h"
      14              : #include "exception_util.h"
      15              : #include "ccu_api_exception.h"
      16              : 
      17              : namespace Hccl {
      18              : namespace CcuRep {
      19              : 
      20           44 : CcuRepLoopBlock::CcuRepLoopBlock(const std::string &label) : CcuRepBlock(label)
      21              : {
      22           44 :     type = CcuRepType::LOOP_BLOCK;
      23           44 : }
      24              : 
      25           45 : std::string CcuRepLoopBlock::Describe()
      26              : {
      27          135 :     HCCL_INFO("Begin Describe LoopBlock[%s]", GetLabel().c_str());
      28           91 :     for (const auto &rep : GetReps()) {
      29          138 :         HCCL_INFO(" Rep: %s", rep->Describe().c_str());
      30              :     }
      31           45 :     return StringFormat("LoopBlock[%s]", GetLabel().c_str());
      32              : }
      33              : 
      34           36 : void CcuRepLoopBlock::DefineArg(Variable var)
      35              : {
      36           36 :     args.push_back(CcuRepArg(var));
      37          108 :     HCCL_INFO("Define Arg: Index[%u], Type[Variable], Id[%u]", args.size(), var.Id());
      38           36 : }
      39              : 
      40           38 : void CcuRepLoopBlock::DefineArg(Memory mem)
      41              : {
      42           38 :     args.push_back(CcuRepArg(mem));
      43          114 :     HCCL_INFO("Define Arg: Index[%u], Type[Memory], Id[%u]", args.size(), mem.addr.Id());
      44           38 : }
      45              : 
      46            0 : void CcuRepLoopBlock::DefineArg(const std::vector<Variable> varList)
      47              : {
      48            0 :     args.push_back(CcuRepArg(varList));
      49            0 :     HCCL_INFO("Define Arg: Index[%u], Type[Variable List]: ", args.size());
      50            0 :     for (uint32_t index = 0; index < varList.size(); index++) {
      51            0 :         HCCL_INFO("    Index[%u].Id[%u]", index, varList[index].Id());
      52              :     }
      53            0 : }
      54              : 
      55           30 : void CcuRepLoopBlock::DefineArg(const std::vector<Memory> memList)
      56              : {
      57           30 :     args.push_back(CcuRepArg(memList));
      58           90 :     HCCL_INFO("Define Arg: Index[%u], Type[Memory List]: ", args.size());
      59          270 :     for (uint32_t index = 0; index < memList.size(); index++) {
      60          720 :         HCCL_INFO("Index[%u].Id[%u]", index, memList[index].addr.Id());
      61              :     }
      62           30 : }
      63              : 
      64          117 : CcuRepArg &CcuRepLoopBlock::GetArg(uint16_t index)
      65              : {
      66          117 :     if (index >= args.size()) {
      67            0 :         THROW<CcuApiException>("CcuLoopBlock Arg Index[%u] Out of Range", index);
      68              :     }
      69          117 :     return args[index];
      70              : }
      71              : 
      72              : }; // namespace CcuRep
      73              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1