LCOV - code coverage report
Current view: top level - coll_communicator_mgr/common - hccl_independent_common.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 50.0 % 12 6
Test Date: 2026-08-18 17:47:01 Functions: 50.0 % 2 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 HCCL_INDEPENDENT_COMMON_H
      12              : #define HCCL_INDEPENDENT_COMMON_H
      13              : 
      14              : #include "hccl/hccl_res.h"
      15              : #include "hccl_common.h"
      16              : #include "hcomm_res_defs.h"
      17              : #include "hccl_mem_defs.h"
      18              : #ifdef __cplusplus
      19              : extern "C" {
      20              : #endif // __cplusplus
      21              : 
      22              : typedef enum {
      23              :     RANK_GRAPH_RESERVED = -1,
      24              :     RANK_GRAPH_910_93 = 0,
      25              :     RANK_GRAPH_910_95 = 1,
      26              : } GraphType;
      27              : 
      28              : typedef enum {
      29              :     NOTIFY_TYPE_RESERVED = -1,
      30              :     NOTIFY_TYPE_RTS_NOTIFY = 0,
      31              :     NOTIFY_TYPE_RTS_EVENT = 1,
      32              :     NOTIFY_TYPE_DEVICE_MEM = 2,
      33              : } NotifyType;
      34              : 
      35              : typedef uint64_t NotifyHandle;
      36              : 
      37              : typedef union {
      38              :     struct {
      39              :         uint64_t requireShare : 1;
      40              :         uint64_t rsvd : 63;
      41              :     };
      42              :     uint64_t value;
      43              : } HcclRegMemAttr;
      44              : 
      45              : typedef struct {
      46              :     HcclMemType type;
      47              :     void* addr;
      48              :     u64 size;
      49              : } CommBuffer;
      50              : 
      51              : extern HcclResult HcclGetNotifyNumInThread(HcclComm comm, ThreadHandle thread, CommEngine engine, uint32_t* notifyNum);
      52              : 
      53              : constexpr u32 NOTIFY_MAX_NUM = 2048;
      54           67 : inline bool IsValidCommEngine(CommEngine engine)
      55              : {
      56           67 :     switch (engine) {
      57           64 :         case COMM_ENGINE_CPU:
      58              :         case COMM_ENGINE_CPU_TS:
      59              :         case COMM_ENGINE_AICPU:
      60              :         case COMM_ENGINE_AICPU_TS:
      61              :         case COMM_ENGINE_AIV:
      62              :         case COMM_ENGINE_CCU:
      63           64 :             return true;
      64            3 :         default:
      65            3 :             return false;
      66              :     }
      67              : }
      68              : 
      69            0 : inline bool IsValidNotify(NotifyType notifyType)
      70              : {
      71            0 :     switch (notifyType) {
      72            0 :         case NOTIFY_TYPE_RESERVED:
      73              :         case NOTIFY_TYPE_RTS_NOTIFY:
      74              :         case NOTIFY_TYPE_RTS_EVENT:
      75              :         case NOTIFY_TYPE_DEVICE_MEM:
      76            0 :             return true;
      77            0 :         default:
      78            0 :             return false;
      79              :     }
      80              : }
      81              : 
      82              : #ifdef __cplusplus
      83              : }
      84              : #endif // __cplusplus
      85              : 
      86              : #endif
        

Generated by: LCOV version 2.0-1