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 COLL_RUN_ALLTOALLV_DIRECT_FULLMESH_EXECUTOR_H
12 : #define COLL_RUN_ALLTOALLV_DIRECT_FULLMESH_EXECUTOR_H
13 : #include "coll_all_to_all_executor.h"
14 : namespace hccl {
15 : class CollRunAlltoAllDirectFullmesh : public CollAlltoAllExecutor {
16 : public:
17 : CollRunAlltoAllDirectFullmesh(const HcclDispatcher dispatcher, std::unique_ptr<TopoMatcher>& topoMatcher);
18 0 : ~CollRunAlltoAllDirectFullmesh() override = default;
19 : HcclResult Orchestrate(OpParam& param, AlgResourceResponse& algRes) override;
20 : HcclResult GetAdjInfo(AlgResourceResponse& algRes, AdjInfo& adjInfo) override;
21 :
22 : // 用于alltoallv算子的aicpu展开cache
23 : HcclResult MarkNeedAlltoallvCache() override;
24 : HcclResult
25 : GetHcclOffsetDstRanksMap(std::unordered_map<uint64_t, std::vector<uint32_t>>& hcclOffsetDstRanksMap) const override;
26 :
27 : private:
28 : HcclOpMetaInfo GetOpMeta(HcclCMDType opType, const u64 size) override;
29 : HcclResult CalcStreamNum(u32& streamNum) override;
30 : HcclResult CalcLevel0CommInfo(
31 : TransportMemType inputType, TransportMemType outputType,
32 : std::vector<LevelNSubCommTransport>& opTransport) override;
33 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
34 : HcclResult KernelRun(const OpParam& param, ExecMem& execMem) override;
35 : HcclResult Getlevel1CommRank(SubCommInfo& level1CommInfo) override;
36 : HcclResult SelectTempAlg(std::unique_ptr<AlgTemplateBase>& level1TempAlg, u32 level1RankSize) override;
37 : HcclResult GetDevNumInlocalPod(u32& devNumInlocalPod) override;
38 : HcclResult GetAlltoAllvTmpRankSendRecvInfo(const OpParam& param);
39 : HcclResult GetLocalSendRecvInfoforAlltoall(const OpParam& param);
40 : HcclResult GetLocalSendRecvInfoforAlltoallV(const OpParam& param);
41 : HcclResult GetLocalSendRecvInfoforAlltoallVC(const OpParam& param);
42 : HcclResult CalcTransportMemType(TransportMemType& inputType, TransportMemType& outputType);
43 : HcclResult GetLocalSDMAGroupInfo(const u32 userRank, u32& devNumInlocalPod, u32& rankIdxInPod);
44 :
45 : // 用于alltoallv算子的aicpu展开cache
46 : bool needAlltoallvCache_ = false; // 是否需要对当前alltoallv算子做aicpu cache
47 : std::unordered_map<uint64_t, std::vector<uint32_t>>
48 : hcclOffsetDstRanksMap_; // Local hccl input buffer中的local hccl offset到remote dst ranks的映射
49 : // (用于PrepareIntraData)
50 : };
51 : } // namespace hccl
52 : #endif
|