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

Generated by: LCOV version 2.0-1