LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/impl/coll_executor/coll_all_to_all/310P - coll_all_to_all_v_for_310p_executor.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 61 0
Test Date: 2026-08-04 10:52:23 Functions: 0.0 % 8 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_all_to_all_v_for_310p_executor.h"
      12              : 
      13              : namespace hccl {
      14              : 
      15            0 : CollRunAlltoAllVFor310PExecutor::CollRunAlltoAllVFor310PExecutor(const HcclDispatcher dispatcher,
      16            0 :                                                    std::unique_ptr<TopoMatcher> &topoMatcher)
      17            0 :     : CollAlltoAllExecutor(dispatcher, topoMatcher)
      18              : {
      19            0 : }
      20              : 
      21            0 : HcclResult CollRunAlltoAllVFor310PExecutor::Orchestrate(OpParam& param, AlgResourceResponse& algRes)
      22              : {
      23            0 :     HcclUs startut = TIME_NOW();
      24            0 :     HcclResult ret = HCCL_SUCCESS;
      25            0 :     tag_ = param.tag;
      26            0 :     algResResp_ = &algRes;
      27            0 :     AlltoAllVParam_ = param;
      28            0 :     ExecMem execMem;
      29            0 :     execMem.count = 0;
      30            0 :     execMem.inputPtr = param.inputPtr;
      31            0 :     execMem.outputPtr = param.outputPtr;
      32            0 :     execMem.inputMem = algRes.cclInputMem;
      33            0 :     execMem.outputMem = algRes.cclOutputMem;
      34            0 :     ret = KernelRun(param, execMem);
      35              : 
      36            0 :     CHK_PRT_RET(ret != HCCL_SUCCESS,
      37              :         HCCL_ERROR("[CollRunAlltoAllVFor310PExecutor][Orchestrate]errNo[0x%016llx]executor run failed",
      38              :             HCCL_ERROR_CODE(ret)), ret);
      39              : 
      40            0 :     HCCL_INFO("tag[%s], AlltoAllVFor310P orchestrate success, take time [%lld]us.",
      41              :         param.tag.c_str(), DURATION_US(TIME_NOW() - startut));
      42            0 :     return HCCL_SUCCESS;
      43            0 : }
      44              : 
      45            0 : HcclOpMetaInfo CollRunAlltoAllVFor310PExecutor::GetOpMeta(HcclCMDType opType, const u64 size)
      46              : {
      47              :     (void)opType;
      48            0 :     HcclOpMetaInfoDef opMeta = HcclOpMetaInfo::GetOneForAllToAllV(CopyPattern::ZCOPY, size, true);
      49            0 :     return opMeta;
      50              : }
      51              : 
      52            0 : HcclResult CollRunAlltoAllVFor310PExecutor::CalcStreamNum(u32& streamNum)
      53              : {
      54            0 :     streamNum = 0U;
      55            0 :     if (topoAttr_.userRank % MINORS_NUM_TWO == 0) {
      56            0 :         streamNum = MINORS_NUM_TWO;
      57              :     } else {
      58            0 :         streamNum = 1;
      59              :     }
      60              : 
      61            0 :     HCCL_INFO("[CollRunAlltoAllVFor310PExecutor][CalcStreamNum] tag[%s] streamNum[%u]",
      62              :         tag_.c_str(), streamNum);
      63            0 :     return HCCL_SUCCESS;
      64              : }
      65              : 
      66            0 : HcclResult CollRunAlltoAllVFor310PExecutor::CalcLevel0CommInfo(TransportMemType inputType, TransportMemType outputType,
      67              :     std::vector<LevelNSubCommTransport>& opTransport)
      68              : {
      69            0 :     CommParaInfo commParaLevel0(COMM_LEVEL0, CommType::COMM_TAG_MESH);
      70            0 :     CHK_RET(CalcCommPlaneInfo(tag_, commParaLevel0, opTransport[COMM_LEVEL0], inputType, outputType));
      71            0 :     return HCCL_SUCCESS;
      72            0 : }
      73              : 
      74            0 : HcclResult CollRunAlltoAllVFor310PExecutor::CalcTransportMemType(TransportMemType &inputType, TransportMemType &outputType)
      75              : {
      76            0 :     inputType = TransportMemType::CCL_INPUT;
      77            0 :     outputType = TransportMemType::CCL_OUTPUT;
      78              : 
      79            0 :     HCCL_INFO("[CollRunAlltoAllVFor310PExecutor][CalcTransportMemType] tag[%s] inputType[%d], outputType[%d]",
      80              :         tag_.c_str(), inputType, outputType);
      81            0 :     return HCCL_SUCCESS;
      82              : }
      83              : 
      84            0 : HcclResult CollRunAlltoAllVFor310PExecutor::CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport)
      85              : {
      86            0 :     TransportMemType inputType = TransportMemType::RESERVED;
      87            0 :     TransportMemType outputType = TransportMemType::RESERVED;
      88              : 
      89            0 :     CHK_RET(CalcTransportMemType(inputType, outputType));
      90            0 :     CHK_RET(CalcLevel0CommInfo(inputType, outputType, opTransport));
      91            0 :     return HCCL_SUCCESS;
      92              : }
      93              : 
      94            0 : HcclResult CollRunAlltoAllVFor310PExecutor::KernelRun(const OpParam &param, ExecMem &execMem)
      95              : {
      96            0 :     HCCL_CONFIG_INFO(HCCL_ALG, "[CollRunAlltoAllVFor310PExecutor][KernelRun] AllToAll for 310p start.");
      97              : 
      98              :     // 获取通信域
      99            0 :     CHK_RET(CheckCommSize(COMM_LEVEL0, COMM_INDEX_0 + 1));
     100            0 :     SubCommInfo outerCommInfo = GetSubCommInfo(COMM_LEVEL0, COMM_INDEX_0);
     101              :     // 执行
     102            0 :     std::unique_ptr<AlgTemplateBase> executor = AlgTemplateRegistry::Instance().GetAlgTemplate(
     103            0 :         TemplateType::TEMPLATE_ALL_2_ALL_V_FOR310P, dispatcher_);
     104            0 :     CHK_SMART_PTR_NULL(executor);
     105            0 :     CHK_RET(executor->Prepare(algResResp_->paramInputMem, algResResp_->paramOutputMem, execMem.inputMem,
     106              :         execMem.outputMem, algResResp_->notifiesMain, algResResp_->notifiesAux,
     107              :         const_cast<Stream&>(param.stream), algResResp_->slaveStreams, outerCommInfo.links,
     108              :         topoAttr_.userRank, topoAttr_.userRankSize, allMeshAggregationSendRecvInfo_));
     109              : 
     110            0 :     u32 rankSize = outerCommInfo.localRankSize;
     111            0 :     CHK_RET(executor->RegisterProfiler((rankSize << PROF_RANKSIZE_OFFSET_OF_PLANEID) + outerCommInfo.localRank,
     112              :         PROF_STAGE_0, HCCL_EXEC_STEP_NOT_SET, param.stream));
     113              : 
     114            0 :     CHK_RET(executor->RunAsync());
     115              : 
     116            0 :     HCCL_INFO("[CollRunAlltoAllVFor310PExecutor] executor run success.");
     117            0 :     return HCCL_SUCCESS;
     118            0 : }
     119              : 
     120              : REGISTER_EXEC("RunAlltoAllVFor310PExecutor", AlltoAllVFor310P, CollRunAlltoAllVFor310PExecutor);
     121              : } // namespace hccl
        

Generated by: LCOV version 2.0-1