LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/selector - alltoallv_auto_selector.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 58 0
Test Date: 2026-08-04 10:52:23 Functions: 0.0 % 3 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 "alltoallv_auto_selector.h"
      12              : #include "selector_registry.h"
      13              : #include "coll_operator.h"
      14              : 
      15              : namespace Hccl {
      16              : 
      17            0 : SelectorStatus AlltoAllVAutoSelector::SelectCcuScheduleAlgo(const TopoInfo &topoInfo,
      18              :                                                     const CollAlgOperator &op,
      19              :                                                     const std::map<OpType, std::vector<HcclAlgoType>> &configAlgMap,
      20              :                                                     std::string &primQueueGenName) const
      21              : {
      22              :     (void)op;
      23              :     (void)configAlgMap;
      24            0 :     HCCL_DEBUG("[AlltoAllVAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
      25              : 
      26            0 :     if (topoInfo.levelNum > 1) {
      27            0 :         HCCL_WARNING("[Algo][AlltoAllVAutoSelector] levelNum > 1 is not supported yet for ccu_ms mode.");
      28            0 :         return SelectorStatus::NOT_MATCH;
      29              :     } else {
      30            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
      31            0 :             if (Is2DieFullMesh()) {
      32            0 :                 primQueueGenName = "CcuAlltoAllVMesh2Die";
      33              :             } else {
      34            0 :                 primQueueGenName = "CcuAlltoAllVMesh1D";
      35              :             }
      36            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
      37            0 :             primQueueGenName = "CcuAlltoAllVMesh2D";
      38            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_1D_CLOS) {
      39            0 :             if (IsLayerAllConnetedWithTopo(topoInfo, 0, TopoType::MESH_1D)) {
      40              :                 // MESH_1D 即可链接所有卡, 使用 MESH_1D 算法
      41            0 :                 if (Is2DieFullMesh()) {
      42            0 :                     primQueueGenName = "CcuAlltoAllVMesh2Die";
      43              :                 } else {
      44            0 :                     primQueueGenName = "CcuAlltoAllVMesh1D";
      45              :                 }
      46            0 :             } else if (topoInfo.level0PcieMix) {
      47            0 :                 HCCL_WARNING("[Algo][AlltoAllVAutoSelector] level0 PCIE mix is not supported yet for ccu schedule mode.");
      48            0 :                 return SelectorStatus::NOT_MATCH;
      49              :             } else {
      50            0 :                 primQueueGenName = "CcuAlltoAllVMesh1D";
      51              :             }
      52            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
      53            0 :             HCCL_WARNING("[Algo][AlltoAllVAutoSelector] level0Shape[%d] is not supported yet for ccu_ms mode.",
      54              :                     topoInfo.level0Shape);
      55            0 :             return SelectorStatus::NOT_MATCH;
      56              :         } else {
      57            0 :             HCCL_WARNING("[Algo][AlltoAllVAutoSelector] level0Shape[%d] is not supported yet for ccu_ms mode.",
      58              :                     topoInfo.level0Shape);
      59            0 :             return SelectorStatus::NOT_MATCH;
      60              :         }
      61              :     }
      62            0 :     HCCL_INFO("[Algo][AlltoAllVAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
      63            0 :     return SelectorStatus::MATCH;
      64              : }
      65              : 
      66            0 : SelectorStatus AlltoAllVAutoSelector::SelectAicpuAlgo(const TopoInfo &topoInfo,
      67              :                                                       const CollAlgOperator &op,
      68              :                                                       const std::map<OpType, std::vector<HcclAlgoType>> &configAlgMap,
      69              :                                                       std::string &primQueueGenName) const
      70              : {
      71              :     (void)op;
      72              :     (void)configAlgMap;
      73            0 :     HCCL_DEBUG("[AlltoAllVAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
      74              : 
      75              :     // 目前只有 InsAlltoAllvMesh 算法
      76            0 :     if (topoInfo.levelNum > 1) {
      77            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
      78            0 :             primQueueGenName = "InsAlltoAllvMesh";
      79            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
      80            0 :             primQueueGenName = "InsAlltoAllvMesh";
      81            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
      82            0 :             primQueueGenName = "InsAlltoAllvMesh";
      83              :         } else {
      84            0 :             return SelectorStatus::NOT_MATCH;
      85              :         }
      86              :     } else {
      87            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
      88            0 :             primQueueGenName = "InsAlltoAllvMesh";
      89            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
      90            0 :             primQueueGenName = "InsAlltoAllvMesh";
      91            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_1D_CLOS) {
      92            0 :             if (IsLayerAllConnetedWithTopo(topoInfo, 0, TopoType::MESH_1D)) {
      93              :                 // MESH_1D 即可链接所有卡, 使用 MESH_1D 算法
      94            0 :                 primQueueGenName = "InsAlltoAllvMesh";
      95            0 :             } else if (topoInfo.level0PcieMix) {
      96            0 :                 primQueueGenName = "InsAlltoAllvMesh";
      97              :             } else {
      98            0 :                 primQueueGenName = "InsAlltoAllvMesh";
      99              :             }
     100            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
     101            0 :             primQueueGenName = "InsAlltoAllvMesh";
     102              :         } else {
     103            0 :             HCCL_WARNING("[AlltoAllVAutoSelector] topo not match");
     104            0 :             return SelectorStatus::NOT_MATCH;
     105              :         }
     106              :     }
     107            0 :     HCCL_INFO("[Algo][AlltoAllVAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
     108            0 :     return SelectorStatus::MATCH;
     109              : }
     110              : 
     111            0 : SelectorStatus AlltoAllVAutoSelector::SelectAivAlgo(const TopoInfo &topoInfo,
     112              :                                                     const CollAlgOperator &op,
     113              :                                                     const std::map<OpType, std::vector<HcclAlgoType>> &configAlgMap,
     114              :                                                     std::string &primQueueGenName) const
     115              : {
     116              :     (void)op;
     117              :     (void)configAlgMap;
     118            0 :     HCCL_DEBUG("[AlltoAllVAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
     119              : 
     120              :     // aiv 直接走打平 mesh
     121            0 :     primQueueGenName = "AivAlltoAllVMesh1D";
     122              : 
     123            0 :     HCCL_INFO("[Algo][AlltoAllVAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
     124            0 :     return SelectorStatus::MATCH;
     125              : }
     126              : 
     127              : REGISTER_SELECTOR_BY_OPTYPE(OpType::ALLTOALLV, 18, AlltoAllVAutoSelector);
     128              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1