LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/common - dev_capability.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 9 9
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 9 9

            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_DEV_CAPABILITY_H
      12              : #define HCCLV2_DEV_CAPABILITY_H
      13              : 
      14              : #include "dev_capability.h"
      15              : #include <map>
      16              : #include "dev_type.h"
      17              : #include "reduce_op.h"
      18              : #include "data_type.h"
      19              : 
      20              : namespace Hccl {
      21              : 
      22              : class DevCapability {
      23              : public:
      24              :     DevCapability(const DevCapability& that) = delete;
      25              : 
      26              :     DevCapability& operator=(const DevCapability& that) = delete;
      27              : 
      28              :     static DevCapability& GetInstance();
      29              : 
      30              :     void Init(DevType givenDevType);
      31              : 
      32              :     void Reset(); // LLT 使用
      33              : 
      34           17 :     const std::map<DataType, bool>& GetInlineReduceDataTypeMap() const { return inlineReduceDataTypeMap; }
      35              : 
      36           17 :     const std::map<ReduceOp, bool>& GetInlineReduceOpMap() const { return inlineReduceOpMap; }
      37              : 
      38            1 :     u32 GetSdmaInlineReduceAlignBytes() const { return sdmaInlineReduceAlignBytes; }
      39              : 
      40          136 :     u32 GetNotifySize() const { return notifySize; }
      41              : 
      42            1 :     u64 GetSdmaSendMaxSize() const { return sdmaSendMaxSize; }
      43              : 
      44            1 :     u64 GetRdmaSendMaxSize() const { return rdmaSendMaxSize; }
      45              : 
      46            7 :     bool IsSupportDevNetInlineReduce() const { return isSupportDevNetInlineReduce; }
      47              : 
      48            5 :     bool IsSupportWriteWithNotify() const { return isSupportWriteWithNotify; }
      49              : 
      50           11 :     bool IsSupportStarsPollNetCq() const { return isSupportStarsPollNetCq; }
      51              : 
      52              : private:
      53              :     DevCapability();
      54              : 
      55              :     void Load910ACap();
      56              :     void Load910A3Cap();
      57              :     void LoadV82Cap();
      58              : 
      59              :     void Load910A910A3CommonCap();
      60              : 
      61              :     DevType devType;
      62              :     bool isInit{false};
      63              : 
      64              :     std::map<DataType, bool> inlineReduceDataTypeMap;
      65              :     std::map<ReduceOp, bool> inlineReduceOpMap;
      66              : 
      67              :     u32 sdmaInlineReduceAlignBytes{0};
      68              :     u32 notifySize{0};
      69              : 
      70              :     u64 sdmaSendMaxSize{0}; // 节点内单个SDMA任务发送数据支持的最大数据量
      71              :     u64 rdmaSendMaxSize{0}; // 节点间RDMA发送数据单个WQE支持的最大数据量
      72              : 
      73              :     bool isSupportDevNetInlineReduce{false};
      74              :     bool isSupportWriteWithNotify{false};
      75              :     bool isSupportStarsPollNetCq{false};
      76              : };
      77              : 
      78              : } // namespace Hccl
      79              : #endif
        

Generated by: LCOV version 2.0-1