masahi commented on a change in pull request #7833:
URL: https://github.com/apache/tvm/pull/7833#discussion_r612765702
##########
File path: src/runtime/vulkan/vulkan.cc
##########
@@ -60,35 +91,21 @@ class VulkanThreadEntry {
pool.reset();
streams_.clear();
for (const auto& kv : staging_buffers_) {
- if (!kv.second) {
- continue;
- }
- auto& buf = *(kv.second);
- if (buf.host_addr != nullptr) {
- vkUnmapMemory(buf.device, buf.memory);
- }
- if (buf.memory != VK_NULL_HANDLE) {
- vkFreeMemory(buf.device, buf.memory, nullptr);
- }
- if (buf.buffer != VK_NULL_HANDLE) {
- vkDestroyBuffer(buf.device, buf.buffer, nullptr);
- }
+ DeleteHostVisibleBuffer(kv.second.get());
Review comment:
ok, UBO reallocation is supposed to happen only pipeline creation time,
so it is not frequent I think.
I'm adding code like this, the problem is: What should the cpu device ID be?
Can we assume it is 0?
```
if (buf.device != nullptr && buf.size < size) {
// free previous buffer
DeleteHostVisibleBuffer(&buf);
if (sync_after_realloc) {
auto cpu_device_id = ???
VulkanThreadEntry::ThreadLocal()->Stream(cpu_device_id)->Synchronize();
}
}
```
--
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]