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

Generated by: LCOV version 2.0-1