Skip to content

Commit

Permalink
fix [RUNTIME][VULKAN] vkBuffer released before memory copy command se…
Browse files Browse the repository at this point in the history
…nd to GPU (apache#5388) (apache#5418)
  • Loading branch information
samwyi authored and dpankratz committed Apr 24, 2020
1 parent d8e09af commit 5b16db6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/vulkan/vulkan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<VulkanBuffer*>(ptr);
vkDestroyBuffer(vctx.device, pbuf->buffer, nullptr);
Expand Down

0 comments on commit 5b16db6

Please sign in to comment.