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