liangfu commented on a change in pull request #4527: [VTA] Fixed a crash issue
in TSIM driver
URL: https://github.com/apache/incubator-tvm/pull/4527#discussion_r358116691
##########
File path: 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<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);
Review comment:
In my observation, some part of the code reach to virtual addresses for data
accessing. This is the exactly the same behavior in sim_driver.cc
https://github.com/apache/incubator-tvm/blob/8e3b5d39c388f6767a2e69afff27eac55557567e/vta/src/sim/sim_driver.cc#L519-L525
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services