LCOV - code coverage report
Current view: top level - legacy/ascend910/algorithm/base/alg_template - nonuniform_hierarchical_ring_base_pub.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 1 1

            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 NONUNIFORM_HIERARCHICAL_RING_BASE_PUB_H
      12              : #define NONUNIFORM_HIERARCHICAL_RING_BASE_PUB_H
      13              : 
      14              : #include <cmath>
      15              : #include "alg_template_base_pub.h"
      16              : 
      17              : namespace hccl {
      18              : 
      19              : using InterServerAlgoStep = struct InterServerAlgoStepDef {
      20              :     u32 step = 0;
      21              :     u32 myRank = 0;
      22              : 
      23              :     u32 nSlices;
      24              :     u32 toRank = 0;
      25              :     u32 fromRank = 0;
      26              :     std::vector<u32> txSliceIdxs;
      27              :     std::vector<u32> rxSliceIdxs;
      28              : 
      29           18 :     InterServerAlgoStepDef() : nSlices(0) {}
      30              : };
      31              : 
      32              : class NHRBase : public AlgTemplateBase {
      33              : public:
      34              :     explicit NHRBase(const HcclDispatcher dispatcher);
      35              :     ~NHRBase() override;
      36              : 
      37              :     void GetRankMapping(const u32 rankSize, bool keepOrder = false);
      38              : 
      39              :     void FetchRankMapping(std::vector<u32>& sliceMap);
      40              : 
      41              :     void MergeSlices(std::vector<Slice>& slices);
      42              : 
      43              : protected:
      44              :     void ReorderSequence(u32 start, u32 end, u32 len, std::vector<u32>& tree, std::vector<u32>& tmp);
      45              : 
      46              :     u32 GetStepNumInterServer(u32 rankSize);
      47              : 
      48              :     virtual HcclResult GetStepInfo(u32 step, u32 nSteps, u32 rank, u32 rankSize, InterServerAlgoStep& stepInfo);
      49              : 
      50              :     HcclResult ExecuteBarrier(const std::shared_ptr<Transport>& preLink, const std::shared_ptr<Transport>& aftLink);
      51              : 
      52              :     std::vector<u32> sliceMap_;
      53              : 
      54              :     bool isNeedMerge = false;
      55              : 
      56              : private:
      57              : };
      58              : } // namespace hccl
      59              : 
      60              : #endif /* NONUNIFORM_HIERARCHICAL_RING_BASE_PUB_H */
        

Generated by: LCOV version 2.0-1