LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_scatter - coll_scatter_comm_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 45 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 4 0

            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 "coll_scatter_comm_executor.h"
      12              : 
      13              : namespace hccl {
      14            0 : CollScatterCommExecutor::CollScatterCommExecutor(
      15            0 :     const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher)
      16            0 :     : CollScatterExecutor(dispatcher, topoMatcher)
      17            0 : {}
      18              : 
      19            0 : HcclResult CollScatterCommExecutor::KernelRun(const OpParam& param, ExecMem& execMem)
      20              : {
      21            0 :     HCCL_CONFIG_INFO(HCCL_ALG, "[CollScatterCommExecutor] scatter starts.");
      22            0 :     DeviceMem& inputMem = execMem.inputMem;
      23            0 :     DeviceMem& outputMem = execMem.outputMem;
      24            0 :     u64 count = execMem.count;
      25            0 :     auto root = param.root;
      26            0 :     auto dataType = param.DataDes.dataType;
      27            0 :     Stream& stream = const_cast<Stream&>(param.stream);
      28            0 :     u32 userRank = topoAttr_.userRank;
      29              : 
      30            0 :     u32 commIndex = COMM_INDEX_0;
      31              :     // 统一走server间
      32            0 :     CommPlane commPlane = COMM_COMBINE;
      33            0 :     if (topoAttr_.deviceType == DevType::DEV_TYPE_910_93) {
      34            0 :         commPlane = COMM_COMBINE_ORDER;
      35              :     }
      36              : 
      37            0 :     CHK_RET(CheckCommSize(commPlane, COMM_INDEX_0 + 1));
      38            0 :     SubCommInfo combinedCommInfo = GetSubCommInfo(commPlane, COMM_INDEX_0);
      39              : 
      40            0 :     CHK_RET(KernelRunLevel1(inputMem, count, dataType, commIndex, root, userRank, commPlane, stream));
      41              : 
      42              :     // 将scratchMem赋值给outputMem
      43            0 :     u8* inputMemPtr = static_cast<u8*>(inputMem.ptr());
      44            0 :     CHK_PTR_NULL(inputMemPtr);
      45            0 :     DeviceMem resultMem(inputMemPtr + outputMem.size() * combinedCommInfo.localRank, outputMem.size());
      46            0 :     CHK_RET(HcclD2DMemcpyAsync(dispatcher_, outputMem, resultMem, stream));
      47            0 :     return HCCL_SUCCESS;
      48            0 : }
      49              : 
      50            0 : HcclResult CollScatterCommExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      51              : {
      52            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      53            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      54            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      55            0 :     CHK_RET(CalcCombinedCommInfo(inputType, outputType, opTransport));
      56            0 :     return HCCL_SUCCESS;
      57              : }
      58              : 
      59            0 : HcclResult CollScatterCommExecutor::CalcCombinedCommInfo(
      60              :     TransportMemType inputType, TransportMemType outputType, std::vector<LevelNSubCommTransport>& opTransport)
      61              : {
      62            0 :     CommPlane commPlane = COMM_COMBINE;
      63            0 :     if (topoAttr_.deviceType == DevType::DEV_TYPE_910_93) {
      64            0 :         commPlane = COMM_COMBINE_ORDER;
      65              :     }
      66              : 
      67            0 :     CommParaInfo commParaInfo(commPlane, CommType::COMM_TAG_MAX);
      68            0 :     if (algType_.algoLevel1 == AlgTypeLevel1::ALG_LEVEL1_NHR) {
      69            0 :         commParaInfo.commType = CommType::COMM_TAG_NONUNIFORM_HIERARCHICAL_RING;
      70            0 :     } else if (algType_.algoLevel1 == AlgTypeLevel1::ALG_LEVEL1_NB) {
      71            0 :         commParaInfo.commType = CommType::COMM_TAG_NONUNIFORM_BRUCK;
      72              :     } else {
      73            0 :         commParaInfo.commType = CommType::COMM_TAG_RING_INNER;
      74              :     }
      75            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaInfo, opTransport[commPlane], inputType, outputType));
      76            0 :     return HCCL_SUCCESS;
      77            0 : }
      78              : 
      79              : REGISTER_EXEC("ScatterCommExecutor", ScatterComm, CollScatterCommExecutor);
      80              : 
      81              : } // namespace hccl
        

Generated by: LCOV version 2.0-1