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 GetHcclOffsetDstRanksMap(std::unordered_map<uint64_t, std::vector<uint32_t>>& hcclOffsetDstRanksMap) const override;
25 : private:
26 : HcclOpMetaInfo GetOpMeta(HcclCMDType opType, const u64 size) override;
27 : HcclResult CalcStreamNum(u32& streamNum) override;
28 : HcclResult CalcLevel0CommInfo(TransportMemType inputType, TransportMemType outputType,
29 : std::vector<LevelNSubCommTransport>& opTransport) override;
30 : HcclResult CalcCommInfo(std::vector<LevelNSubCommTransport>& opTransport) override;
31 : HcclResult KernelRun(const OpParam ¶m, ExecMem &execMem) override;
32 : HcclResult Getlevel1CommRank(SubCommInfo& level1CommInfo) override;
33 : HcclResult SelectTempAlg(std::unique_ptr<AlgTemplateBase> &level1TempAlg, u32 level1RankSize) override;
34 : HcclResult GetDevNumInlocalPod(u32& devNumInlocalPod) override;
35 : HcclResult GetAlltoAllvTmpRankSendRecvInfo(const OpParam ¶m);
36 : HcclResult GetLocalSendRecvInfoforAlltoall(const OpParam ¶m);
37 : HcclResult GetLocalSendRecvInfoforAlltoallV(const OpParam ¶m);
38 : HcclResult GetLocalSendRecvInfoforAlltoallVC(const OpParam ¶m);
39 : HcclResult CalcTransportMemType(TransportMemType &inputType, TransportMemType &outputType);
40 : HcclResult GetLocalSDMAGroupInfo(const u32 userRank, u32& devNumInlocalPod, u32& rankIdxInPod);
41 :
42 : // 用于alltoallv算子的aicpu展开cache
43 : bool needAlltoallvCache_ = false; // 是否需要对当前alltoallv算子做aicpu cache
44 : std::unordered_map<uint64_t, std::vector<uint32_t>> hcclOffsetDstRanksMap_; // Local hccl input buffer中的local hccl offset到remote dst ranks的映射 (用于PrepareIntraData)
45 : };
46 : } // namespace hccl
47 : #endif
|