LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/selector - alltoall_auto_selector.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 76 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 5 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 "alltoall_auto_selector.h"
      12              : #include "selector_registry.h"
      13              : #include "coll_operator.h"
      14              : 
      15              : namespace Hccl {
      16            0 : SelectorStatus AlltoAllAutoSelector::SelectCcuMsAlgo(
      17              :     const TopoInfo& topoInfo, const CollAlgOperator& op,
      18              :     const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
      19              : {
      20              :     (void)topoInfo;
      21              :     (void)op;
      22              :     (void)configAlgMap;
      23              :     (void)primQueueGenName;
      24            0 :     HCCL_WARNING("[Algo][AlltoAllAutoSelector] is not supported yet for ccu_ms mode, reset to default.");
      25            0 :     return SelectorStatus::NOT_MATCH;
      26              : }
      27              : 
      28            0 : SelectorStatus AlltoAllAutoSelector::SelectCcuScheduleAlgoLevel1(
      29              :     const TopoInfo& topoInfo, const CollAlgOperator& op, std::string& primQueueGenName) const
      30              : {
      31            0 :     if (isMc2_) {
      32            0 :         HCCL_WARNING("[Algo][AlltoAllAutoSelector] levelNum > 1 is not supported yet for ccu_schedule mode.");
      33            0 :         return SelectorStatus::NOT_MATCH;
      34              :     }
      35            0 :     if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
      36            0 :         if (topoInfo.netLayerDetails.localNetInsSizeOfLayer[0] == 1) {
      37            0 :             primQueueGenName = "CcuAlltoAllMesh1D";
      38              :         } else {
      39            0 :             if (op.dataType == DataType::INT8) {
      40            0 :                 HCCL_WARNING("[Algo][AlltoAllAutoSelector] int8 is not supported yet for ccu_schedule mode.");
      41            0 :                 return SelectorStatus::NOT_MATCH;
      42              :             }
      43            0 :             primQueueGenName = "CcuAllToAllMesh1D2Die";
      44              :         }
      45              :     } else {
      46            0 :         HCCL_WARNING(
      47              :             "[Algo][AlltoAllAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
      48              :             topoInfo.level0Shape);
      49            0 :         return SelectorStatus::NOT_MATCH;
      50              :     }
      51            0 :     return SelectorStatus::MATCH;
      52              : }
      53              : 
      54            0 : SelectorStatus AlltoAllAutoSelector::SelectCcuScheduleAlgo(
      55              :     const TopoInfo& topoInfo, const CollAlgOperator& op,
      56              :     const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
      57              : {
      58              :     (void)op;
      59              :     (void)configAlgMap;
      60            0 :     HCCL_DEBUG("[AlltoAllAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
      61              : 
      62            0 :     if (topoInfo.levelNum > 1) {
      63            0 :         SelectorStatus ret = SelectCcuScheduleAlgoLevel1(topoInfo, op, primQueueGenName);
      64            0 :         return ret;
      65              :     } else {
      66            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
      67            0 :             if (Is2DieFullMesh()) {
      68            0 :                 primQueueGenName = "CcuAllToAllMesh1D2Die";
      69              :             } else {
      70            0 :                 primQueueGenName = "CcuAlltoAllMesh1D";
      71              :             }
      72            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
      73            0 :             primQueueGenName = "CcuAlltoAllMesh2D";
      74            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_1D_CLOS) {
      75            0 :             if (IsLayerAllConnetedWithTopo(topoInfo, 0, TopoType::MESH_1D)) {
      76              :                 // MESH_1D 即可链接所有卡, 使用 MESH_1D 算法
      77            0 :                 if (Is2DieFullMesh()) {
      78            0 :                     primQueueGenName = "CcuAllToAllMesh1D2Die";
      79              :                 } else {
      80            0 :                     primQueueGenName = "CcuAlltoAllMesh1D";
      81              :                 }
      82            0 :             } else if (topoInfo.level0PcieMix) {
      83            0 :                 HCCL_WARNING(
      84              :                     "[Algo][AlltoAllAutoSelector] level0 PCIE mix is not supported yet for ccu schedule mode.");
      85            0 :                 return SelectorStatus::NOT_MATCH;
      86              :             } else {
      87            0 :                 HCCL_WARNING(
      88              :                     "[Algo][AlltoAllAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
      89              :                     topoInfo.level0Shape);
      90            0 :                 return SelectorStatus::NOT_MATCH;
      91              :             }
      92            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
      93            0 :             HCCL_WARNING(
      94              :                 "[Algo][AlltoAllAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
      95              :                 topoInfo.level0Shape);
      96            0 :             return SelectorStatus::NOT_MATCH;
      97              :         } else {
      98            0 :             HCCL_WARNING(
      99              :                 "[Algo][AlltoAllAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
     100              :                 topoInfo.level0Shape);
     101            0 :             return SelectorStatus::NOT_MATCH;
     102              :         }
     103              :     }
     104            0 :     HCCL_INFO("[Algo][AlltoAllAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
     105            0 :     return SelectorStatus::MATCH;
     106              : }
     107              : 
     108            0 : SelectorStatus AlltoAllAutoSelector::SelectAicpuAlgo(
     109              :     const TopoInfo& topoInfo, const CollAlgOperator& op,
     110              :     const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
     111              : {
     112              :     (void)op;
     113              :     (void)configAlgMap;
     114            0 :     HCCL_DEBUG("[AlltoAllAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
     115              : 
     116            0 :     if (topoInfo.levelNum > 1) {
     117            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
     118            0 :             primQueueGenName = "InsAlltoAllMesh";
     119            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
     120            0 :             primQueueGenName = "InsAlltoAllMesh";
     121            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
     122            0 :             primQueueGenName = "InsAlltoAllMesh";
     123              :         } else {
     124            0 :             return SelectorStatus::NOT_MATCH;
     125              :         }
     126              :     } else {
     127            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
     128            0 :             primQueueGenName = "InsAlltoAllMesh";
     129            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
     130            0 :             primQueueGenName = "InsAlltoAllMesh2D";
     131            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_1D_CLOS) {
     132            0 :             if (IsLayerAllConnetedWithTopo(topoInfo, 0, TopoType::MESH_1D)) {
     133              :                 // MESH_1D 即可链接所有卡, 使用 MESH_1D 算法
     134            0 :                 primQueueGenName = "InsAlltoAllMesh";
     135            0 :             } else if (topoInfo.level0PcieMix) {
     136            0 :                 primQueueGenName = "InsAlltoAllMesh";
     137              :             } else {
     138            0 :                 primQueueGenName = "InsAlltoAllMesh";
     139              :             }
     140            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
     141            0 :             primQueueGenName = "InsAlltoAllMesh";
     142              :         } else {
     143            0 :             HCCL_WARNING("[AlltoAllAutoSelector] topo not match");
     144            0 :             return SelectorStatus::NOT_MATCH;
     145              :         }
     146              :     }
     147            0 :     HCCL_INFO("[Algo][AlltoAllAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
     148            0 :     return SelectorStatus::MATCH;
     149              : }
     150              : 
     151            0 : SelectorStatus AlltoAllAutoSelector::SelectAivAlgo(
     152              :     const TopoInfo& topoInfo, const CollAlgOperator& op,
     153              :     const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
     154              : {
     155              :     (void)op;
     156              :     (void)configAlgMap;
     157            0 :     HCCL_DEBUG("[AlltoAllAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
     158              : 
     159              :     // aiv 直接走打平 mesh
     160            0 :     primQueueGenName = "AivAlltoAllMesh1D";
     161              : 
     162            0 :     HCCL_INFO("[Algo][AlltoAllAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
     163            0 :     return SelectorStatus::MATCH;
     164              : }
     165              : 
     166              : REGISTER_SELECTOR_BY_OPTYPE(OpType::ALLTOALL, 18, AlltoAllAutoSelector);
     167              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1