LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/interface - ccu_loopgroupcall.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 88.6 % 35 31
Test Date: 2026-08-04 10:52:23 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              : #include "ccu_rep.h"
      12              : #include "ccu_interface_assist.h"
      13              : 
      14              : #include "string_util.h"
      15              : #include "exception_util.h"
      16              : #include "ccu_api_exception.h"
      17              : namespace Hccl {
      18              : namespace CcuRep {
      19              : 
      20           34 : void LoopGroupCall::Run(const std::vector<LoopCall> &loopVec, const std::vector<Variable> &loopCfg,
      21              :                         const std::vector<Executor> &executors, Variable paraCfgIn, Variable offsetCfgIn) const
      22              : {
      23           34 :     Variable var1, var2;
      24           34 :     auto ret1 = CreateVariable(context, var1);
      25           34 :     auto ret2 = CreateVariable(context, var2);
      26           34 :     if (ret1 != HcclResult::HCCL_SUCCESS || ret2 != HcclResult::HCCL_SUCCESS) {
      27            0 :         THROW<CcuApiException>("CreateVariable failed. ret1[%d], ret2[%d]", ret1, ret2);
      28              :     }
      29              : 
      30           34 :     if (executors.size() < loopVec.size() || loopCfg.size() < loopVec.size()) {
      31            0 :         THROW<CcuApiException>("Executors size[%lu] or loopCfg size[%lu] is less than loopVec size", executors.size(), loopCfg.size());
      32              :     }
      33              : 
      34           34 :     auto loopGroup = std::make_shared<CcuRepLoopGroup>(var1, var2);
      35              : 
      36           34 :     std::vector<std::shared_ptr<CcuRepLoop>> loops;
      37           85 :     for (uint32_t index = 0; index < loopVec.size(); index++) {
      38           51 :         Variable repVar;
      39           51 :         auto ret3 = CreateVariable(context, repVar);
      40           51 :         if (ret3 != HcclResult::HCCL_SUCCESS) {
      41            0 :             THROW<CcuApiException>("CreateVariable failed. ret3[%d]", ret3);
      42              :         }
      43           51 :         auto repLoop = std::make_shared<CcuRepLoop>(loopVec[index].GetLabel(), repVar);
      44           51 :         AppendToContext(context, repLoop->SetLoopParam(executors[index], loopCfg[index]));
      45           51 :         loops.push_back(repLoop);
      46           51 :     }
      47              : 
      48           34 :     Variable hideLoopVar;
      49           34 :     auto ret4 = CreateVariable(context, hideLoopVar);
      50           34 :     if (ret4 != HcclResult::HCCL_SUCCESS) {
      51            0 :         THROW<CcuApiException>("CreateVariable failed. ret4[%d]", ret4);
      52              :     }
      53           34 :     auto hideLoop      = std::make_shared<CcuRepJump>("hideLoop", hideLoopVar);
      54           34 :     auto hideLoopLabel = std::make_shared<CcuRepJumpLabel>("hideLoop");
      55           34 :     hideLoop->Reference(hideLoopLabel);
      56              : 
      57           34 :     AppendToContext(context, loopGroup->SetParallelParam(paraCfgIn));
      58           34 :     AppendToContext(context, loopGroup->SetOffsetParam(offsetCfgIn));
      59           34 :     AppendToContext(context, loopGroup);
      60              : 
      61           34 :     AppendToContext(context, hideLoop);
      62           85 :     for (auto loop : loops) {
      63           51 :         AppendToContext(context, loop);
      64           51 :     }
      65           34 :     AppendToContext(context, hideLoopLabel);
      66           34 : }
      67              : 
      68              : }; // namespace CcuRep
      69              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1