已合并
refactor: split NpuDriver Mbuf implementation #4264
zhangpengpeng8创建于 25 天前
refactor: split NpuDriver Mbuf implementation #4264
已合并
共 14 个文件变更+334-287
| @@ -423,6 +423,7 @@ macro(add_runtime_library target_name) | |||
| 423 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 423 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 424 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 424 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 425 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 425 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 426 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 426 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 427 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 427 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 428 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 428 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 429 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -760,6 +760,7 @@ add_library(runtime_model OBJECT EXCLUDE_FROM_ALL | |||
| 760 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 760 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 761 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 761 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 762 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 762 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 763 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 763 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 764 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 764 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 765 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 765 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 766 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -823,6 +824,7 @@ add_library(runtime_model_v200 OBJECT EXCLUDE_FROM_ALL | |||
| 823 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 824 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 824 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 825 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 825 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 826 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 827 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 826 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 828 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 827 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 829 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 828 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 830 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -706,6 +706,7 @@ macro(add_runtime_v100_library target_name) | |||
| 706 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 706 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 707 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 707 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 708 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 708 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 709 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 709 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 710 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 710 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 711 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 711 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 712 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -761,6 +761,7 @@ macro(add_runtime_v100_library target_name) | |||
| 761 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 761 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 762 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 762 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 763 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 763 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 764 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 764 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 765 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 765 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 766 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 766 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 767 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -863,6 +864,7 @@ else() | |||
| 863 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 864 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 864 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 865 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 865 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 866 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 867 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 866 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 868 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 867 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 869 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 868 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 870 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -566,6 +566,7 @@ macro(add_runtime_v200_library target_name) | |||
| 566 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 566 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 567 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 567 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 568 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 568 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 569 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 569 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 570 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 570 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 571 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 571 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 572 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -675,6 +676,7 @@ macro(add_runtime_v201_library target_name) | |||
| 675 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc | 676 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver.cc |
| 676 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc | 677 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 677 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc | 678 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 679 | + ${RUNTIME_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 678 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc | 680 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_res.cc |
| 679 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp | 681 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_tiny.cpp |
| 680 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp | 682 | ${RUNTIME_DIR}/src/runtime/driver/npu_driver_dcache_lock_common.cpp |
| @@ -0,0 +1,304 @@ | |||
| 1 | +/** | ||
| 2 | + * Copyright (c) 2026 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 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +namespace cce { | ||
| 18 | +namespace runtime { | ||
| 19 | + | ||
| 20 | +rtError_t NpuDriver::MbufInit(rtMemBuffCfg_t* const cfg) | ||
| 21 | +{ | ||
| 22 | + RT_LOG(RT_LOG_INFO, "init device mem buff."); | ||
| 23 | + | ||
| 24 | + COND_RETURN_WARN(&halBuffInit == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halBuffInit does not exist."); | ||
| 25 | + drvError_t drvRet; | ||
| 26 | + if (cfg != nullptr) { | ||
| 27 | + BuffCfg bufCfg = {}; | ||
| 28 | + for (int32_t i = 0; i < RT_MEM_BUFF_MAX_CFG_NUM; ++i) { | ||
| 29 | + bufCfg.cfg[i].cfg_id = cfg->cfg[i].cfgId; | ||
| 30 | + bufCfg.cfg[i].total_size = cfg->cfg[i].totalSize; | ||
| 31 | + bufCfg.cfg[i].blk_size = cfg->cfg[i].blkSize; | ||
| 32 | + bufCfg.cfg[i].max_buf_size = cfg->cfg[i].maxBufSize; | ||
| 33 | + bufCfg.cfg[i].page_type = cfg->cfg[i].pageType; | ||
| 34 | + | ||
| 35 | + bufCfg.cfg[i].elasticEnable = cfg->cfg[i].elasticEnable; | ||
| 36 | + bufCfg.cfg[i].elasticRate = cfg->cfg[i].elasticRate; | ||
| 37 | + bufCfg.cfg[i].elasticRateMax = cfg->cfg[i].elasticRateMax; | ||
| 38 | + bufCfg.cfg[i].elasticHighLevel = cfg->cfg[i].elasticHighLevel; | ||
| 39 | + bufCfg.cfg[i].elasticLowLevel = cfg->cfg[i].elasticLowLevel; | ||
| 40 | + } | ||
| 41 | + drvRet = static_cast<drvError_t>(halBuffInit(&bufCfg)); | ||
| 42 | + } else { | ||
| 43 | + drvRet = static_cast<drvError_t>(halBuffInit(nullptr)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + COND_RETURN_WARN(drvRet == DRV_ERROR_REPEATED_INIT, RT_GET_DRV_ERRCODE(drvRet), "repeated init"); // special state | ||
| 47 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 48 | + DRV_ERROR_PROCESS(drvRet, "Call driver api halBuffInit failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 49 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 50 | + } | ||
| 51 | + return RT_ERROR_NONE; | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +rtError_t NpuDriver::MbufAlloc(rtMbufPtr_t* const mbufPtr, const uint64_t size) | ||
| 55 | +{ | ||
| 56 | + RT_LOG(RT_LOG_INFO, "alloc mbuf, size=%" PRIu64, size); | ||
| 57 | + COND_RETURN_WARN(&halMbufAlloc == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufAlloc does not exist."); | ||
| 58 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufAlloc(size, RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 59 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 60 | + DRV_ERROR_PROCESS( | ||
| 61 | + drvRet, "Call driver api halMbufAlloc failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 62 | + static_cast<int32_t>(drvRet), size); | ||
| 63 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 64 | + } | ||
| 65 | + return RT_ERROR_NONE; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +rtError_t NpuDriver::MbufAllocEx( | ||
| 69 | + rtMbufPtr_t* const mbufPtr, const uint64_t size, const uint64_t flag, const int32_t grpId) | ||
| 70 | +{ | ||
| 71 | + RT_LOG(RT_LOG_INFO, "alloc mbuf, size=%" PRIu64, size); | ||
| 72 | + if (flag == NORMAL_MEM) { | ||
| 73 | + COND_RETURN_WARN( | ||
| 74 | + &halMbufAlloc == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufAlloc does not exist."); | ||
| 75 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufAlloc(size, RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 76 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 77 | + DRV_ERROR_PROCESS( | ||
| 78 | + drvRet, "Call driver api halMbufAlloc failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 79 | + static_cast<int32_t>(drvRet), size); | ||
| 80 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 81 | + } | ||
| 82 | + } else if (flag == DVPP_MEM) { | ||
| 83 | + COND_RETURN_WARN( | ||
| 84 | + &halMbufAllocEx == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufAlloc does not exist."); | ||
| 85 | + constexpr uint32_t align = 128U; // dvpp default 128-bit alignment | ||
| 86 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufAllocEx( | ||
| 87 | + size, align, static_cast<unsigned long>(BUFF_SP_DVPP | BUFF_SP_HUGEPAGE_PRIOR), grpId, | ||
| 88 | + RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 89 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 90 | + DRV_ERROR_PROCESS( | ||
| 91 | + drvRet, "Call driver api halMbufAllocEx failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 92 | + static_cast<int32_t>(drvRet), size); | ||
| 93 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 94 | + } | ||
| 95 | + } else { | ||
| 96 | + RT_LOG_OUTER_MSG_INVALID_PARAM(flag, "[0, 1]"); | ||
| 97 | + return RT_ERROR_INVALID_VALUE; | ||
| 98 | + } | ||
| 99 | + return RT_ERROR_NONE; | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +rtError_t NpuDriver::MbufFree(rtMbufPtr_t const memBuf) | ||
| 103 | +{ | ||
| 104 | + RT_LOG(RT_LOG_INFO, "free mbuf"); | ||
| 105 | + COND_RETURN_WARN(&halMbufFree == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufFree does not exist."); | ||
| 106 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufFree(RtPtrToPtr<Mbuf*>(memBuf))); | ||
| 107 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 108 | + DRV_ERROR_PROCESS(drvRet, "Call driver api halMbufFree failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 109 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 110 | + } | ||
| 111 | + return RT_ERROR_NONE; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +rtError_t NpuDriver::MbufBuild(void* const buff, const uint64_t size, rtMbufPtr_t* mbufPtr) | ||
| 115 | +{ | ||
| 116 | + RT_LOG(RT_LOG_INFO, "use buff to alloc mbuf, size=%" PRIu64, size); | ||
| 117 | + COND_RETURN_WARN(&halMbufBuild == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufBuild does not exist."); | ||
| 118 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufBuild(buff, size, RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 119 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 120 | + DRV_ERROR_PROCESS( | ||
| 121 | + drvRet, "Call driver api halMbufBuild failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 122 | + static_cast<int32_t>(drvRet), size); | ||
| 123 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + return RT_ERROR_NONE; | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +rtError_t NpuDriver::MbufUnBuild(const rtMbufPtr_t mbufPtr, void** const buff, uint64_t* const size) | ||
| 130 | +{ | ||
| 131 | + RT_LOG(RT_LOG_INFO, "unBuild the head of mbufPtr, and free the head"); | ||
| 132 | + COND_RETURN_WARN( | ||
| 133 | + &halMbufUnBuild == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufUnBuild does not exist."); | ||
| 134 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufUnBuild(RtPtrToPtr<Mbuf*>(mbufPtr), buff, size)); | ||
| 135 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 136 | + DRV_ERROR_PROCESS( | ||
| 137 | + drvRet, "Call driver api halMbufUnBuild failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 138 | + static_cast<int32_t>(drvRet), (*size)); | ||
| 139 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + return RT_ERROR_NONE; | ||
| 143 | +} | ||
| 144 | + | ||
| 145 | +rtError_t NpuDriver::MbufGet(const rtMbufPtr_t mbufPtr, void* const buff, const uint64_t size) | ||
| 146 | +{ | ||
| 147 | + RT_LOG(RT_LOG_INFO, "get mbufPtr"); | ||
| 148 | + COND_RETURN_WARN(&halBuffGet == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halBuffGet does not exist."); | ||
| 149 | + const drvError_t drvRet = static_cast<drvError_t>(halBuffGet(RtPtrToPtr<Mbuf*>(mbufPtr), buff, size)); | ||
| 150 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 151 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + return RT_ERROR_NONE; | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | +rtError_t NpuDriver::MbufPut(const rtMbufPtr_t mbufPtr, void* const buff) | ||
| 158 | +{ | ||
| 159 | + RT_LOG(RT_LOG_INFO, "put mbufPtr"); | ||
| 160 | + COND_RETURN_WARN(&halBuffPut == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halBuffPut does not exist."); | ||
| 161 | + halBuffPut(RtPtrToPtr<Mbuf*>(mbufPtr), buff); | ||
| 162 | + | ||
| 163 | + return RT_ERROR_NONE; | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +rtError_t NpuDriver::MbufSetDataLen(const rtMbufPtr_t mbufPtr, const uint64_t len) | ||
| 167 | +{ | ||
| 168 | + RT_LOG(RT_LOG_INFO, "set mbuf data len."); | ||
| 169 | + | ||
| 170 | + if (&halMbufSetDataLen == nullptr) { | ||
| 171 | + return RT_GET_DRV_ERRCODE(DRV_ERROR_NOT_SUPPORT); | ||
| 172 | + } | ||
| 173 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufSetDataLen(RtPtrToPtr<Mbuf*>(mbufPtr), len)); | ||
| 174 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 175 | + DRV_ERROR_PROCESS( | ||
| 176 | + drvRet, "Call driver api halMbufSetDataLen failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 177 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 178 | + } | ||
| 179 | + return RT_ERROR_NONE; | ||
| 180 | +} | ||
| 181 | + | ||
| 182 | +rtError_t NpuDriver::MbufGetDataLen(const rtMbufPtr_t mbufPtr, uint64_t* len) | ||
| 183 | +{ | ||
| 184 | + RT_LOG(RT_LOG_INFO, "get mbuf data len."); | ||
| 185 | + COND_RETURN_WARN( | ||
| 186 | + &halMbufGetDataLen == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetDataLen does not exist."); | ||
| 187 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufGetDataLen(RtPtrToPtr<Mbuf*>(mbufPtr), len)); | ||
| 188 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 189 | + DRV_ERROR_PROCESS( | ||
| 190 | + drvRet, "Call driver api halMbufGetDataLen failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 191 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 192 | + } | ||
| 193 | + return RT_ERROR_NONE; | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +rtError_t NpuDriver::MbufGetBuffSize(const rtMbufPtr_t memBuf, uint64_t* const totalSize) | ||
| 197 | +{ | ||
| 198 | + RT_LOG(RT_LOG_INFO, "get size address from mbuf, device_id=0."); | ||
| 199 | + COND_RETURN_WARN( | ||
| 200 | + &halMbufGetBuffSize == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetBuffSize does not exist."); | ||
| 201 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufGetBuffSize(RtPtrToPtr<Mbuf*>(memBuf), totalSize)); | ||
| 202 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 203 | + DRV_ERROR_PROCESS( | ||
| 204 | + drvRet, "Call driver api halMbufGetBuffSize failed, drvRetCode=%d, drvDevId=0.", | ||
| 205 | + static_cast<int32_t>(drvRet)); | ||
| 206 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 207 | + } | ||
| 208 | + return RT_ERROR_NONE; | ||
| 209 | +} | ||
| 210 | + | ||
| 211 | +rtError_t NpuDriver::MbufGetBuffAddr(const rtMbufPtr_t memBuf, void** const buf) | ||
| 212 | +{ | ||
| 213 | + RT_LOG(RT_LOG_INFO, "get buff address from mbuf, device_id=0."); | ||
| 214 | + COND_RETURN_WARN( | ||
| 215 | + &halMbufGetBuffAddr == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetBuffAddr does not exist."); | ||
| 216 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufGetBuffAddr(RtPtrToPtr<Mbuf*>(memBuf), buf)); | ||
| 217 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 218 | + DRV_ERROR_PROCESS( | ||
| 219 | + drvRet, "Call driver api halMbufGetBuffAddr failed, drvRetCode=%d, drvDevId=0.", | ||
| 220 | + static_cast<int32_t>(drvRet)); | ||
| 221 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 222 | + } | ||
| 223 | + return RT_ERROR_NONE; | ||
| 224 | +} | ||
| 225 | + | ||
| 226 | +rtError_t NpuDriver::MbufGetPrivInfo(const rtMbufPtr_t memBuf, void** const priv, uint64_t* const size) | ||
| 227 | +{ | ||
| 228 | + RT_LOG(RT_LOG_INFO, "get private info from mbuf."); | ||
| 229 | + COND_RETURN_WARN( | ||
| 230 | + &halMbufGetPrivInfo == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetPrivInfo does not exist."); | ||
| 231 | + uint32_t privSize = 0U; | ||
| 232 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufGetPrivInfo(RtPtrToPtr<Mbuf*>(memBuf), priv, &privSize)); | ||
| 233 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 234 | + DRV_ERROR_PROCESS( | ||
| 235 | + drvRet, "Call driver api halMbufGetPrivInfo failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 236 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 237 | + } | ||
| 238 | + *size = privSize; | ||
| 239 | + return RT_ERROR_NONE; | ||
| 240 | +} | ||
| 241 | + | ||
| 242 | +rtError_t NpuDriver::MbufCopyBufRef(const rtMbufPtr_t mbufPtr, rtMbufPtr_t* const newMbufPtr) | ||
| 243 | +{ | ||
| 244 | + RT_LOG(RT_LOG_INFO, "copy buf ref."); | ||
| 245 | + COND_RETURN_WARN( | ||
| 246 | + &halMbufCopyRef == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufCopyRef does not exist."); | ||
| 247 | + const drvError_t drvRet = | ||
| 248 | + static_cast<drvError_t>(halMbufCopyRef(RtPtrToPtr<Mbuf*>(mbufPtr), RtPtrToPtr<Mbuf**>(newMbufPtr))); | ||
| 249 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 250 | + DRV_ERROR_PROCESS( | ||
| 251 | + drvRet, "Call driver api halMbufCopyRef failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 252 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 253 | + } | ||
| 254 | + return RT_ERROR_NONE; | ||
| 255 | +} | ||
| 256 | + | ||
| 257 | +rtError_t NpuDriver::MbufChainAppend(const rtMbufPtr_t memBufChainHead, rtMbufPtr_t memBuf) | ||
| 258 | +{ | ||
| 259 | + RT_LOG(RT_LOG_INFO, "append mbuf chain."); | ||
| 260 | + COND_RETURN_WARN( | ||
| 261 | + &halMbufChainAppend == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufChainAppend does not exist."); | ||
| 262 | + const drvError_t drvRet = | ||
| 263 | + static_cast<drvError_t>(halMbufChainAppend(RtPtrToPtr<Mbuf*>(memBufChainHead), RtPtrToPtr<Mbuf*>(memBuf))); | ||
| 264 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 265 | + DRV_ERROR_PROCESS( | ||
| 266 | + drvRet, "Call driver api halMbufChainAppend failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 267 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 268 | + } | ||
| 269 | + return RT_ERROR_NONE; | ||
| 270 | +} | ||
| 271 | + | ||
| 272 | +rtError_t NpuDriver::MbufChainGetMbuf( | ||
| 273 | + rtMbufPtr_t const memBufChainHead, const uint32_t index, rtMbufPtr_t* const memBuf) | ||
| 274 | +{ | ||
| 275 | + RT_LOG(RT_LOG_INFO, "get mbuf chain mbuf index is %u.", index); | ||
| 276 | + COND_RETURN_WARN( | ||
| 277 | + &halMbufChainGetMbuf == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufChainGetMbuf does not exist."); | ||
| 278 | + const drvError_t drvRet = static_cast<drvError_t>( | ||
| 279 | + halMbufChainGetMbuf(RtPtrToPtr<Mbuf*>(memBufChainHead), index, RtPtrToPtr<Mbuf**>(memBuf))); | ||
| 280 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 281 | + DRV_ERROR_PROCESS( | ||
| 282 | + drvRet, "Call driver api halMbufChainGetMbuf failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 283 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 284 | + } | ||
| 285 | + return RT_ERROR_NONE; | ||
| 286 | +} | ||
| 287 | + | ||
| 288 | +rtError_t NpuDriver::MbufChainGetMbufNum(const rtMbufPtr_t memBufChainHead, uint32_t* num) | ||
| 289 | +{ | ||
| 290 | + RT_LOG(RT_LOG_INFO, "get mbuf chain num."); | ||
| 291 | + COND_RETURN_WARN( | ||
| 292 | + &halMbufChainGetMbufNum == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, | ||
| 293 | + "[drv api] halMbufChainGetMbufNum does not exist."); | ||
| 294 | + const drvError_t drvRet = static_cast<drvError_t>(halMbufChainGetMbufNum(RtPtrToPtr<Mbuf*>(memBufChainHead), num)); | ||
| 295 | + if (drvRet != DRV_ERROR_NONE) { | ||
| 296 | + DRV_ERROR_PROCESS( | ||
| 297 | + drvRet, "Call driver api halMbufChainGetMbufNum failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 298 | + return RT_GET_DRV_ERRCODE(drvRet); | ||
| 299 | + } | ||
| 300 | + return RT_ERROR_NONE; | ||
| 301 | +} | ||
| 302 | + | ||
| 303 | +} // namespace runtime | ||
| 304 | +} // namespace cce | ||
| @@ -99,293 +99,6 @@ rtError_t NpuDriver::BuffGetInfo( | |||
| 99 | return RT_ERROR_NONE; | 99 | return RT_ERROR_NONE; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | -/* ======================================================== | ||
| 103 | - * Subcategory: MBuf | ||
| 104 | - * ======================================================== */ | ||
| 105 | - | ||
| 106 | -rtError_t NpuDriver::MbufInit(rtMemBuffCfg_t* const cfg) | ||
| 107 | -{ | ||
| 108 | - RT_LOG(RT_LOG_INFO, "init device mem buff."); | ||
| 109 | - | ||
| 110 | - COND_RETURN_WARN(&halBuffInit == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halBuffInit does not exist."); | ||
| 111 | - drvError_t drvRet; | ||
| 112 | - if (cfg != nullptr) { | ||
| 113 | - BuffCfg bufCfg = {}; | ||
| 114 | - for (int32_t i = 0; i < RT_MEM_BUFF_MAX_CFG_NUM; ++i) { | ||
| 115 | - bufCfg.cfg[i].cfg_id = cfg->cfg[i].cfgId; | ||
| 116 | - bufCfg.cfg[i].total_size = cfg->cfg[i].totalSize; | ||
| 117 | - bufCfg.cfg[i].blk_size = cfg->cfg[i].blkSize; | ||
| 118 | - bufCfg.cfg[i].max_buf_size = cfg->cfg[i].maxBufSize; | ||
| 119 | - bufCfg.cfg[i].page_type = cfg->cfg[i].pageType; | ||
| 120 | - | ||
| 121 | - bufCfg.cfg[i].elasticEnable = cfg->cfg[i].elasticEnable; | ||
| 122 | - bufCfg.cfg[i].elasticRate = cfg->cfg[i].elasticRate; | ||
| 123 | - bufCfg.cfg[i].elasticRateMax = cfg->cfg[i].elasticRateMax; | ||
| 124 | - bufCfg.cfg[i].elasticHighLevel = cfg->cfg[i].elasticHighLevel; | ||
| 125 | - bufCfg.cfg[i].elasticLowLevel = cfg->cfg[i].elasticLowLevel; | ||
| 126 | - } | ||
| 127 | - drvRet = static_cast<drvError_t>(halBuffInit(&bufCfg)); | ||
| 128 | - } else { | ||
| 129 | - drvRet = static_cast<drvError_t>(halBuffInit(nullptr)); | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - COND_RETURN_WARN(drvRet == DRV_ERROR_REPEATED_INIT, RT_GET_DRV_ERRCODE(drvRet), "repeated init"); // special state | ||
| 133 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 134 | - DRV_ERROR_PROCESS(drvRet, "Call driver api halBuffInit failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 135 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 136 | - } | ||
| 137 | - return RT_ERROR_NONE; | ||
| 138 | -} | ||
| 139 | - | ||
| 140 | -rtError_t NpuDriver::MbufAlloc(rtMbufPtr_t* const mbufPtr, const uint64_t size) | ||
| 141 | -{ | ||
| 142 | - RT_LOG(RT_LOG_INFO, "alloc mbuf, size=%" PRIu64, size); | ||
| 143 | - COND_RETURN_WARN(&halMbufAlloc == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufAlloc does not exist."); | ||
| 144 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufAlloc(size, RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 145 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 146 | - DRV_ERROR_PROCESS( | ||
| 147 | - drvRet, "Call driver api halMbufAlloc failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 148 | - static_cast<int32_t>(drvRet), size); | ||
| 149 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 150 | - } | ||
| 151 | - return RT_ERROR_NONE; | ||
| 152 | -} | ||
| 153 | - | ||
| 154 | -rtError_t NpuDriver::MbufAllocEx( | ||
| 155 | - rtMbufPtr_t* const mbufPtr, const uint64_t size, const uint64_t flag, const int32_t grpId) | ||
| 156 | -{ | ||
| 157 | - RT_LOG(RT_LOG_INFO, "alloc mbuf, size=%" PRIu64, size); | ||
| 158 | - if (flag == NORMAL_MEM) { | ||
| 159 | - COND_RETURN_WARN( | ||
| 160 | - &halMbufAlloc == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufAlloc does not exist."); | ||
| 161 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufAlloc(size, RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 162 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 163 | - DRV_ERROR_PROCESS( | ||
| 164 | - drvRet, "Call driver api halMbufAlloc failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 165 | - static_cast<int32_t>(drvRet), size); | ||
| 166 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 167 | - } | ||
| 168 | - } else if (flag == DVPP_MEM) { | ||
| 169 | - COND_RETURN_WARN( | ||
| 170 | - &halMbufAllocEx == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufAlloc does not exist."); | ||
| 171 | - constexpr uint32_t align = 128U; // dvpp default 128-bit alignment | ||
| 172 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufAllocEx( | ||
| 173 | - size, align, static_cast<unsigned long>(BUFF_SP_DVPP | BUFF_SP_HUGEPAGE_PRIOR), grpId, | ||
| 174 | - RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 175 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 176 | - DRV_ERROR_PROCESS( | ||
| 177 | - drvRet, "Call driver api halMbufAllocEx failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 178 | - static_cast<int32_t>(drvRet), size); | ||
| 179 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 180 | - } | ||
| 181 | - } else { | ||
| 182 | - RT_LOG_OUTER_MSG_INVALID_PARAM(flag, "[0, 1]"); | ||
| 183 | - return RT_ERROR_INVALID_VALUE; | ||
| 184 | - } | ||
| 185 | - return RT_ERROR_NONE; | ||
| 186 | -} | ||
| 187 | - | ||
| 188 | -rtError_t NpuDriver::MbufFree(rtMbufPtr_t const memBuf) | ||
| 189 | -{ | ||
| 190 | - RT_LOG(RT_LOG_INFO, "free mbuf"); | ||
| 191 | - COND_RETURN_WARN(&halMbufFree == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufFree does not exist."); | ||
| 192 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufFree(RtPtrToPtr<Mbuf*>(memBuf))); | ||
| 193 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 194 | - DRV_ERROR_PROCESS(drvRet, "Call driver api halMbufFree failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 195 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 196 | - } | ||
| 197 | - return RT_ERROR_NONE; | ||
| 198 | -} | ||
| 199 | - | ||
| 200 | -rtError_t NpuDriver::MbufBuild(void* const buff, const uint64_t size, rtMbufPtr_t* mbufPtr) | ||
| 201 | -{ | ||
| 202 | - RT_LOG(RT_LOG_INFO, "use buff to alloc mbuf, size=%" PRIu64, size); | ||
| 203 | - COND_RETURN_WARN(&halMbufBuild == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufBuild does not exist."); | ||
| 204 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufBuild(buff, size, RtPtrToPtr<Mbuf**>(mbufPtr))); | ||
| 205 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 206 | - DRV_ERROR_PROCESS( | ||
| 207 | - drvRet, "Call driver api halMbufBuild failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 208 | - static_cast<int32_t>(drvRet), size); | ||
| 209 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - return RT_ERROR_NONE; | ||
| 213 | -} | ||
| 214 | - | ||
| 215 | -rtError_t NpuDriver::MbufUnBuild(const rtMbufPtr_t mbufPtr, void** const buff, uint64_t* const size) | ||
| 216 | -{ | ||
| 217 | - RT_LOG(RT_LOG_INFO, "unBuild the head of mbufPtr, and free the head"); | ||
| 218 | - COND_RETURN_WARN( | ||
| 219 | - &halMbufUnBuild == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufUnBuild does not exist."); | ||
| 220 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufUnBuild(RtPtrToPtr<Mbuf*>(mbufPtr), buff, size)); | ||
| 221 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 222 | - DRV_ERROR_PROCESS( | ||
| 223 | - drvRet, "Call driver api halMbufUnBuild failed, drvRetCode=%d, size=%" PRIu64 "(bytes).", | ||
| 224 | - static_cast<int32_t>(drvRet), (*size)); | ||
| 225 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 226 | - } | ||
| 227 | - | ||
| 228 | - return RT_ERROR_NONE; | ||
| 229 | -} | ||
| 230 | - | ||
| 231 | -rtError_t NpuDriver::MbufGet(const rtMbufPtr_t mbufPtr, void* const buff, const uint64_t size) | ||
| 232 | -{ | ||
| 233 | - RT_LOG(RT_LOG_INFO, "get mbufPtr"); | ||
| 234 | - COND_RETURN_WARN(&halBuffGet == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halBuffGet does not exist."); | ||
| 235 | - const drvError_t drvRet = static_cast<drvError_t>(halBuffGet(RtPtrToPtr<Mbuf*>(mbufPtr), buff, size)); | ||
| 236 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 237 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 238 | - } | ||
| 239 | - | ||
| 240 | - return RT_ERROR_NONE; | ||
| 241 | -} | ||
| 242 | - | ||
| 243 | -rtError_t NpuDriver::MbufPut(const rtMbufPtr_t mbufPtr, void* const buff) | ||
| 244 | -{ | ||
| 245 | - RT_LOG(RT_LOG_INFO, "put mbufPtr"); | ||
| 246 | - COND_RETURN_WARN(&halBuffPut == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halBuffPut does not exist."); | ||
| 247 | - halBuffPut(RtPtrToPtr<Mbuf*>(mbufPtr), buff); | ||
| 248 | - | ||
| 249 | - return RT_ERROR_NONE; | ||
| 250 | -} | ||
| 251 | - | ||
| 252 | -rtError_t NpuDriver::MbufSetDataLen(const rtMbufPtr_t mbufPtr, const uint64_t len) | ||
| 253 | -{ | ||
| 254 | - RT_LOG(RT_LOG_INFO, "set mbuf data len."); | ||
| 255 | - | ||
| 256 | - if (&halMbufSetDataLen == nullptr) { | ||
| 257 | - return RT_GET_DRV_ERRCODE(DRV_ERROR_NOT_SUPPORT); | ||
| 258 | - } | ||
| 259 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufSetDataLen(RtPtrToPtr<Mbuf*>(mbufPtr), len)); | ||
| 260 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 261 | - DRV_ERROR_PROCESS( | ||
| 262 | - drvRet, "Call driver api halMbufSetDataLen failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 263 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 264 | - } | ||
| 265 | - return RT_ERROR_NONE; | ||
| 266 | -} | ||
| 267 | - | ||
| 268 | -rtError_t NpuDriver::MbufGetDataLen(const rtMbufPtr_t mbufPtr, uint64_t* len) | ||
| 269 | -{ | ||
| 270 | - RT_LOG(RT_LOG_INFO, "get mbuf data len."); | ||
| 271 | - COND_RETURN_WARN( | ||
| 272 | - &halMbufGetDataLen == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetDataLen does not exist."); | ||
| 273 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufGetDataLen(RtPtrToPtr<Mbuf*>(mbufPtr), len)); | ||
| 274 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 275 | - DRV_ERROR_PROCESS( | ||
| 276 | - drvRet, "Call driver api halMbufGetDataLen failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 277 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 278 | - } | ||
| 279 | - return RT_ERROR_NONE; | ||
| 280 | -} | ||
| 281 | - | ||
| 282 | -rtError_t NpuDriver::MbufGetBuffSize(const rtMbufPtr_t memBuf, uint64_t* const totalSize) | ||
| 283 | -{ | ||
| 284 | - RT_LOG(RT_LOG_INFO, "get size address from mbuf, device_id=0."); | ||
| 285 | - COND_RETURN_WARN( | ||
| 286 | - &halMbufGetBuffSize == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetBuffSize does not exist."); | ||
| 287 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufGetBuffSize(RtPtrToPtr<Mbuf*>(memBuf), totalSize)); | ||
| 288 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 289 | - DRV_ERROR_PROCESS( | ||
| 290 | - drvRet, "Call driver api halMbufGetBuffSize failed, drvRetCode=%d, drvDevId=0.", | ||
| 291 | - static_cast<int32_t>(drvRet)); | ||
| 292 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 293 | - } | ||
| 294 | - return RT_ERROR_NONE; | ||
| 295 | -} | ||
| 296 | - | ||
| 297 | -rtError_t NpuDriver::MbufGetBuffAddr(const rtMbufPtr_t memBuf, void** const buf) | ||
| 298 | -{ | ||
| 299 | - RT_LOG(RT_LOG_INFO, "get buff address from mbuf, device_id=0."); | ||
| 300 | - COND_RETURN_WARN( | ||
| 301 | - &halMbufGetBuffAddr == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetBuffAddr does not exist."); | ||
| 302 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufGetBuffAddr(RtPtrToPtr<Mbuf*>(memBuf), buf)); | ||
| 303 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 304 | - DRV_ERROR_PROCESS( | ||
| 305 | - drvRet, "Call driver api halMbufGetBuffAddr failed, drvRetCode=%d, drvDevId=0.", | ||
| 306 | - static_cast<int32_t>(drvRet)); | ||
| 307 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 308 | - } | ||
| 309 | - return RT_ERROR_NONE; | ||
| 310 | -} | ||
| 311 | - | ||
| 312 | -rtError_t NpuDriver::MbufGetPrivInfo(const rtMbufPtr_t memBuf, void** const priv, uint64_t* const size) | ||
| 313 | -{ | ||
| 314 | - RT_LOG(RT_LOG_INFO, "get private info from mbuf."); | ||
| 315 | - COND_RETURN_WARN( | ||
| 316 | - &halMbufGetPrivInfo == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufGetPrivInfo does not exist."); | ||
| 317 | - uint32_t privSize = 0U; | ||
| 318 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufGetPrivInfo(RtPtrToPtr<Mbuf*>(memBuf), priv, &privSize)); | ||
| 319 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 320 | - DRV_ERROR_PROCESS( | ||
| 321 | - drvRet, "Call driver api halMbufGetPrivInfo failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 322 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 323 | - } | ||
| 324 | - *size = privSize; | ||
| 325 | - return RT_ERROR_NONE; | ||
| 326 | -} | ||
| 327 | - | ||
| 328 | -rtError_t NpuDriver::MbufCopyBufRef(const rtMbufPtr_t mbufPtr, rtMbufPtr_t* const newMbufPtr) | ||
| 329 | -{ | ||
| 330 | - RT_LOG(RT_LOG_INFO, "copy buf ref."); | ||
| 331 | - COND_RETURN_WARN( | ||
| 332 | - &halMbufCopyRef == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufCopyRef does not exist."); | ||
| 333 | - const drvError_t drvRet = | ||
| 334 | - static_cast<drvError_t>(halMbufCopyRef(RtPtrToPtr<Mbuf*>(mbufPtr), RtPtrToPtr<Mbuf**>(newMbufPtr))); | ||
| 335 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 336 | - DRV_ERROR_PROCESS( | ||
| 337 | - drvRet, "Call driver api halMbufCopyRef failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 338 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 339 | - } | ||
| 340 | - return RT_ERROR_NONE; | ||
| 341 | -} | ||
| 342 | - | ||
| 343 | -rtError_t NpuDriver::MbufChainAppend(const rtMbufPtr_t memBufChainHead, rtMbufPtr_t memBuf) | ||
| 344 | -{ | ||
| 345 | - RT_LOG(RT_LOG_INFO, "append mbuf chain."); | ||
| 346 | - COND_RETURN_WARN( | ||
| 347 | - &halMbufChainAppend == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufChainAppend does not exist."); | ||
| 348 | - const drvError_t drvRet = | ||
| 349 | - static_cast<drvError_t>(halMbufChainAppend(RtPtrToPtr<Mbuf*>(memBufChainHead), RtPtrToPtr<Mbuf*>(memBuf))); | ||
| 350 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 351 | - DRV_ERROR_PROCESS( | ||
| 352 | - drvRet, "Call driver api halMbufChainAppend failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 353 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 354 | - } | ||
| 355 | - return RT_ERROR_NONE; | ||
| 356 | -} | ||
| 357 | - | ||
| 358 | -rtError_t NpuDriver::MbufChainGetMbuf( | ||
| 359 | - rtMbufPtr_t const memBufChainHead, const uint32_t index, rtMbufPtr_t* const memBuf) | ||
| 360 | -{ | ||
| 361 | - RT_LOG(RT_LOG_INFO, "get mbuf chain mbuf index is %u.", index); | ||
| 362 | - COND_RETURN_WARN( | ||
| 363 | - &halMbufChainGetMbuf == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, "[drv api] halMbufChainGetMbuf does not exist."); | ||
| 364 | - const drvError_t drvRet = static_cast<drvError_t>( | ||
| 365 | - halMbufChainGetMbuf(RtPtrToPtr<Mbuf*>(memBufChainHead), index, RtPtrToPtr<Mbuf**>(memBuf))); | ||
| 366 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 367 | - DRV_ERROR_PROCESS( | ||
| 368 | - drvRet, "Call driver api halMbufChainGetMbuf failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 369 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 370 | - } | ||
| 371 | - return RT_ERROR_NONE; | ||
| 372 | -} | ||
| 373 | - | ||
| 374 | -rtError_t NpuDriver::MbufChainGetMbufNum(const rtMbufPtr_t memBufChainHead, uint32_t* num) | ||
| 375 | -{ | ||
| 376 | - RT_LOG(RT_LOG_INFO, "get mbuf chain num."); | ||
| 377 | - COND_RETURN_WARN( | ||
| 378 | - &halMbufChainGetMbufNum == nullptr, RT_ERROR_FEATURE_NOT_SUPPORT, | ||
| 379 | - "[drv api] halMbufChainGetMbufNum does not exist."); | ||
| 380 | - const drvError_t drvRet = static_cast<drvError_t>(halMbufChainGetMbufNum(RtPtrToPtr<Mbuf*>(memBufChainHead), num)); | ||
| 381 | - if (drvRet != DRV_ERROR_NONE) { | ||
| 382 | - DRV_ERROR_PROCESS( | ||
| 383 | - drvRet, "Call driver api halMbufChainGetMbufNum failed, drvRetCode=%d.", static_cast<int32_t>(drvRet)); | ||
| 384 | - return RT_GET_DRV_ERRCODE(drvRet); | ||
| 385 | - } | ||
| 386 | - return RT_ERROR_NONE; | ||
| 387 | -} | ||
| 388 | - | ||
| 389 | /* ======================================================== | 102 | /* ======================================================== |
| 390 | * Subcategory: Memory Group | 103 | * Subcategory: Memory Group |
| 391 | * ======================================================== */ | 104 | * ======================================================== */ |
| @@ -799,6 +799,7 @@ set(runtimeut_david_src_list | |||
| 799 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 799 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 800 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 800 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 801 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 801 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 802 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 802 | ${TOP_DIR}/src/runtime/core/src/runtime_v200/runtime_adapt.cc | 803 | ${TOP_DIR}/src/runtime/core/src/runtime_v200/runtime_adapt.cc |
| 803 | ${TOP_DIR}/src/runtime/feature/xpu/program_plat.cc | 804 | ${TOP_DIR}/src/runtime/feature/xpu/program_plat.cc |
| 804 | ${TOP_DIR}/src/runtime/core/src/kernel/program.cc | 805 | ${TOP_DIR}/src/runtime/core/src/kernel/program.cc |
| @@ -907,6 +908,7 @@ add_executable(runtime_utest | |||
| 907 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 908 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 908 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 909 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 909 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 910 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 911 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 910 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 912 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 911 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 913 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 912 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 914 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -984,6 +986,7 @@ add_executable(runtime_utest_camodel | |||
| 984 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 986 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 985 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 987 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 986 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 988 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 989 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 987 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 990 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 988 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 991 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 989 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 992 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1016,6 +1019,7 @@ add_executable(runtime_camodel_utest_v200 | |||
| 1016 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1019 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1017 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1020 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1018 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1021 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1022 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1019 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1023 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1020 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1024 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1021 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1025 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1047,6 +1051,7 @@ add_executable(runtime_utest_model | |||
| 1047 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1051 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1048 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1052 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1049 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1053 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1054 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1050 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1055 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1051 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1056 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1052 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1057 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1080,6 +1085,7 @@ add_executable(runtime_utest_engine | |||
| 1080 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1085 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1081 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1086 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1082 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1087 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1088 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1083 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1089 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1084 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1090 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1085 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1091 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1142,6 +1148,7 @@ add_executable(runtime_utest_api | |||
| 1142 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1148 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1143 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1149 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1144 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1150 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1151 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1145 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1152 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1146 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1153 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1147 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1154 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1191,6 +1198,7 @@ add_executable(runtime_utest_api_ext_others | |||
| 1191 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1198 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1192 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1199 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1193 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1200 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1201 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1194 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1202 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1195 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1203 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1196 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1204 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1228,6 +1236,7 @@ add_executable(runtime_utest_task_normal | |||
| 1228 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1236 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1229 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1237 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1230 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1238 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1239 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1231 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1240 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1232 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1241 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1233 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1242 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1259,6 +1268,7 @@ add_executable(runtime_utest_dfx | |||
| 1259 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1268 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1260 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1269 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1261 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1270 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1271 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1262 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1272 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1263 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1273 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1264 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1274 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1301,6 +1311,7 @@ set(runtimeut_src_tiny_list_all | |||
| 1301 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1311 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1302 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1312 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1303 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1313 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1314 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1304 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1315 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1305 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1316 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1306 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1317 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1702,6 +1713,7 @@ add_executable(runtime_utest_task_v201 | |||
| 1702 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1713 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1703 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1714 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1704 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1715 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1716 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1705 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1717 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1706 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1718 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| 1707 | stub/hal_stub.cc | 1719 | stub/hal_stub.cc |
| @@ -1794,6 +1806,7 @@ add_executable(runtime_utest_api_normal | |||
| 1794 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1806 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1795 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1807 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1796 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1808 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1809 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1797 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1810 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1798 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1811 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1799 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1812 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -1854,6 +1867,7 @@ add_executable(runtime_utest_api_others | |||
| 1854 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 1867 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 1855 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 1868 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 1856 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 1869 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 1870 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 1857 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 1871 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 1858 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 1872 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 1859 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 1873 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -626,6 +626,7 @@ add_executable(runtime_utest_task_910B | |||
| 626 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 626 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 627 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 627 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 628 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 628 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 629 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 629 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 630 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 630 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 631 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 631 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 632 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -677,6 +678,7 @@ add_executable(runtime_utest_api_910B | |||
| 677 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 678 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 678 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 679 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 679 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 680 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 681 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 680 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 682 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 681 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 683 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 682 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 684 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -752,6 +754,7 @@ add_executable(runtime_utest_xpu_910B | |||
| 752 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 754 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 753 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 755 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 754 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 756 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 757 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 755 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 758 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 756 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 759 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 757 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 760 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -18,6 +18,7 @@ add_executable(runtime_utest_adc | |||
| 18 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 18 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 20 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 20 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 21 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 21 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 23 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 23 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 24 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -333,6 +333,7 @@ add_executable(runtime_utest_arch5162 | |||
| 333 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 333 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 334 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 334 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 335 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 335 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 336 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 336 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 337 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 337 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 338 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 338 | ${TOP_DIR}/src/runtime/driver/v100/npu_driver.cc | 339 | ${TOP_DIR}/src/runtime/driver/v100/npu_driver.cc |
| @@ -18,6 +18,7 @@ add_executable(runtime_utest_cloud | |||
| 18 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 18 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 20 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 20 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 21 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 21 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 23 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 23 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 24 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -17,6 +17,7 @@ add_executable(runtime_utest_dc | |||
| 17 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 17 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 18 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 18 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 20 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 20 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 21 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 21 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 23 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |
| @@ -17,6 +17,7 @@ add_executable(runtime_utest_mini_v3 | |||
| 17 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc | 17 | ${TOP_DIR}/src/runtime/driver/npu_driver.cc |
| 18 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc | 18 | ${TOP_DIR}/src/runtime/driver/npu_driver_mem.cc |
| 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc | 19 | ${TOP_DIR}/src/runtime/driver/npu_driver_queue.cc |
| 20 | + ${TOP_DIR}/src/runtime/driver/npu_driver_mbuf.cc | ||
| 20 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc | 21 | ${TOP_DIR}/src/runtime/driver/npu_driver_res.cc |
| 21 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp | 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_dcache_lock_opb.cpp |
| 22 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc | 23 | ${TOP_DIR}/src/runtime/driver/npu_driver_standard_soc.cc |