LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context/all_to_all - ccu_context_all_to_all_v_mesh2die.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 2 0

            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_V_MESH_2DIE_H_
      12              : #define HCCLV2_CCU_CONTEXT_ALL_TO_ALL_V_MESH_2DIE_H_
      13              : 
      14              : #include <vector>
      15              : #include <ios>
      16              : 
      17              : #include "log.h"
      18              : #include "ccu_context_alg_base.h"
      19              : #include "ccu_datatype.h"
      20              : #include "ccu_instruction_all_to_all_v_mesh2die.h"
      21              : 
      22              : namespace Hccl {
      23              : 
      24              : class CcuContextAllToAllVMesh2Die : public CcuContextAlgBase {
      25              : public:
      26              :     CcuContextAllToAllVMesh2Die(
      27              :         const CcuCtxArg& arg, const std::vector<CcuTransport*>& transports, const CcuTransportGroup& group);
      28            0 :     ~CcuContextAllToAllVMesh2Die() override {}
      29              : 
      30              :     void Algorithm() override;
      31              :     std::vector<uint64_t> GeneArgs(const CcuTaskArg& arg) override;
      32              : 
      33              : protected:
      34              :     // a2a 对每个对端的发送接收信息
      35              :     struct A2AVsingleSendRecvInfo {
      36              :         CcuRep::Variable sendOffset;
      37              :         CcuRep::Variable recvOffset;
      38              :         CcuRep::Variable sendTailSize; // 本rank给其他所有rank要发的尾块数据
      39              :         GroupOpSize sendTailGoSize;
      40              :         CcuRep::Variable sendLoopNum; // 本rank给其他所有rank要发的轮数
      41              :     };
      42              : 
      43              : private:
      44              :     void InitResources();
      45              :     void LoadArgs();
      46              :     void ExchangeInfoAndSync();
      47              :     void PostSync();
      48              : 
      49              :     void DoAll2AllVMultiLoop();
      50              :     void CalcGroupSrcDst();
      51              :     void LoopStep();
      52              :     uint32_t CalcDstRank(uint32_t peerId) const;
      53              :     uint32_t CalcTransIdx(uint32_t peerId) const;
      54              :     void GroupCopyToDstOutput(uint32_t peerId);
      55              :     void WriteToDstOutput(uint32_t peerId);
      56              : 
      57              :     static constexpr uint32_t RANK_EVEN = 2; // 只支持矩形rank分布
      58              :     static constexpr uint64_t MAX_TRANSPORT_SIZE = UB_MAX_TRANS_SIZE;
      59              : 
      60              :     static constexpr uint32_t GO_ADDR_OFFSET_IDX = 0;
      61              :     static constexpr uint32_t GO_LOOP_PARAM_IDX = 1;
      62              :     static constexpr uint32_t GO_PARALLEL_PARAM_IDX = 2;
      63              :     static constexpr uint32_t GO_RESIDUAL_IDX = 3;
      64              : 
      65              :     CcuRep::Variable input_;
      66              :     std::vector<CcuRep::Variable> output_;
      67              :     std::vector<CcuRep::Variable> token_;
      68              : 
      69              :     CcuRep::Variable xnConst1_;
      70              :     CcuRep::Variable completedRankCount_;
      71              :     CcuRep::Variable xnMaxTransportSize_;
      72              :     GroupOpSize xnMaxTransportGoSize_;
      73              :     CcuRep::Variable curSendTailSize_;
      74              :     GroupOpSize curSendTailGoSize_;
      75              :     std::vector<A2AVsingleSendRecvInfo> sendRecvInfo_;
      76              : 
      77              :     bool withMyRank_{false};
      78              :     uint32_t localSize_{0}; // 本rank所在DIE的总rank数
      79              :     uint32_t localId_{0};   // 本rank所在DIE的编号,固定放在末尾
      80              :     uint32_t peerSize_{0};
      81              :     uint32_t logicId_{0};
      82              :     std::vector<RankId> rankGroup_;
      83              : 
      84              :     std::vector<CcuRep::Memory> src_;
      85              :     std::vector<CcuRep::Memory> dst_;
      86              : 
      87              :     uint16_t selfBit_{0};
      88              :     uint16_t allBit_{0};
      89              : 
      90              :     // 在本地的搬运完成标记
      91              :     CcuRep::MaskSignal locSignal_;
      92              : };
      93              : } // namespace Hccl
      94              : 
      95              : #endif // HCCLV2_CCU_CONTEXT_ALL_TO_ALL_V_MESH_2DIE_H_
        

Generated by: LCOV version 2.0-1