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 "coll_aligned_reduce_scatter_v_double_ring_for_910_93_executor.h"
12 : #include <numeric>
13 :
14 : namespace hccl {
15 :
16 0 : CollAlignedReduceScatterVDoubleRingFor91093Executor::CollAlignedReduceScatterVDoubleRingFor91093Executor(
17 0 : const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher> &topoMatcher)
18 0 : : CollAlignedReduceScatterDoubleRingFor91093Executor(dispatcher, topoMatcher)
19 : {
20 0 : isReduceScatterV_ = true;
21 0 : desc_.level1SupportedAlgos = {
22 : AlgTypeLevel1::ALG_LEVEL1_NHR,
23 : AlgTypeLevel1::ALG_LEVEL1_NB,
24 : AlgTypeLevel1::ALG_LEVEL1_RING
25 0 : };
26 0 : }
27 :
28 0 : bool CollAlignedReduceScatterVDoubleRingFor91093Executor::IsUnifiedMarch(const OpParam ¶m) const
29 : {
30 : (void) param;
31 0 : return false;
32 : }
33 :
34 0 : u64 CollAlignedReduceScatterVDoubleRingFor91093Executor::CalcLoopMaxCount(const u32 unitSize)
35 : {
36 : // 中转内存单次最多能够接受的output count,这里不除以RankSize,因为每次循环可能会减少需要参与通信的Rank
37 0 : return inCCLbufferSize_ / HCCL_MIN_SLICE_ALIGN * HCCL_MIN_SLICE_ALIGN / unitSize;
38 : }
39 :
40 0 : bool CollAlignedReduceScatterVDoubleRingFor91093Executor::IsHugeData(const u64 curSize, OpParam *param)
41 : {
42 : u32 level2RankSize;
43 0 : if (algType_.algoLevel1 == AlgTypeLevel1::ALG_LEVEL1_AHC ||
44 0 : algType_.algoLevel1 == AlgTypeLevel1::ALG_LEVEL1_AHC_BROKE) {
45 : // AHC非对称场景下没有L2
46 0 : level2RankSize = 1;
47 : } else {
48 : // 多QP哈希散列开启且RDMA通信下,强制刷新子图
49 : // 这里如果CheckCommSize返回ERROR,相当于HugeData true,防止GetSubCommInfo越界
50 0 : CHK_RET(CheckCommSize(COMM_LEVEL2, COMM_INDEX_0 + 1));
51 0 : SubCommInfo level2CommInfo = GetSubCommInfo(COMM_LEVEL2, COMM_INDEX_0);
52 0 : level2RankSize = level2CommInfo.localRankSize;
53 0 : }
54 :
55 0 : const HcclDataType dataType = param->GetDataType();
56 0 : const u64 TBE_REDUCE_MAX_COUNT = INT32_MAX;
57 0 : u64 curCount = curSize / SIZE_TABLE[dataType];
58 0 : bool issupportRDMAInlineReduce = IsSupportRDMAReduce(dataType, param->reduceType);
59 0 : bool hugeData = (curSize * level2RankSize > RDMA_SEND_MAX_SIZE) || (curSize > SDMA_SEND_MAX_SIZE) ||
60 0 : ((!isSupportSDMAReduce_) && (curCount > TBE_REDUCE_MAX_COUNT)) ||
61 0 : ((!issupportRDMAInlineReduce) && (curCount * level2RankSize > TBE_REDUCE_MAX_COUNT));
62 0 : return hugeData;
63 : }
64 :
65 : REGISTER_EXEC("AlignedReduceScatterVDoubleRingFor91093Executor", AlignedReduceScatterVDoubleRingFor91093,
66 : CollAlignedReduceScatterVDoubleRingFor91093Executor);
67 : }
|