LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/resource/connection/aicpu - udma_data_struct.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-08-04 10:52:23 Functions: 100.0 % 4 4

            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              : #ifndef HCCLV2_AICPU_WQEMGR_WQE_H
      11              : #define HCCLV2_AICPU_WQEMGR_WQE_H
      12              :  
      13              : #include <string>
      14              : #include "string_util.h"
      15              : #include "hccl/base.h"
      16              : #include "enum_factory.h"
      17              : 
      18              : namespace Hccl {
      19              : 
      20              : #define UDMA_SQE_RMT_EID_SIZE 4
      21              : 
      22          312 : MAKE_ENUM(UdmaSqOpcode,
      23              :         UDMA_OPC_SEND,
      24              :         UDMA_OPC_SEND_WITH_IMM,
      25              :         UDMA_OPC_SEND_WITH_INVALID,
      26              :         UDMA_OPC_WRITE,
      27              :         UDMA_OPC_WRITE_WITH_IMM,
      28              :         UDMA_OPC_READ = 0x6,
      29              :         UDMA_OPC_CAS,
      30              :         UDMA_OPC_FAA = 0xb,
      31              :         UDMA_OPC_NOP = 0x11,
      32              :         UDMA_OPC_INVALID = 0x12
      33              :         )
      34              : 
      35              : MAKE_ENUM(UdmaDataOp,
      36              :         REDUCE_OP_MAX = 0x8,
      37              :         REDUCE_OP_MIN = 0x9,
      38              :         REDUCE_OP_ADD = 0xA,
      39              :         REDUCE_OP_EQUAL = 0xB,
      40              :         REDUCE_OP_RESEVERD = 0xC
      41              :         )
      42              : 
      43              : MAKE_ENUM(UdmaDataType,
      44              :         REDUCE_TYPE_INT8        = 0x0,
      45              :         REDUCE_TYPE_INT16       = 0X1,
      46              :         REDUCE_TYPE_INT32       = 0x2,
      47              :         REDUCE_TYPE_UINT32      = 0X5,
      48              :         REDUCE_TYPE_FP16_NORMAL = 0X6,
      49              :         REDUCE_TYPE_FP32        = 0X7,
      50              :         REDUCE_TYPE_FP16        = 0X8,
      51              :         REDUCE_TYPE_FP16_SAT    = 0X9,
      52              :         REDUCE_TYPE_RESEVERD    = 0XA
      53              :         )
      54              : 
      55              : struct UdmaNormalSge {
      56              :     uint32_t length;
      57              :     uint32_t tokenId;
      58              :     uint32_t dataAddrLow;
      59              :     uint32_t dataAddrHigh;
      60              : 
      61              :     std::string Desc() const
      62              :     {
      63              :         return StringFormat("length = %u dataAddrLow = %u dataAddrHigh = %u",
      64              :                     length, dataAddrLow, dataAddrHigh);
      65              :     }
      66              : };
      67              : 
      68              : struct UdmaInlineData {
      69              :     u8 data[16];
      70              : };
      71              : 
      72              : struct UdfExtDate { // UDF扩展数据
      73              :     uint32_t udfType : 8;
      74              :     uint32_t reduceType: 4;
      75              :     uint32_t reduceOp: 4;
      76              :     uint32_t rsv : 16;
      77              : };
      78              : 
      79              : struct UdmaSqe {
      80              :     uint32_t sqeBbIdx : 16;
      81              :     uint32_t placeOdr : 2;
      82              :     uint32_t compOrder : 1;
      83              :     uint32_t fence : 1;
      84              :     uint32_t se : 1;
      85              :     uint32_t cqe : 1;
      86              :     uint32_t inlineEn : 1;
      87              :     uint32_t rsv : 5;
      88              :     uint32_t tokenEn : 1;
      89              :     uint32_t rmtJettyType : 2;
      90              :     uint32_t owner : 1;
      91              :     uint32_t targetHint : 8;
      92              :     uint32_t opcode : 8;
      93              :     uint32_t rsv1 : 6;
      94              :     uint32_t inlineMsgLen : 10;
      95              :     uint32_t tpn : 24;
      96              :     uint32_t sgeNum : 8;
      97              :     uint32_t rmtObjId : 20;
      98              :     uint32_t rsv2 : 12;
      99              :     uint32_t rmtEid[UDMA_SQE_RMT_EID_SIZE];
     100              :     uint32_t rmtTokenValue;
     101              :     union {
     102              :         uint32_t rsv3;
     103              :         UdfExtDate udfData;
     104              :     } inlinedata;
     105              : 
     106              :     uint32_t rmtAddrLow;
     107              :     uint32_t rmtAddrHigh;
     108              :     union {
     109              :         UdmaNormalSge sge;
     110              :         UdmaInlineData inlineData;
     111              :     } u;
     112              : };
     113              : 
     114              : union LocalValueU{
     115              :     UdmaNormalSge sge;
     116              :     UdmaInlineData inlineData;
     117              : };
     118              : 
     119              : struct UdmaSqeNotify {
     120              :     uint32_t notifyTokenId : 20;
     121              :     uint32_t rsv : 12;
     122              :     uint32_t notifyTokenValue;
     123              :     uint32_t notifyAddrLow;
     124              :     uint32_t notifyAddrHigh;
     125              :     uint32_t notifyDataLow;
     126              :     uint32_t notifyDataHigh;
     127              :     std::string Desc() const
     128              :     {
     129              :         return StringFormat("notifyAddrLow = %u notifyAddrHigh %u notifyDataLow = %u "
     130              :                     "notifyDataHigh %u",
     131              :                     notifyAddrLow, notifyAddrHigh, notifyDataLow, notifyDataHigh);
     132              :     }
     133              : };
     134              : 
     135              : struct UdmaSqeCommon {
     136              :     uint32_t sqeBbIdx : 16;
     137              :     uint32_t placeOdr : 2;
     138              :     uint32_t compOrder : 1;
     139              :     uint32_t fence : 1;
     140              :     uint32_t se : 1;
     141              :     uint32_t cqe : 1;
     142              :     uint32_t inlineEn : 1;
     143              :     uint32_t udfFlag : 1;
     144              :     uint32_t rsv : 4;
     145              :     uint32_t tokenEn : 1;
     146              :     uint32_t rmtJettyType : 2;
     147              :     uint32_t owner : 1;
     148              :     uint32_t targetHint : 8;
     149              :     uint32_t opcode : 8;
     150              :     uint32_t rsv1 : 6;
     151              :     uint32_t inlineMsgLen : 10;
     152              :     uint32_t tpn : 24;
     153              :     uint32_t sgeNum : 8;
     154              :     uint32_t rmtObjId : 20;
     155              :     uint32_t rsv2 : 12;
     156              :     uint32_t rmtEid[UDMA_SQE_RMT_EID_SIZE];
     157              :     uint32_t rmtTokenValue;
     158              :     union {
     159              :         uint32_t rsv3;
     160              :         UdfExtDate udfData;
     161              :     } inlinedata;
     162              : 
     163              :     uint32_t rmtAddrLow;
     164              :     uint32_t rmtAddrHigh;
     165              : };
     166              : 
     167              : struct UdmaSqeWriteWithNotify {
     168              :     struct UdmaSqeCommon comm;
     169              :     struct UdmaSqeNotify notify;
     170              :     uint32_t rsv1;
     171              :     uint32_t rsv2;
     172              :     union LocalValueU localU;
     173              : };
     174              : 
     175              : struct UdmaSqeWrite {
     176              :     struct UdmaSqeCommon comm;
     177              :     union LocalValueU u;
     178              : };
     179              : 
     180              : struct UdmaSqeRead {
     181              :     struct UdmaSqeCommon comm;
     182              :     union LocalValueU u;
     183              : };
     184              : }
     185              : #endif // HCCL_AICPU_RESOURCE_AI_CPU_RESOUCES_H_
        

Generated by: LCOV version 2.0-1