LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/base/alg_template/temp_alltoallv - alltoallv_staged_base.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 44.4 % 27 12
Test Date: 2026-07-28 12:11:00 Functions: 60.0 % 5 3

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 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 "alltoallv_staged_base.h"
      12              : #include "log.h"
      13              : 
      14              : namespace hccl {
      15              : using namespace std;
      16              : 
      17            2 : AlltoAllVStagedBase::AlltoAllVStagedBase(const HcclDispatcher dispatcher)
      18            2 :     : AlgTemplateBase(dispatcher)
      19              : {
      20            2 : }
      21              : 
      22            2 : AlltoAllVStagedBase::~AlltoAllVStagedBase() {}
      23              : 
      24            3 : HcclResult AlltoAllVStagedBase::Prepare(DeviceMem &sendMem, DeviceMem &recvMem, StageAlltoAllVAddrInfo& sendAddrInfo,
      25              :     StageAlltoAllVAddrInfo& recvAddrInfo, bool isAlltoAllZCopyMode, Stream &mainStream)
      26              : {
      27            3 :     sendMem_ = sendMem;
      28            3 :     recvMem_ = recvMem;
      29            3 :     sendAddrInfo_ = sendAddrInfo;
      30            3 :     recvAddrInfo_ = recvAddrInfo;
      31            3 :     isAlltoAllZCopyMode_ = isAlltoAllZCopyMode;
      32            3 :     mainStreamPtr_ = &mainStream;
      33            3 :     return HCCL_SUCCESS;
      34              : }
      35              : 
      36            0 : HcclResult AlltoAllVStagedBase::LocalCopy(u32 rank)
      37              : {
      38            0 :     if (sendAddrInfo_.find(rank) == sendAddrInfo_.end()) {
      39            0 :         HCCL_ERROR("[AlltoAllVStaged][LocalCopy] Invalid Rank[%u]", rank);
      40            0 :         return HCCL_E_INTERNAL;
      41              :     }
      42              : 
      43            0 :     for (auto it = sendAddrInfo_[rank].begin(); it != sendAddrInfo_[rank].end(); it++) {
      44            0 :         u8 *dstAddr = static_cast<u8 *>(recvMem_.ptr()) + it->remoteOffset;
      45            0 :         u64 destMax = it->remoteLength;
      46            0 :         u8 *srcAddr = static_cast<u8 *>(sendMem_.ptr()) + it->localOffset;
      47            0 :         u64 size = it->localLength;
      48            0 :         DeviceMem dst = DeviceMem::create(dstAddr, destMax);
      49            0 :         DeviceMem src = DeviceMem::create(srcAddr, size);
      50              : 
      51            0 :         HCCL_DEBUG(
      52              :             "[AlltoAllVStagedPairwise][LocalCopy]: Rank[%u] destAddr[%p], destMax[%llu], srcAddr[%p], size[%llu]", rank,
      53              :             dstAddr, destMax, srcAddr, size);
      54            0 :         CHK_RET(HcclD2DMemcpyAsync(dispatcher_, dst, src, *mainStreamPtr_));
      55            0 :     }
      56              : 
      57            0 :     return HCCL_SUCCESS;
      58              : }
      59              : } 
        

Generated by: LCOV version 2.0-1