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

            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_read_v1.h"
      12              : #include "ccu_rep_v1.h"
      13              : 
      14              : #include "string_util.h"
      15              : #include "exception_util.h"
      16              : #include "ccu_api_exception.h"
      17              : #include "hcomm_c_adpt.h"
      18              : 
      19              : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
      20              : #include "ccu_ins_generator_base.h"
      21              : #include "ccu_kernel.h"
      22              : 
      23              : namespace hcomm {
      24              : namespace CcuRep {
      25              : 
      26            8 :     CcuRepRead::CcuRepRead(
      27              :         CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, LocalAddr loc, RemoteAddr rem, Variable len,
      28            8 :         CompletedEvent sem, uint16_t mask)
      29            8 :         : insGenPtr(insGenPtr),
      30            8 :           channel(channel),
      31            8 :           loc(loc),
      32            8 :           rem(rem),
      33            8 :           len(len),
      34            8 :           sem(sem),
      35            8 :           mask(mask)
      36              :     {
      37            8 :         type = CcuRepType::READ;
      38            8 :         instrCount = insGenPtr->GetInstrCount(type);
      39            8 :     }
      40              : 
      41            3 :     CcuRepRead::CcuRepRead(
      42              :         CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, LocalAddr loc, RemoteAddr rem, Variable len,
      43            3 :         uint16_t dataType, uint16_t opType, CompletedEvent sem, uint16_t mask)
      44            3 :         : insGenPtr(insGenPtr),
      45            3 :           channel(channel),
      46            3 :           loc(loc),
      47            3 :           rem(rem),
      48            3 :           len(len),
      49            3 :           sem(sem),
      50            3 :           mask(mask),
      51            3 :           dataType(dataType),
      52            3 :           opType(opType),
      53            3 :           reduceFlag(1)
      54              :     {
      55            3 :         type = CcuRepType::READ;
      56            3 :         instrCount = insGenPtr->GetInstrCount(type);
      57            3 :     }
      58              : 
      59            4 :     bool CcuRepRead::Translate(
      60              :         CcuKernel* ccuKernel, CcuInstr*& instr, uint16_t& instrId, [[maybe_unused]] const TransDep& dep)
      61              :     {
      62            4 :         this->instrId = instrId;
      63            4 :         translated = true;
      64              : 
      65            4 :         CHK_PRT_THROW(
      66              :             insGenPtr->CcuRepReadTranslate(ccuKernel, instr, this) != HcclResult::HCCL_SUCCESS,
      67              :             HCCL_ERROR("[CcuRepRead][Translate] failed to translate for instrId[%u]", instrId), Hccl::CcuApiException,
      68              :             "CcuRepRead translate failed");
      69            4 :         instrId += instrCount;
      70              : 
      71            4 :         return translated;
      72              :     }
      73              : 
      74            5 :     std::string CcuRepRead::Describe()
      75              :     {
      76              :         return Hccl::StringFormat(
      77              :             "Read LocalAddr[%u] To RemoteAddr[%u], length[%u], set sem[%u] with mask[%04x], dataType[%u], opType[%u]",
      78            5 :             rem.addr.Id(), loc.addr.Id(), len.Id(), sem.Id(), mask, dataType, opType);
      79              :     }
      80              : 
      81              : }; // namespace CcuRep
      82              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1