LCOV - code coverage report
Current view: top level - legacy/ascend950/service/collective/alg/coll_alg_factory/alg_ccu_context - ccu_context_alg_base.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 3 3
Test Date: 2026-07-28 12:11:00 Functions: 66.7 % 3 2

            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 HCCLV2_CCU_CONTEXT_ALG_BASE_H_
      12              : #define HCCLV2_CCU_CONTEXT_ALG_BASE_H_
      13              :  
      14              : #include <vector>
      15              : #include <ios>
      16              : #include "log.h"
      17              : #include "ccu_ctx.h"
      18              : #include "ccu_datatype.h"
      19              :  
      20              : namespace Hccl {
      21              :  
      22              : class CcuContextAlgBase : public CcuContext {
      23              : public:
      24            5 :     CcuContextAlgBase(const CcuCtxArg &arg, const std::vector<CcuTransport*> &transports,
      25            5 :                       const CcuTransportGroup &group) : CcuContext(arg, transports, group) {}
      26            9 :     ~CcuContextAlgBase() override {}
      27              :  
      28              :     // 子类实现
      29              :     void                  Algorithm() override = 0 ;
      30              :     std::vector<uint64_t> GeneArgs(const CcuTaskArg &arg) override = 0;
      31              :  
      32              : protected:
      33              :     uint64_t rankSize_{0};
      34              :     uint32_t rankId_{0};
      35              :     ReduceOp reduceOp_;
      36              : 
      37              :     struct GroupOpSizeV2 {
      38              :         CcuRep::Variable baseIterNum;
      39              :         CcuRep::Variable tailLoopId;
      40              :         CcuRep::Variable tail;
      41              :     };
      42              :  
      43              :     GroupOpSizeV2 CreateGroupOpSizeV2()
      44              :     {
      45              :         return GroupOpSizeV2{CreateVariable(), CreateVariable(), CreateVariable()};
      46              :     }
      47              :  
      48              :     void GroupBroadcastV2(const std::vector<CcuTransport*> &transports, const std::vector<CcuRep::Memory> &dst,
      49              :         const CcuRep::Memory &src, const GroupOpSizeV2 &goSize) const;
      50              :     void GroupReduceV2(const std::vector<CcuTransport*> &transports, const CcuRep::Memory& dst,
      51              :         const std::vector<CcuRep::Memory>& src, const GroupOpSizeV2 &goSize,
      52              :         DataType dataType, DataType outputDataType, ReduceOp reduceType) const;
      53              : };
      54              : } // namespace Hccl
      55              :  
      56              : #endif // HCCLV2_CCU_CONTEXT_ALG_BASE_H_
        

Generated by: LCOV version 2.0-1