LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/sync - ccu_rep_remwaitgroup.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 84.6 % 26 22
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 3 3

            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              : 
      15              : namespace Hccl {
      16              : namespace CcuRep {
      17              : 
      18           50 :     CcuRepWaitGroup::CcuRepWaitGroup(
      19           50 :         const CcuTransportGroup& transportGroup, uint16_t semIndex, uint16_t mask, bool isProfiling)
      20           50 :         : transportGroup(transportGroup),
      21           50 :           semIndex(semIndex),
      22           50 :           mask(mask),
      23           50 :           isProfiling(isProfiling)
      24              :     {
      25           50 :         type = CcuRepType::REM_WAIT_GROUP;
      26           50 :         instrCount = 1;
      27           50 :     }
      28              : 
      29           16 :     bool CcuRepWaitGroup::Translate(CcuInstr*& instr, uint16_t& instrId, [[maybe_unused]] const TransDep& dep)
      30              :     {
      31           16 :         this->instrId = instrId;
      32           16 :         translated = true;
      33              : 
      34           16 :         u32 cntCkeId = 0;
      35           16 :         HcclResult ret = transportGroup.GetCntCkeId(semIndex, cntCkeId);
      36           16 :         if (ret != HcclResult::HCCL_SUCCESS) {
      37              :             string msg = StringFormat(
      38              :                 "[Translate]rt get CntCkeId failed. "
      39              :                 "semIndex[%u], cntCkeId[%u] return[%d].",
      40            0 :                 semIndex, cntCkeId, ret);
      41            0 :             MACRO_THROW(CcuApiException, msg);
      42            0 :         }
      43              :         // 需要profiling的使用SetCKEInstr, 否则使用ClearCKEInstr
      44           16 :         if (isProfiling) {
      45           16 :             SetCKEInstr(instr++, 0, 0, cntCkeId, mask, 1);
      46              :         } else {
      47            0 :             ClearCKEInstr(instr++, 0, 0, cntCkeId, mask, 1);
      48              :         }
      49           16 :         CHK_PRT_THROW(
      50              :             (instrId > UINT16_MAX - instrCount),
      51              :             HCCL_ERROR(
      52              :                 "[CcuRepWaitGroup::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]",
      53              :                 instrId, instrCount),
      54              :             InternalException, "integer overflow");
      55           16 :         instrId += instrCount;
      56              : 
      57           16 :         return translated;
      58              :     }
      59              : 
      60           16 :     std::string CcuRepWaitGroup::Describe()
      61              :     {
      62           16 :         return StringFormat("Wait, Use semIndex[%u] and mask[%04x]", semIndex, mask);
      63              :     }
      64              : 
      65              : }; // namespace CcuRep
      66              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1