From 06352b7d15ec370215b9e6aacd7edba3ddef63fe Mon Sep 17 00:00:00 2001 From: Liangfu Chen Date: Wed, 24 Jun 2020 00:10:22 +0800 Subject: [PATCH] [BACKPORT-0.6][Bugfix][VTA] Fixed a crash issue in TSIM driver (#5894) --- vta/src/tsim/tsim_driver.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/vta/src/tsim/tsim_driver.cc b/vta/src/tsim/tsim_driver.cc index 94e5858b5949..646dbe17a2e6 100644 --- a/vta/src/tsim/tsim_driver.cc +++ b/vta/src/tsim/tsim_driver.cc @@ -188,25 +188,23 @@ TVM_REGISTER_GLOBAL("vta.tsim.profiler_status") } // namespace vta void* VTAMemAlloc(size_t size, int cached) { - void * addr = vta::vmem::VirtualMemoryManager::Global()->Alloc(size); - return reinterpret_cast(vta::vmem::VirtualMemoryManager::Global()->GetPhyAddr(addr)); + return vta::vmem::VirtualMemoryManager::Global()->Alloc(size); } void VTAMemFree(void* buf) { - void * addr = vta::vmem::VirtualMemoryManager::Global()->GetAddr(reinterpret_cast(buf)); - vta::vmem::VirtualMemoryManager::Global()->Free(addr); + vta::vmem::VirtualMemoryManager::Global()->Free(buf); } vta_phy_addr_t VTAMemGetPhyAddr(void* buf) { - return reinterpret_cast(reinterpret_cast(buf)); + return vta::vmem::VirtualMemoryManager::Global()->GetPhyAddr(buf); } void VTAMemCopyFromHost(void* dst, const void* src, size_t size) { - vta::vmem::VirtualMemoryManager::Global()->MemCopyFromHost(dst, src, size); + memcpy(dst, src, size); } void VTAMemCopyToHost(void* dst, const void* src, size_t size) { - vta::vmem::VirtualMemoryManager::Global()->MemCopyToHost(dst, src, size); + memcpy(dst, src, size); } void VTAFlushCache(void* vir_addr, vta_phy_addr_t phy_addr, int size) {