LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/selector - reduce_scatter_v_auto_selector.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 60 0
Test Date: 2026-08-17 10:19:35 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 "reduce_scatter_v_auto_selector.h"
      12              : #include "selector_registry.h"
      13              : #include "coll_operator.h"
      14              : 
      15              : namespace Hccl {
      16            0 : SelectorStatus ReduceScatterVAutoSelector::SelectCcuMsAlgo(
      17              :     const TopoInfo& topoInfo, const CollAlgOperator& op,
      18              :     const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
      19              : {
      20              :     (void)configAlgMap;
      21            0 :     HCCL_DEBUG("[ReduceScatterVAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
      22              : 
      23              :     // MS 模式不支持 int8
      24            0 :     CHK_PRT_RET(
      25              :         op.dataType == DataType::INT8,
      26              :         HCCL_WARNING(
      27              :             "[Algo][ReduceScatterVAutoSelector] dataType[%s] is not supported yet for ccu_ms mode.",
      28              :             op.dataType.Describe().c_str()),
      29              :         SelectorStatus::NOT_MATCH);
      30              : 
      31            0 :     if (topoInfo.levelNum > 1) {
      32            0 :         HCCL_WARNING("[Algo][ReduceScatterVAutoSelector] levelNum > 1 is not supported yet for ccu_ms mode.");
      33            0 :         return SelectorStatus::NOT_MATCH;
      34              :     } else {
      35            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
      36            0 :             if (Is2DieFullMesh()) {
      37            0 :                 HCCL_WARNING(
      38              :                     "[Algo][ReduceScatterVAutoSelector] 2DieFullMesh[%d] is not supported yet for ccu_ms mode.",
      39              :                     topoInfo.level0Shape);
      40            0 :                 return SelectorStatus::NOT_MATCH;
      41              :             } else {
      42            0 :                 primQueueGenName = "CcuReduceScatterVMesh1D";
      43              :             }
      44            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
      45            0 :             HCCL_WARNING(
      46              :                 "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu_ms mode.",
      47              :                 topoInfo.level0Shape);
      48            0 :             return SelectorStatus::NOT_MATCH;
      49            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_1D_CLOS) {
      50            0 :             if (IsLayerAllConnetedWithTopo(topoInfo, 0, TopoType::MESH_1D)) {
      51              :                 // MESH_1D 即可链接所有卡, 使用 MESH_1D 算法
      52            0 :                 primQueueGenName = "CcuReduceScatterVMesh1D";
      53            0 :             } else if (topoInfo.level0PcieMix) {
      54            0 :                 HCCL_WARNING(
      55              :                     "[Algo][ReduceScatterVAutoSelector] level0 PCIE mix is not supported yet for ccu_ms mode.");
      56            0 :                 return SelectorStatus::NOT_MATCH;
      57              :             } else { // MS 不支持
      58            0 :                 HCCL_WARNING(
      59              :                     "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu_ms mode.",
      60              :                     topoInfo.level0Shape);
      61            0 :                 return SelectorStatus::NOT_MATCH;
      62              :             }
      63            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
      64            0 :             HCCL_WARNING(
      65              :                 "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu_ms mode.",
      66              :                 topoInfo.level0Shape);
      67            0 :             return SelectorStatus::NOT_MATCH;
      68              :         } else {
      69            0 :             HCCL_WARNING(
      70              :                 "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu_ms mode.",
      71              :                 topoInfo.level0Shape);
      72            0 :             return SelectorStatus::NOT_MATCH;
      73              :         }
      74              :     }
      75            0 :     HCCL_INFO("[Algo][ReduceScatterVAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
      76            0 :     return SelectorStatus::MATCH;
      77              : }
      78              : 
      79            0 : SelectorStatus ReduceScatterVAutoSelector::SelectCcuScheduleAlgo(
      80              :     const TopoInfo& topoInfo, const CollAlgOperator& op,
      81              :     const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
      82              : {
      83            0 :     HCCL_DEBUG("[ReduceScatterVAutoSelector][%s] start, topoInfo levelNum[%u]", __func__, topoInfo.levelNum);
      84              : 
      85            0 :     if (topoInfo.levelNum > 1) {
      86            0 :         HCCL_WARNING("[Algo][ReduceScatterVAutoSelector] levelNum > 1 is not supported yet for ccu_schedule mode.");
      87            0 :         return SelectorStatus::NOT_MATCH;
      88              :     } else {
      89            0 :         if (topoInfo.level0Shape == Level0Shape::MESH_1D) {
      90            0 :             if (Is2DieFullMesh()) {
      91            0 :                 HCCL_WARNING(
      92              :                     "[Algo][ReduceScatterVAutoSelector] 2DieFullMesh is not supported yet for ccu schedule mode.");
      93            0 :                 return SelectorStatus::NOT_MATCH;
      94              :             } else {
      95            0 :                 primQueueGenName = "CcuReduceScatterVMeshMem2Mem1D";
      96              :             }
      97            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_2D) {
      98            0 :             HCCL_WARNING(
      99              :                 "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
     100              :                 topoInfo.level0Shape);
     101            0 :             return SelectorStatus::NOT_MATCH;
     102            0 :         } else if (topoInfo.level0Shape == Level0Shape::MESH_1D_CLOS) {
     103            0 :             if (IsLayerAllConnetedWithTopo(topoInfo, 0, TopoType::MESH_1D)) {
     104              :                 // MESH_1D 即可链接所有卡, 使用 MESH_1D 算法
     105            0 :                 primQueueGenName = "CcuReduceScatterVMeshMem2Mem1D";
     106            0 :             } else if (topoInfo.level0PcieMix) {
     107            0 :                 HCCL_WARNING(
     108              :                     "[Algo][ReduceScatterVAutoSelector] level0 PCIE mix is not supported yet for ccu schedule mode.");
     109            0 :                 return SelectorStatus::NOT_MATCH;
     110              :             } else {
     111            0 :                 HCCL_WARNING(
     112              :                     "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
     113              :                     topoInfo.level0Shape);
     114            0 :                 return SelectorStatus::NOT_MATCH;
     115              :             }
     116            0 :         } else if (topoInfo.level0Shape == Level0Shape::CLOS) {
     117            0 :             HCCL_WARNING(
     118              :                 "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
     119              :                 topoInfo.level0Shape);
     120            0 :             return SelectorStatus::NOT_MATCH;
     121              :         } else {
     122            0 :             HCCL_WARNING(
     123              :                 "[Algo][ReduceScatterVAutoSelector] level0Shape[%d] is not supported yet for ccu schedule mode.",
     124              :                 topoInfo.level0Shape);
     125            0 :             return SelectorStatus::NOT_MATCH;
     126              :         }
     127              :     }
     128              : 
     129            0 :     HCCL_INFO("[Algo][ReduceScatterVAutoSelector][%s] Algo match [%s]", __func__, primQueueGenName.c_str());
     130            0 :     return SelectorStatus::MATCH;
     131              : }
     132              : 
     133            0 : SelectorStatus ReduceScatterVAutoSelector::SelectAicpuAlgo(
     134              :     const TopoInfo& topoInfo, const CollAlgOperator& op,
     135              :     const std::map<OpType, std::vector<HcclAlgoType>>& configAlgMap, std::string& primQueueGenName) const
     136              : {
     137              :     (void)topoInfo;
     138              :     (void)op;
     139              :     (void)configAlgMap;
     140              :     (void)primQueueGenName;
     141              : 
     142              :     // 暂时没有 aicpu 算法
     143            0 :     HCCL_WARNING("[Algo][ReduceScatterVAutoSelector] No aicpu algorithm for aicpu mode. Auto select failed.");
     144            0 :     return SelectorStatus::NOT_MATCH;
     145              : }
     146              : 
     147              : REGISTER_SELECTOR_BY_OPTYPE(OpType::REDUCESCATTERV, 18, ReduceScatterVAutoSelector);
     148              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1