Skip to content

Commit

Permalink
[Vulkan] Workaround for zero size allocation (apache#7691)
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi authored and Trevor Morris committed May 6, 2021
1 parent da6dde7 commit da6743b
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 @@ -120,6 +120,10 @@ class VulkanDeviceAPI final : public DeviceAPI {
std::vector<uint32_t> GetComputeQueueFamilies(VkPhysicalDevice phy_dev);
void* AllocDataSpace(TVMContext ctx, size_t nbytes, size_t alignment,
DLDataType type_hint) final {
if (nbytes == 0) {
// Vulkan seems to have issues if we return nullptr on zero size alloc
nbytes = 1;
}
const auto& vctx = context(ctx.device_id);
VkBufferCreateInfo info;
info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
Expand Down

0 comments on commit da6743b

Please sign in to comment.