VeriSilicon / TIM-VX

VeriSilicon Tensor Interface Module
Other
226 stars 84 forks source link

Usage of vxFlushHandle and vxMapTensorPatch #143

Closed janoslim closed 3 years ago

janoslim commented 3 years ago

Hello,

I tried to make tensor object with vxCreateTensorFromHandle2() to use host level memory block, And I recently notice that not calling vxFlushHandle(), the data change is not correctly applied. And I also see that vxMapTensorPatch() need to be called to access tensor data... https://www.khronos.org/registry/OpenVX/specs/1.3/html/OpenVX_Specification_1_3.html#_vxmaptensorpatch Ultimately, I want to create a handle at the host level and apply it every time I change it, and I wonder if it's okay to use only the vxFlushHandle. Thank you!

sunshinemyson commented 3 years ago

Yes, It's ok only use vxFlushHandle() after changed the memory.

janoslim commented 3 years ago

Thank you for your reply. I wonder what vxFlushHandle() actually do, for example the memory structure between openVX and npu, so that the reason for calling vxFlushHandle().

sunshinemyson commented 3 years ago

vxFlushHandle() actually just flush the CPU cache back to the memory so that NPU can get right data - because NPU won't reuse cpu cache.