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-17 10:19:35 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(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep)
      36              :     {
      37            6 :         this->instrId = instrId;
      38            6 :         translated = true;
      39              : 
      40            6 :         CHK_PRT_THROW(
      41              :             insGenPtr->CcuRepRemWaitSemTranslate(ccuKernel, instr, this) != HcclResult::HCCL_SUCCESS,
      42              :             HCCL_ERROR("[CcuRepRemWaitSem][Translate] failed to translate for instrId[%u]", instrId),
      43              :             Hccl::CcuApiException, "CcuRepRemWaitSem translate failed");
      44              : 
      45            6 :         CHK_PRT_THROW(
      46              :             instrId > UINT16_MAX - instrCount,
      47              :             HCCL_ERROR(
      48              :                 "[CcuRepRemWaitSem::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]",
      49              :                 instrId, instrCount),
      50              :             Hccl::InternalException, "integer overflow");
      51              : 
      52            6 :         instrId += instrCount;
      53              : 
      54            6 :         return translated;
      55              :     }
      56              : 
      57            6 :     std::string CcuRepRemWaitSem::Describe()
      58              :     {
      59            6 :         return Hccl::StringFormat("Wait, Use semIndex[%u] and mask[%04x]", semIndex, mask);
      60              :     }
      61              : 
      62              : }; // namespace CcuRep
      63              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1