Skip to content

Commit

Permalink
fix crash issue in tsim backend (apache#4527)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfu authored and tmoreau89 committed Dec 16, 2019
1 parent 81327ed commit 919681d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/tsim/tsim_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<void*>(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<uint64_t>(buf));
vta::vmem::VirtualMemoryManager::Global()->Free(addr);
vta::vmem::VirtualMemoryManager::Global()->Free(buf);
}

vta_phy_addr_t VTAMemGetPhyAddr(void* buf) {
return reinterpret_cast<uint64_t>(reinterpret_cast<uint64_t*>(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) {
Expand Down

0 comments on commit 919681d

Please sign in to comment.