Skip to content

Commit dbd0114

Browse files
authored
fix [RUNTIME][VULKAN] vkBuffer released before memory copy command send to GPU (#5388) (#5418)
1 parent 708fd9a commit dbd0114

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/runtime/vulkan/vulkan.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ class VulkanDeviceAPI final : public DeviceAPI {
189189
}
190190

191191
void FreeDataSpace(TVMContext ctx, void* ptr) final {
192+
// Before releasing the vkBuffer, call sync to
193+
// finish all the vulkan commands that reference the buffer.
194+
StreamSync(ctx, nullptr);
195+
192196
const auto& vctx = context(ctx.device_id);
193197
auto* pbuf = static_cast<VulkanBuffer*>(ptr);
194198
vkDestroyBuffer(vctx.device, pbuf->buffer, nullptr);

0 commit comments

Comments
 (0)