Skip to content

Conversation

shajder
Copy link
Contributor

@shajder shajder commented Feb 21, 2025

Fixes #2155 according to issue description

Additional remark: The image size was previously calculated based on the memory size, which seems unusual. Due to Vulkan's configuration capabilities, the size of memory allocated for a specific texture may differ from what would be expected based on the texture dimensions. Thus, calculating the image dimensions back from the memory size of a Vulkan texture can be challenging.

@bashbaug
Copy link
Contributor

bashbaug commented Apr 1, 2025

@shajder is this ready for review? I see you removed the "focused review" label - thanks!

@shajder
Copy link
Contributor Author

shajder commented Apr 1, 2025

@shajder is this ready for review? I see you removed the "focused review" label - thanks!

yes - it is ready for review. I removed the label "focused review" because @joshqti mentioned he needed more time for debugging.

@joshqti
Copy link
Contributor

joshqti commented Apr 15, 2025

I still see a segfault in vkGetImageSubresourceLayout

@joshqti
Copy link
Contributor

joshqti commented Apr 15, 2025

VUID-vkGetImageSubresourceLayout-mipLevel-01716(ERROR / SPEC): msgNum: -1906823971 - Validation Error: [ VUID-vkGetImageSubresourceLayout-mipLevel-01716 ] Object 0: handle = 0x90c9290000000714, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x8e582cdd | vkGetImageSubresourceLayout(): pSubresource.mipLevel (1) must be less than 1. The Vulkan spec states: The mipLevel member of pSubresource must be less than the mipLevels specified in VkImageCreateInfo when image was created (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkGetImageSubresourceLayout-mipLevel-01716) Objects: 1 [0] 0x90c9290000000714, type: 10, name: NULL

@shajder
Copy link
Contributor Author

shajder commented Apr 17, 2025

`VUID-vkGetImageSubresourceLayout-mipLevel-01716(ERROR / SPEC): msgNum: -1906823971 - Validation Error: [ VUID-vkGetImageSubresourceLayout-mipLevel-01716 ] Object 0: handle = 0x90c9290000000714, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x8e582cdd | vkGetImageSubresourceLayout(): pSubresource.mipLevel (1) must be less than 1...

This one is fixed, still it didn't cause crash at my machine (nvidia driver version: 550.120)

return TEST_FAIL;
}
auto layout = vkImage1D.getSubresourceLayout();
errNum = getCLImageInfoFromVkImageInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing a test failure in consistence 1d/3d (line 180 for 3D), where host_ptr is NULL and row_pitch/slice_pitch are non zero. The OpenCL spec requires row_pitch/slice_pitch to be zero when hostptr is NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test does not run for me since #2349 was merged. I am investigating the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with this because it is an improvement. It would be better if row-pitch and slice pitch are specified, if assume linear is set. This should be a follow-up PR if not done in a follow-up patch set.

@joshqti it seems like we're going in circles here. I just removed the computations related to row_pitch/slice_pitch, but please note they were added recently in response to the previous request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that particular subtest passes a NULL host pointer, which is a violation of the OpenCL spec to pass row-pitch or slice pitch with NULL host pointer, and not using image import.

// Passing NULL properties and a valid image_format and image_desc image = clCreateImageWithProperties(context, NULL, CL_MEM_READ_WRITE, &img_format, &image_desc, NULL, &errNum); test_error(errNum, "Unable to create image with NULL properties " "with valid image format and image desc");

I think the problem isn't your change in this case, I think this test case should be deleted. The properties are NULL, and therefore this check has nothing to to with OpenCL-Vulkan interop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I have restored changes from last commit and removed mentioned subtests. Let me know if that works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, no issues running

Copy link
Contributor

@joshqti joshqti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as discussed on 5/25 main meeting.

@bashbaug
Copy link
Contributor

Merging as discussed in the May 27th memory subgroup.

@bashbaug bashbaug merged commit f30a191 into KhronosGroup:main May 27, 2025
9 checks passed
@bashbaug bashbaug deleted the vulkan_fix_image3d_test branch May 27, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong cl_image_desc setup collected from VkImageCreateInfo
4 participants