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 HCCL_COMM_TYPES_H
12 : #define HCCL_COMM_TYPES_H
13 :
14 : #include "hccl_common.h"
15 :
16 : namespace hccl {
17 : constexpr u32 HCCL_RANK_SIZE_EQ_ONE = 1;
18 :
19 : enum CommPlane {
20 : COMM_LEVEL0 = 0, // 一级通信域(server内)
21 : COMM_LEVEL0_ANYPATH_RDMA, // anypath特性使用
22 : COMM_LEVEL1, // 二级通信域(server间)
23 : COMM_LEVEL1_ANYPATH_RDMA, // anypath特性使用
24 : COMM_LEVEL1_AHC, // AHC 二级通信域(server间)
25 : COMM_LEVEL2, // 三级通信域(超节点间)
26 : COMM_MESH_L0, // mesh内
27 : COMM_MESH_L1, // mesh间
28 : COMM_COMBINE, // 打平通信域,大ring环
29 : COMM_COMBINE_ORDER, // 打平通信域,按rank排序
30 : COMM_LEVEL0_ANYPATH_SDMA, // anypath特性使用
31 : COMM_LEVEL1_ANYPATH_SDMA, // anypath特性使用
32 : COMM_LEVEL0_LOGICAL, // 环内
33 : COMM_LEVEL1_LOGICAL, // 环间
34 : COMM_ARS, // 超节点内给ARS使用
35 : COMM_COMBINE_L1, // 超节点打平通信域
36 : COMM_LEVEL_RESERVED,
37 : };
38 :
39 : enum class CommType {
40 : COMM_TAG_RING_INNER = 0,
41 : COMM_TAG_RING_COMBINED,
42 : COMM_TAG_HALVING_DOUBLING,
43 : COMM_TAG_STAR,
44 : COMM_TAG_NONUNIFORM_HIERARCHICAL_RING,
45 : COMM_TAG_WHOLE_NHR,
46 : COMM_TAG_NONUNIFORM_HIERARCHICAL_RING_V1,
47 : COMM_TAG_WHOLE_NHR_V1,
48 : COMM_TAG_ASYMMETRIC_HIERARCHICAL_CONCATENATE,
49 : COMM_TAG_WHOLE_AHC,
50 : COMM_TAG_ASYMMETRIC_HIERARCHICAL_CONCATENATE_BROKE,
51 : COMM_TAG_WHOLE_AHC_BROKE,
52 : COMM_TAG_NONUNIFORM_BRUCK,
53 : COMM_TAG_WHOLE_NB,
54 : COMM_TAG_MESH_COMBINED,
55 : COMM_TAG_MESH,
56 : COMM_TAG_P2P,
57 : COMM_TAG_PARTIAL_MESH_COMBINED,
58 : COMM_TAG_HCCS_PLUS_SIO,
59 : COMM_TAG_MAX,
60 : };
61 :
62 : // 通信域建链信息
63 : struct CommParaInfo {
64 : CommPlane commPlane = COMM_LEVEL_RESERVED;
65 : CommType commType = CommType::COMM_TAG_MAX;
66 : u32 root = INVALID_VALUE_RANKID;
67 : u32 peerUserRank = INVALID_VALUE_RANKID;
68 : bool isAicpuModeEn = false;
69 : bool meshSinglePlane = false;
70 : std::set<u32> batchSendRecvtargetRanks;
71 : bool forceRdma = false;
72 :
73 4 : CommParaInfo() {}
74 209 : CommParaInfo(
75 : CommPlane commPlane, CommType commType, u32 root = INVALID_VALUE_RANKID,
76 : u32 peerUserRank = INVALID_VALUE_RANKID, bool isAicpuModeEn = false, bool meshSinglePlane = false,
77 : std::set<u32> batchSendRecvtargetRanks = std::set<u32>(), bool forceRdma = false)
78 209 : : commPlane(commPlane),
79 209 : commType(commType),
80 209 : root(root),
81 209 : peerUserRank(peerUserRank),
82 209 : isAicpuModeEn(isAicpuModeEn),
83 209 : meshSinglePlane(meshSinglePlane),
84 209 : batchSendRecvtargetRanks(batchSendRecvtargetRanks),
85 208 : forceRdma(forceRdma)
86 208 : {}
87 : };
88 : } // namespace hccl
89 : #endif
|