halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.91k stars 1.07k forks source link

[vulkan] Validation errors for DST bit usage on transfer buffers #8466

Open mcourteaux opened 2 weeks ago

mcourteaux commented 2 weeks ago

I noticed this on the build bot:

https://buildbot.halide-lang.org/master/#/builders/67/builds/630

at correctness_async_device_copy:

VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x5bb80721eea0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2cfba2000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | vkCmdCopyBuffer(): dstBuffer (VkBuffer 0x2cfba2000000001c[]) was created with VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR|VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_DST_BIT.
The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)
    Objects: 2
        [0] 0x5bb80721eea0, type: 6, name: NULL
        [1] 0x2cfba2000000001c, type: 9, name: NULL
VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x5bb80721eea0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2cfba2000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | vkCmdCopyBuffer(): dstBuffer (VkBuffer 0x2cfba2000000001c[]) was created with VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR|VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_DST_BIT.
The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)
    Objects: 2
        [0] 0x5bb80721eea0, type: 6, name: NULL
        [1] 0x2cfba2000000001c, type: 9, name: NULL
VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x5bb80721eea0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2cfba2000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | vkCmdCopyBuffer(): dstBuffer (VkBuffer 0x2cfba2000000001c[]) was created with VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR|VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_DST_BIT.
The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)
    Objects: 2
        [0] 0x5bb80721eea0, type: 6, name: NULL
        [1] 0x2cfba2000000001c, type: 9, name: NULL
VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x5bb80721eea0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2cfba2000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | vkCmdCopyBuffer(): dstBuffer (VkBuffer 0x2cfba2000000001c[]) was created with VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR|VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_DST_BIT.
The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)
    Objects: 2
        [0] 0x5bb80721eea0, type: 6, name: NULL
        [1] 0x2cfba2000000001c, type: 9, name: NULL
VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x5bb80721eea0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2cfba2000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | vkCmdCopyBuffer(): dstBuffer (VkBuffer 0x2cfba2000000001c[]) was created with VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR|VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_DST_BIT.
The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)
    Objects: 2
        [0] 0x5bb80721eea0, type: 6, name: NULL
        [1] 0x2cfba2000000001c, type: 9, name: NULL
VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x5bb80721eea0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2cfba2000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | vkCmdCopyBuffer(): dstBuffer (VkBuffer 0x2cfba2000000001c[]) was created with VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR|VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_DST_BIT.
The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)
    Objects: 2
        [0] 0x5bb80721eea0, type: 6, name: NULL
        [1] 0x2cfba2000000001c, type: 9, name: NULL
VUID-vkCmdCopyBuffer-dstBuffer-00120(ERROR / SPEC): msgNum: 1355715885 - Validation Error: [ VUID-vkCmdCopyBuffer-dstBuffer-00120 ] Object 0: handle = 0x5bb80721eea0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x2cfba2000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0x50ce952d | vkCmdCopyBuffer(): dstBuffer (VkBuffer 0x2cfba2000000001c[]) was created with VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR|VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR but requires VK_BUFFER_USAGE_TRANSFER_DST_BIT.
The Vulkan spec states: dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag (https://vulkan.lunarg.com/doc/view/1.3.296.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdCopyBuffer-dstBuffer-00120)
    Objects: 2
        [0] 0x5bb80721eea0, type: 6, name: NULL
        [1] 0x2cfba2000000001c, type: 9, name: NULL
Case 1: 1.816708
Case 2: 0.021070
Case 3: 0.019726
Success!

Looking at vulkan.cpp there are a few places that use MemoryUsage::TransferSrc for buffer copies indeed.