[SYCL][E2E] refactor: drop vulkan_common dependencies from bindless image tests - #23047
[SYCL][E2E] refactor: drop vulkan_common dependencies from bindless image tests#23047mianowski wants to merge 10 commits into
Conversation
KornevNikita
left a comment
There was a problem hiding this comment.
CODEOWNERS change LGTM.
|
@dyniols please review |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
| inline VkImageMemoryBarrier createImageMemoryBarrier(VkImage image, | ||
| uint32_t mipLevels) { | ||
| VkImageMemoryBarrier barrier{VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER}; | ||
| barrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; | ||
| barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL; | ||
| barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; | ||
| barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; | ||
| barrier.image = image; | ||
| barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; | ||
| barrier.subresourceRange.levelCount = mipLevels; | ||
| barrier.subresourceRange.layerCount = 1; | ||
| return barrier; | ||
| } |
| int main() { | ||
|
|
||
| if (vkutil::setupInstance() != VK_SUCCESS) { | ||
| std::cerr << "Instance setup failed!\n"; | ||
| return EXIT_FAILURE; | ||
| } | ||
|
|
||
| sycl::device dev; | ||
|
|
||
| if (vkutil::setupDevice(dev) != VK_SUCCESS) { | ||
| std::cerr << "Device setup failed!\n"; | ||
| return EXIT_FAILURE; | ||
| } | ||
|
|
||
| if (vkutil::setupCommandBuffers() != VK_SUCCESS) { | ||
| std::cerr << "Compute pipeline setup failed!\n"; | ||
| return EXIT_FAILURE; | ||
| } | ||
|
|
||
| bool result_ok = run_tests(); | ||
|
|
||
| if (vkutil::cleanup() != VK_SUCCESS) { | ||
| std::cerr << "Cleanup failed!\n"; | ||
| return EXIT_FAILURE; | ||
| } | ||
| VulkanContext vkCtx = createVulkanContext(); | ||
| bool result_ok = run_tests(vkCtx); | ||
| cleanupVulkanContext(vkCtx); |
| VulkanContext vkCtx = createVulkanContext(); | ||
| auto testPassed = runTest(vkCtx, syclDevice, {128, 128}, {16, 16}); | ||
| cleanupVulkanContext(vkCtx); | ||
|
|
| VkCommandPoolCreateInfo PoolInfo = { | ||
| VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO}; | ||
| PoolInfo.queueFamilyIndex = VulkanCtx.queueFamilyIndex; | ||
| VkCommandPool Pool; | ||
| VK_CHECK(vkCreateCommandPool(VulkanCtx.device, &PoolInfo, nullptr, &Pool)); | ||
| VkCommandBufferAllocateInfo CmdAllocInfo = { | ||
| VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO}; | ||
| CmdAllocInfo.commandPool = Pool; | ||
| CmdAllocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; | ||
| CmdAllocInfo.commandBufferCount = 1; | ||
| VkCommandBuffer CommandBuffer; | ||
| VK_CHECK(vkAllocateCommandBuffers(VulkanCtx.device, &CmdAllocInfo, | ||
| &CommandBuffer)); | ||
| VK_CHECK(vkBeginCommandBuffer(CommandBuffer, &Cbbi)); | ||
| vkCmdCopyBuffer(CommandBuffer, VkImportedBuffer, StagingBuffer, | ||
| 1 /*regionCount*/, &CopyRegion); | ||
| VK_CHECK_CALL(vkEndCommandBuffer(vk_transferCmdBuffers[0])); | ||
| VK_CHECK(vkEndCommandBuffer(CommandBuffer)); | ||
|
|
||
| std::vector<VkPipelineStageFlags> Stages{VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT}; | ||
|
|
||
| VkSubmitInfo Submission = {}; | ||
| Submission.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; | ||
| Submission.commandBufferCount = 1; | ||
| Submission.pCommandBuffers = &vk_transferCmdBuffers[0]; | ||
| Submission.pCommandBuffers = &CommandBuffer; | ||
| Submission.pWaitDstStageMask = Stages.data(); | ||
|
|
||
| VK_CHECK_CALL(vkQueueSubmit(vk_transfer_queue, 1 /*submitCount*/, | ||
| &Submission, VK_NULL_HANDLE /*fence*/)); | ||
| VK_CHECK_CALL(vkQueueWaitIdle(vk_transfer_queue)); | ||
| VK_CHECK(vkQueueSubmit(VulkanCtx.queue, 1, &Submission, VK_NULL_HANDLE)); | ||
| VK_CHECK(vkQueueWaitIdle(VulkanCtx.queue)); |
| // Use helper function to determine if data is accepted. | ||
| // For floats, use default accepted error variance. | ||
| if (!util::is_equal(outputVec[i], expected)) { | ||
| if (std::abs(outputVec[i] - expected) > 0.01f) { |
There was a problem hiding this comment.
maybe just bring over that utility routine? Or define a new one (occassionally_equal) ;-) ?
|
I think we can remove the |
Git doesn't store folders, only files. So, once the last file from a folder is gone, the folder vanishes too |
There was a problem hiding this comment.
🟡 Changes recommended
Device selection can pair different Vulkan and SYCL GPUs, and one migrated test lacks exception-safe cleanup.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 4
- Review effort level: Balanced
| std::cerr << "Instance setup failed!\n"; | ||
| VulkanContext VulkanCtx; | ||
| try { | ||
| VulkanCtx = createVulkanContext(); |
There was a problem hiding this comment.
I think we should restore UUID based selection in vulkan_setup.hpp. Specifically, instantiate the SYCL device once, pass it to createVulkanContext, and select the VkPhysicalDevice matching the SYCL device UUID.
However it doesn't have to be done in this PR because it will affect other vulkan interop tests and it could be done in another PR.
Your thoughts @cperkinsintel @0x12CC ?
| std::cerr << "Cleanup failed!\n"; | ||
| return 7; | ||
| } | ||
| auto TestPassed = runTest(VulkanCtx, SyclDevice, MemorySizeBytes); |
There was a problem hiding this comment.
🟡 Changes recommended
Device matching reads an uninitialized handle, and SYCL cleanup failures can incorrectly produce a passing result.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Balanced
| auto SyclDeviceUUID = | ||
| SyclDevice.get_info<sycl::ext::intel::info::device::uuid>(); | ||
| for (VkPhysicalDevice device : devices) { |
| } catch (const sycl::exception &e) { | ||
| std::cerr << "SYCL cleanup failed: " << e.what() << "\n"; | ||
| } catch (...) { | ||
| std::cerr << "Unknown exception during SYCL cleanup.\n"; | ||
| } |
dyniols
left a comment
There was a problem hiding this comment.
Overall looks great! Left a few minor comments and questions.
| vkEnumeratePhysicalDevices(ctx.instance, &deviceCount, devices.data()); | ||
| ctx.physicalDevice = devices[0]; | ||
|
|
||
| if (!SyclDevice.has(sycl::aspect::ext_intel_device_info_uuid)) |
There was a problem hiding this comment.
Can we avoid bringing SYCL code into vulkan_setup.hpp?
For example we could pass SYCL device UUID rather than pass SYCL device to here:
https://github.com/triSYCL/sycl/blob/sycl/unified/master/sycl/doc/extensions/supported/sycl_ext_intel_device_info.md#device-uuid
| for (VkPhysicalDevice device : devices) { | ||
| VkPhysicalDeviceIDProperties idProperties{ | ||
| VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES}; | ||
| VkPhysicalDeviceProperties2 properties{ |
There was a problem hiding this comment.
Consider zero initializing the Vulkan structures to avoid uninitialized member fields.
| vkFreeMemory(ctx.device, res.memory, nullptr); | ||
| } | ||
|
|
||
| inline VkCommandBuffer createCommandBuffer(VulkanContext &ctx, |
There was a problem hiding this comment.
Consider using const VulkanContext &ctx if ctx isn't modified here.
|
|
||
| inline VkCommandBuffer createCommandBuffer(VulkanContext &ctx, | ||
| VkCommandPool &pool) { | ||
| VkCommandPoolCreateInfo poolInfo{VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO}; |
There was a problem hiding this comment.
Same here zero initializing the Vulkan structures.
| vkDestroyCommandPool(ctx.device, pool, nullptr); | ||
| } | ||
|
|
||
| inline VkImageMemoryBarrier createImageMemoryBarrier(VkImage image, |
There was a problem hiding this comment.
If this is intended as a generic helper, should we expose VkImageLayout and VkAccessFlags as function parameters to make it more flexible?
There was a problem hiding this comment.
I know it's old change but we could do const sycl::exception &e.
|
Please add the |
#22885