LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/sync - ccu_rep_remwaitsem.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 19 19
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 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 "string_util.h"
      12              : #include "exception_util.h"
      13              : #include "hcomm_c_adpt.h"
      14              : #include "ccu_rep_v1.h"
      15              : #include "ccu_api_exception.h"
      16              : #include "ccu_ins_generator_v1.h"
      17              : #include "ccu_kernel.h"
      18              : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
      19              : 
      20              : namespace hcomm {
      21              : namespace CcuRep {
      22              : 
      23           11 :     CcuRepRemWaitSem::CcuRepRemWaitSem(
      24           11 :         CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, uint16_t semIndex, uint16_t mask, bool isProfiling)
      25           11 :         : insGenPtr(insGenPtr),
      26           11 :           channel(channel),
      27           11 :           semIndex(semIndex),
      28           11 :           mask(mask),
      29           11 :           isProfiling(isProfiling)
      30              :     {
      31           11 :         type = CcuRepType::REM_WAIT_SEM;
      32           11 :         instrCount = insGenPtr->GetInstrCount(type);
      33           11 :     }
      34              : 
      35            6 :     bool CcuRepRemWaitSem::Translate(
      36              :         CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, [[maybe_unused]] const TransDep& dep)
      37              :     {
      38            6 :         this->instrId = instrId;
      39            6 :         translated = true;
      40              : 
      41            6 :         CHK_PRT_THROW(
      42              :             insGenPtr->CcuRepRemWaitSemTranslate(ccuKernel, instr, this) != HcclResult::HCCL_SUCCESS,
      43              :             HCCL_ERROR("[CcuRepRemWaitSem][Translate] failed to translate for instrId[%u]", instrId),
      44              :             Hccl::CcuApiException, "CcuRepRemWaitSem translate failed");
      45              : 
      46            6 :         CHK_PRT_THROW(
      47              :             instrId > UINT16_MAX - instrCount,
      48              :             HCCL_ERROR(
      49              :                 "[CcuRepRemWaitSem::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]",
      50              :                 instrId, instrCount),
      51              :             Hccl::InternalException, "integer overflow");
      52              : 
      53            6 :         instrId += instrCount;
      54              : 
      55            6 :         return translated;
      56              :     }
      57              : 
      58            6 :     std::string CcuRepRemWaitSem::Describe()
      59              :     {
      60            6 :         return Hccl::StringFormat("Wait, Use semIndex[%u] and mask[%04x]", semIndex, mask);
      61              :     }
      62              : 
      63              : }; // namespace CcuRep
      64              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1