LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective - coll_alg_params.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 50.0 % 10 5
Test Date: 2026-08-18 17:47:01 Functions: 50.0 % 2 1

            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              : #ifndef HCCLV2_COLL_ALG_PARAMS
      12              : #define HCCLV2_COLL_ALG_PARAMS
      13              : 
      14              : #include <string>
      15              : #include <vector>
      16              : #include "op_mode.h"
      17              : #include "types.h"
      18              : #include "virtual_topo.h"
      19              : 
      20              : namespace Hccl {
      21              : using CollAlgParams = struct CollAlgParamsDef {
      22              :     OpMode opMode;
      23              :     u64 maxTmpMemSize;
      24              :     u32 maxQueue;
      25              :     u32 maxLink;
      26              :     u32 maxDepQueuePairs;
      27              :     u64 dataSize;
      28              :     bool isMc2{false};
      29              :     OpExecuteConfig opExecuteConfig;
      30              :     std::string algConfig;
      31              : };
      32              : 
      33              : using ResRequirement = struct ResRequirementDef {
      34              :     std::string algName;
      35              :     std::vector<LinkData> links;
      36              :     u32 primQueueNum;
      37              :     std::vector<std::tuple<QId, QId, u32>> queueNotifys;
      38              : };
      39              : 
      40              : // 算法拓扑
      41              : using AlgTopoInfo = struct AlgTopoInfoDef {
      42              :     std::vector<std::vector<RankId>> virtRanks;          // 各级通信内包含的Ranks
      43              :     std::vector<std::map<RankId, u32>> virtRankMap;      // 为不保序的ReduceScatter和AllGather预留
      44              :     std::vector<std::vector<std::vector<RankId>>> vTopo; // 各级通信域内并行的包含本rank的各个通信平面
      45              : 
      46            1 :     void UpdateSingleLevelTopo(
      47              :         std::vector<RankId> tmpVirtRank, std::map<RankId, u32> tmpVirtRankMap,
      48              :         std::vector<std::vector<RankId>> tmpVTopo)
      49              :     {
      50            1 :         virtRanks.push_back(tmpVirtRank);
      51            1 :         virtRankMap.push_back(tmpVirtRankMap);
      52            1 :         vTopo.push_back(tmpVTopo);
      53            1 :     }
      54              : 
      55            0 :     void UpdateMultiLevelTopo(
      56              :         std::vector<std::vector<RankId>> tmpVirtRank, std::vector<std::map<RankId, u32>> tmpVirtRankMap,
      57              :         std::vector<std::vector<std::vector<RankId>>> tmpVTopo)
      58              :     {
      59            0 :         virtRanks = tmpVirtRank;
      60            0 :         virtRankMap = tmpVirtRankMap;
      61            0 :         vTopo = tmpVTopo;
      62            0 :     }
      63              : };
      64              : 
      65              : using CollAlgResReq = struct CollAlgResReqDef {
      66              :     std::vector<LinkData> links;
      67              :     u32 primQueueNum;
      68              :     std::vector<std::tuple<QId, QId, u32>> queueNotifys;
      69              :     AlgTopoInfo topoInfo;
      70              :     std::vector<std::pair<QId, u32>> localWaitGroupCntNotify;
      71              :     std::vector<std::pair<QId, u32>> localBcastPostCntNotify;
      72              :     std::vector<std::pair<u32, RankId>> levelRankPairs;
      73              : };
      74              : 
      75              : using CollAlgOpReq = struct CollAlgOpReqDef {
      76              :     std::string algName;
      77              :     CollAlgResReq resReq;
      78              : };
      79              : 
      80              : } // namespace Hccl
      81              : #endif // !HCCLV2_COLL_ALG_PARAMS
        

Generated by: LCOV version 2.0-1