Support NPU access large memory > 4G (#280)

Signed-off-by: xiang.zhang <xiang.zhang@verisilicon.com>
This commit is contained in:
Sven 2022-01-26 16:00:14 +08:00 committed by GitHub
parent 9fdba427f7
commit 19e4e86651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -9,6 +9,7 @@ option(TIM_VX_CODE_COVERAGE "Run code coverage with gconv(gcc only"
option(TIM_VX_USE_EXTERNAL_OVXLIB "Use external OVXLIB" OFF)
option(TIM_VX_BUILD_EXAMPLES "Build demos show general usage" OFF)
option(TIM_VX_ENABLE_VIPLITE "Enable lite driver api support" OFF)
option(TIM_VX_ENABLE_40BIT "Enable large memory support" OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@ -24,6 +25,11 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
endif()
if(${TIM_VX_ENABLE_40BIT})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVSI_40BIT_VA_SUPPORT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVSI_40BIT_VA_SUPPORT")
endif()
set(CMAKE_C_VISIBILITY_PRESET hidden)
if(EXTERNAL_VIV_SDK AND EXISTS ${EXTERNAL_VIV_SDK})

View File

@ -58,8 +58,9 @@ cmake options:
|`TIM_VX_USE_EXTERNAL_OVXLIB`| Replace internal with a prebuilt libovxlib library | OFF |
|`OVXLIB_LIB`|full path to libovxlib.so include so name, required if `TIM_VX_USE_EXTERNAL_OVXLIB`=ON | Not set |
|`OVXLIB_INC`|ovxlib's include path, required if `TIM_VX_USE_EXTERNAL_OVXLIB`=ON| Not set |
|`EXTERNAL_VIV_SDK`| Give external vivante openvx driver libraries | OFF |
|`EXTERNAL_VIV_SDK`| Give external vivante openvx driver libraries | Not set|
|`TIM_VX_BUILD_EXAMPLES`| Build example applications | OFF |
|`TIM_VX_ENABLE_40BIT` | Enable large memory (over 4G) support in NPU driver | OFF |
----
run unit test:

View File

@ -187,6 +187,7 @@ bool TensorImpl::Init() {
PackTensorDtype(spec_, &attr.dtype);
#ifndef VSI_40BIT_VA_SUPPORT
if ((spec_.attr_ & TensorAttribute::INPUT) ||
(spec_.attr_ & TensorAttribute::OUTPUT)) {
#ifdef VX_CREATE_TENSOR_SUPPORT_PHYSICAL
@ -209,7 +210,9 @@ bool TensorImpl::Init() {
}
#endif
} else {
} else
#endif
{
id_ = vsi_nn_AddTensor(graph_->graph(), VSI_NN_TENSOR_ID_AUTO, &attr,
nullptr);
}