Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flakiness with clEnqueueCopyImage #709

Open
rjodinchr opened this issue Jul 31, 2024 · 3 comments
Open

flakiness with clEnqueueCopyImage #709

rjodinchr opened this issue Jul 31, 2024 · 3 comments

Comments

@rjodinchr
Copy link
Contributor

I am experiencing flakiness on different platforms (ARMs & few Intels) running some CTS copy_images tests.

It's always because of incorrect data in the output buffer.

I am wondering if we are missing something in cvk_command_image_image_copy::build_batchable_inner:

cl_int cvk_command_image_image_copy::build_batchable_inner(
    cvk_command_buffer& cmdbuf) {

    VkImageSubresourceLayers srcSubresource =
        prepare_subresource(m_src_image, m_src_origin, m_region);

    VkOffset3D srcOffset = prepare_offset(m_src_image, m_src_origin);

    VkImageSubresourceLayers dstSubresource =
        prepare_subresource(m_dst_image, m_dst_origin, m_region);

    VkOffset3D dstOffset = prepare_offset(m_dst_image, m_dst_origin);

    VkExtent3D extent = prepare_extent(m_src_image, m_region);

    VkImageCopy region = {srcSubresource, srcOffset, dstSubresource, dstOffset,
                          extent};

    vkCmdCopyImage(cmdbuf, m_src_image->vulkan_image(), VK_IMAGE_LAYOUT_GENERAL,
                   m_dst_image->vulkan_image(), VK_IMAGE_LAYOUT_GENERAL, 1,
                   &region);

    return CL_SUCCESS;
}

In other copies (image to buffer, buffer to image, image init) I see some vkCmdPipelineBarrier. Should we have one here as well?

@rjodinchr
Copy link
Contributor Author

rjodinchr commented Aug 13, 2024

Adding the following barrier after the copy did not fix the issue:

    VkMemoryBarrier memoryBarrier = {
        VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, VK_ACCESS_TRANSFER_WRITE_BIT,
        VK_ACCESS_MEMORY_WRITE_BIT | VK_ACCESS_MEMORY_READ_BIT};
    vkCmdPipelineBarrier(cmdbuf, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
                         VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 1,
                         &memoryBarrier, 0, nullptr, 0, nullptr);

@kpet
Copy link
Owner

kpet commented Aug 13, 2024

Right, the plot thickens. How reproducible is it?

@rjodinchr
Copy link
Contributor Author

It fails often enough to be easily reproducible. Depending on the test and the GPU, it varies from 10% to more than 50% of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants