LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/sync - ccu_rep_rempostsem.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 18 18
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 "ccu_rep_v1.h"
      12              : #include "exception_util.h"
      13              : #include "ccu_api_exception.h"
      14              : #include "ccu_ins_generator_base.h"
      15              : #include "internal_exception.h"
      16              : 
      17              : namespace hcomm {
      18              : namespace CcuRep {
      19              : 
      20            7 :     CcuRepRemPostSem::CcuRepRemPostSem(
      21            7 :         CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, uint16_t semIndex, uint16_t mask)
      22            7 :         : insGenPtr(insGenPtr),
      23            7 :           channel(channel),
      24            7 :           semIndex(semIndex),
      25            7 :           mask(mask)
      26              :     {
      27            7 :         type = CcuRepType::REM_POST_SEM;
      28            7 :         instrCount = insGenPtr->GetInstrCount(type);
      29            7 :     }
      30              : 
      31            3 :     bool CcuRepRemPostSem::Translate(CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, const TransDep& dep)
      32              :     {
      33            3 :         this->instrId = instrId;
      34            3 :         translated = true;
      35              : 
      36            3 :         CHK_PRT_THROW(
      37              :             insGenPtr->CcuRepRemPostSemTranslate(ccuKernel, instr, this, dep) != HcclResult::HCCL_SUCCESS,
      38              :             HCCL_ERROR("[CcuRepRemPostSem][Translate] failed to translate for instrId[%u]", instrId),
      39              :             Hccl::CcuApiException, "CcuRepRemPostSem translate failed");
      40            3 :         CHK_PRT_THROW(
      41              :             (instrId > UINT16_MAX - instrCount),
      42              :             HCCL_ERROR(
      43              :                 "[CcuRepRemPostSem::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]",
      44              :                 instrId, instrCount),
      45              :             Hccl::InternalException, "integer overflow");
      46            3 :         instrId += instrCount;
      47              : 
      48            3 :         return translated;
      49              :     }
      50              : 
      51            3 :     std::string CcuRepRemPostSem::Describe()
      52              :     {
      53            3 :         return Hccl::StringFormat("Post, Use semIndex[%u] and mask[%04x]", semIndex, mask);
      54              :     }
      55              : 
      56              : }; // namespace CcuRep
      57              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1