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 Trevor Morris committed Jun 18, 2020
1 parent 0f79884 commit 8be8682
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 8be8682

Please sign in to comment.