build fix for export Swap Handle API (#643)

PR #635 build error fix

Type: bug fix

Signed-off-by: Tang Jing <jing.tang@verisilicon.com>
This commit is contained in:
Antkillerfarm 2023-08-30 14:25:45 +08:00 committed by GitHub
parent 01235266c5
commit 98966dac9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -154,9 +154,7 @@ class Tensor {
virtual bool SwapHandle(void* new_ptr, bool is_new_ptr_malloc_by_ovxlib,
void** old_ptr) = 0;
virtual bool SwapHandle(std::shared_ptr<tim::vx::Tensor> tensor) = 0;
#ifdef VSI_SWAP_HANDLE_CACHE_SUPPORT
virtual bool SwapHandleWithCache(std::shared_ptr<tim::vx::Tensor> tensor) = 0;
#endif
virtual bool FlushCacheForHandle() = 0;
virtual bool InvalidateCacheForHandle() = 0;
virtual void* map(bool invalidate_cpu_cache = false) = 0;

View File

@ -249,8 +249,8 @@ bool TensorImpl::SwapHandle(std::shared_ptr<tim::vx::Tensor> tensor) {
return retn;
}
#ifdef VSI_SWAP_HANDLE_CACHE_SUPPORT
bool TensorImpl::SwapHandleWithCache(std::shared_ptr<tim::vx::Tensor> tensor) {
#ifdef VSI_SWAP_HANDLE_CACHE_SUPPORT
bool retn = true;
if (VSI_NN_TENSOR_ID_NA != id_) {
retn = false;
@ -266,8 +266,12 @@ bool TensorImpl::SwapHandleWithCache(std::shared_ptr<tim::vx::Tensor> tensor) {
}
}
return retn;
}
#else
(void)tensor;
VSILOGE("Your ovxlib DO NOT support vsi_nn_SwapTensorHandleWithCache API");
return false;
#endif
}
bool TensorImpl::FlushCacheForHandle() {
if (!(spec_.attr_ & TensorAttribute::INPUT)) {

View File

@ -51,9 +51,7 @@ class TensorImpl : public Tensor {
bool SwapHandle(void* new_ptr, bool is_new_ptr_malloc_by_ovxlib,
void** old_ptr) override;
bool SwapHandle(std::shared_ptr<tim::vx::Tensor> tensor) override;
#ifdef VSI_SWAP_HANDLE_CACHE_SUPPORT
bool SwapHandleWithCache(std::shared_ptr<tim::vx::Tensor> tensor) override;
#endif
bool FlushCacheForHandle() override;
bool InvalidateCacheForHandle() override;
void* map(bool invalidate_cpu_cache = false) override;
@ -101,12 +99,10 @@ class TensorPlaceholder : public Tensor {
(void)tensor;
return false;
}
#ifdef VSI_SWAP_HANDLE_CACHE_SUPPORT
bool SwapHandleWithCache(std::shared_ptr<tim::vx::Tensor> tensor) override {
(void)tensor;
return false;
}
#endif
bool InvalidateCacheForHandle() override { return false; }
bool FlushCacheForHandle() override { return false; }
void* map(bool invalidate_cpu_cache = false) override {