Line data Source code
1 : /**
2 : * Copyright (c) 2026 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_CCU_CONTEXT_ALL_TO_ALL_MESH_1D_2DIE_H_
12 : #define HCCLV2_CCU_CONTEXT_ALL_TO_ALL_MESH_1D_2DIE_H_
13 :
14 : #include <vector>
15 : #include <ios>
16 : #include "log.h"
17 : #include "ccu_context_alg_base.h"
18 : #include "ccu_datatype.h"
19 : #include "ccu_assist.h"
20 :
21 : namespace Hccl {
22 :
23 : class CcuContextAllToAllMesh1D2Die : public CcuContextAlgBase {
24 : public:
25 : CcuContextAllToAllMesh1D2Die(
26 : const CcuCtxArg& arg, const std::vector<CcuTransport*>& transports, const CcuTransportGroup& group);
27 0 : ~CcuContextAllToAllMesh1D2Die() override {}
28 :
29 : void Algorithm() override;
30 : std::vector<uint64_t> GeneArgs(const CcuTaskArg& arg) override;
31 :
32 : private:
33 : uint16_t virRankSize{0};
34 : uint64_t logicRankSize{0};
35 : uint16_t selfBit{0};
36 : uint16_t allBit{0};
37 : std::vector<CcuRep::Variable> input_;
38 : std::vector<CcuRep::Variable> output_;
39 : std::vector<CcuRep::Variable> token_;
40 : bool withMyRank_ = true; // 发数据是否包含本rank
41 : std::vector<RankId> rankGroup_;
42 : CcuRep::Variable sliceSize_;
43 : CcuRep::Variable inputSliceStride_;
44 : CcuRep::Variable outputoffset_;
45 : CcuRep::Variable outBuffBaseOff_;
46 : GroupOpSize groupOpSize_;
47 : uint32_t signalNum_{0}; // 需要使用的signal数量
48 : uint16_t bitNumPerCKE_{0};
49 : void CreateLocalCopyLoop();
50 : void LocalCopyByLoopGroup(CcuRep::Memory dst, CcuRep::Memory src);
51 : void InitResource();
52 : void LoadArgs();
53 : void PreSync();
54 : void PostSync();
55 : uint32_t CalcDstRank(uint32_t peerId) const;
56 : void DoRepeatAllToAll();
57 : };
58 : } // namespace Hccl
59 :
60 : #endif // HCCLV2_CCU_CONTEXT_ALL_TO_ALL_MESH_1D_2DIE_H_
|