LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/data - ccu_rep_bufwrite.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 91.3 % 23 21
Test Date: 2026-08-04 10:52:23 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 "ccu_rep_v1.h"
       9              : #include "string_util.h"
      10              : #include "exception_util.h"
      11              : #include "ccu_api_exception.h"
      12              : #include "hcomm_c_adpt.h"
      13              : #include "ccu_ins_generator_v1.h"
      14              : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
      15              : #include "ccu_ins_generator_base.h"
      16              : #include "ccu_kernel.h"
      17              : 
      18              : namespace hcomm {
      19              : namespace CcuRep {
      20              : 
      21            6 : CcuRepBufWrite::CcuRepBufWrite(CcuInsGeneratorBase* insGenPtr, const ChannelHandle channel, CcuBuf src, RemoteAddr dst, Variable len, CompletedEvent sem,
      22            6 :                                uint16_t mask)
      23            6 :     : insGenPtr(insGenPtr), channel(channel), src(src), dst(dst), len(len), sem(sem), mask(mask)
      24              : {
      25            6 :     type       = CcuRepType::BUF_WRITE;
      26            6 :     instrCount = insGenPtr->GetInstrCount(type);
      27            6 : }
      28              : 
      29            1 : bool CcuRepBufWrite::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
      30              : {
      31            1 :     this->instrId = instrId;
      32            1 :     translated    = true;
      33              : 
      34            1 :     instrCount = insGenPtr->GetInstrCount(type);
      35            1 :     insGenPtr->CcuRepBufWriteTranslate(ccuKernel, instr, this, dep);
      36            1 :     instrId += instrCount;
      37              : 
      38            1 :     return translated;
      39              : }
      40              : 
      41            1 : std::string CcuRepBufWrite::Describe()
      42              : {
      43            1 :     void *channelPtr{nullptr};
      44            1 :     auto ret = HcommChannelGet(channel, &channelPtr);
      45            1 :     if (ret != HcclResult::HCCL_SUCCESS) {
      46            0 :         Hccl::THROW<Hccl::CcuApiException>("failed to get ccu channel, type[%d]", type);
      47              :     }
      48              : 
      49            1 :     auto *channelImpl = dynamic_cast<CcuUrmaChannel *>(static_cast<Channel *>(channelPtr));
      50            1 :     if (channelImpl == nullptr) {
      51            0 :         Hccl::THROW<Hccl::CcuApiException>("[%s] failed to cast channel[0x%llx] to CcuUrmaChannel",
      52              :             __func__, channel);
      53              :     }
      54            2 :     return Hccl::StringFormat("Write CcuBuf[%u] To Rmt Mem[%u], len[%u], ChannalId[%u], sem[%u], mask[%04x]", src.Id(),
      55            2 :                         dst.addr.Id(), len.Id(), channelImpl->GetChannelId(), sem.Id(), mask);
      56              : }
      57              : 
      58              : }; // namespace CcuRep
      59              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1