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

Generated by: LCOV version 2.0-1