[Bug 108894] [anv] vkCmdCopyBuffer() and vkCmdCopyQueryPoolResults() write-after-write hazard

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Nov 29 09:06:47 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=108894

            Bug ID: 108894
           Summary: [anv] vkCmdCopyBuffer() and
                    vkCmdCopyQueryPoolResults() write-after-write hazard
           Product: Mesa
           Version: git
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Drivers/Vulkan/intel
          Assignee: intel-3d-bugs at lists.freedesktop.org
          Reporter: joseph.kucia at gmail.com
        QA Contact: intel-3d-bugs at lists.freedesktop.org
                CC: jason at jlekstrand.net

It seems to be impossible to synchronize vkCmdCopyBuffer() and
vkCmdCopyQueryPoolResults() commands. I think it should be enough to issue a
pipeline barrier with VK_PIPELINE_STAGE_TRANSFER_BIT and
VK_ACCESS_TRANSFER_WRITE_BIT between vkCmdCopyBuffer() and
vkCmdCopyQueryPoolResults() to avoid write-after-write hazards. However, in my
test case, I consistently get the value written by vkCmdCopyBuffer().
vkCmdCopyBuffer() is issued before vkCmdCopyQueryPoolResults().

--- api dump ---
vkCmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount) returns
void:
    commandBuffer:                  VkCommandBuffer = 0x55c2b2e7d430
    queryPool:                      VkQueryPool = 0x55c2b2dbd050
    firstQuery:                     uint32_t = 0
    queryCount:                     uint32_t = 1

vkCmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query) returns
void:
    commandBuffer:                  VkCommandBuffer = 0x55c2b2e7d430
    pipelineStage:                  VkPipelineStageFlagBits = 8192
(VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT)
    queryPool:                      VkQueryPool = 0x55c2b2dbd050
    query:                          uint32_t = 0

vkCmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions)
returns void:
    commandBuffer:                  VkCommandBuffer = 0x55c2b2e7d430
    srcBuffer:                      VkBuffer = 0x55c2b2e80150
    dstBuffer:                      VkBuffer = 0x55c2b2dbcfc0
    regionCount:                    uint32_t = 1
    pRegions:                       const VkBufferCopy* = 0x7ffc0d802d20
        pRegions[0]:                    const VkBufferCopy = 0x7ffc0d802d20:
            srcOffset:                      VkDeviceSize = 0
            dstOffset:                      VkDeviceSize = 0
            size:                           VkDeviceSize = 32

// we should issue a pipeline barrier here

vkCmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount,
dstBuffer, dstOffset, stride, flags) returns void:
    commandBuffer:                  VkCommandBuffer = 0x55c2b2e7d430
    queryPool:                      VkQueryPool = 0x55c2b2dbd050
    firstQuery:                     uint32_t = 0
    queryCount:                     uint32_t = 1
    dstBuffer:                      VkBuffer = 0x55c2b2dbcfc0
    dstOffset:                      VkDeviceSize = 0
    stride:                         VkDeviceSize = 8
    flags:                          VkQueryResultFlags = 3
(VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT)
--- api dump ---

The expected result is to get the value written by vkCmdCopyQueryPoolResults().
On Anvil, the result is the value written by vkCmdCopyBuffer().

I have a test case in the form of a vkd3d test:
https://source.winehq.org/git/vkd3d.git/blob/HEAD:/tests/d3d12.c#l18279
The test passes on RADV and Nvidia. Note that the current version of vkd3d
doesn't issue a required pipeline barrier between vkCmdCopyBuffer() and
vkCmdCopyQueryPoolResults().

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20181129/7a167c1e/attachment-0001.html>


More information about the intel-3d-bugs mailing list