diff --git a/src/runtime/vulkan/vulkan.cc b/src/runtime/vulkan/vulkan.cc index 80486406187b..4e2f8cbcc0bf 100644 --- a/src/runtime/vulkan/vulkan.cc +++ b/src/runtime/vulkan/vulkan.cc @@ -189,6 +189,10 @@ class VulkanDeviceAPI final : public DeviceAPI { } void FreeDataSpace(TVMContext ctx, void* ptr) final { + // Before releasing the vkBuffer, call sync to + // finish all the vulkan commands that reference the buffer. + StreamSync(ctx, nullptr); + const auto& vctx = context(ctx.device_id); auto* pbuf = static_cast(ptr); vkDestroyBuffer(vctx.device, pbuf->buffer, nullptr);