LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/data - ccu_rep_bufread.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 90.5 % 21 19
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
       3              :  * Description: ccu representation implementation file
       4              :  * Author: sunzhepeng
       5              :  * Create: 2024-06-17
       6              :  */
       7              : 
       8              : #include "exception_util.h"
       9              : #include "ccu_api_exception.h"
      10              : #include "hcomm_c_adpt.h"
      11              : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
      12              : #include "ccu_ins_generater_base.h"
      13              : 
      14              : namespace hcomm {
      15              : namespace CcuRep {
      16              : 
      17            4 : CcuRepBufRead::CcuRepBufRead(CcuInsGeneraterBase* insGenPtr, const ChannelHandle channel, RemoteAddr src, CcuBuf dst, Variable len, CompletedEvent sem,
      18            4 :                              uint32_t mask)
      19            4 :     : insGenPtr(insGenPtr), channel(channel), src(src), dst(dst), len(len), sem(sem), mask(mask)
      20              : {
      21            4 :     type       = CcuRepType::BUF_READ;
      22            4 :     instrCount = insGenPtr->GetInstrCount(type);
      23            4 : }
      24              : 
      25            1 : bool CcuRepBufRead::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
      26              : {
      27            1 :     this->instrId = instrId;
      28            1 :     translated    = true;
      29              : 
      30            1 :     insGenPtr->CcuRepBufReadTranslate(ccuKernel, instr, this, dep);
      31            1 :     instrId += instrCount;
      32              : 
      33            1 :     return translated;
      34              : }
      35              : 
      36            1 : std::string CcuRepBufRead::Describe()
      37              : {
      38            1 :     void *channelPtr{nullptr};
      39            1 :     auto ret = HcommChannelGet(channel, &channelPtr);
      40            1 :     if (ret != HcclResult::HCCL_SUCCESS) {
      41            0 :         Hccl::THROW<Hccl::CcuApiException>("failed to get ccu channel, type[%d]", type);
      42              :     }
      43              : 
      44            1 :     auto *channelImpl = dynamic_cast<CcuUrmaChannel *>(static_cast<Channel *>(channelPtr));
      45            1 :     if (channelImpl == nullptr) {
      46            0 :         Hccl::THROW<Hccl::CcuApiException>("[%s] failed to cast channel[0x%llx] to CcuUrmaChannel",
      47              :             __func__, channel);
      48              :     }
      49              :     return Hccl::StringFormat("Read Rmt Mem[%u] To CcuBuf[%u], len[%u], ChannalId[%u], sem[%u], mask[%04x]",
      50            2 :                         src.addr.Id(), dst.Id(), len.Id(), channelImpl->GetChannelId(), sem.Id(), mask);
      51              : }
      52              : 
      53              : }; // namespace CcuRep
      54              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1