Skip to content

[UR][OpenCL] Fix device get_info(CL_DEVICE_PARTITION_TYPE) when size returned is 0 - #23627

Open
VerenaBeckham wants to merge 2 commits into
intel:syclfrom
VerenaBeckham:verena/get_info
Open

VerenaBeckham wants to merge 2 commits into
intel:syclfrom
VerenaBeckham:verena/get_info

Conversation

@VerenaBeckham

Copy link
Copy Markdown
Contributor

This fixes sycl-ls for the OpenCLOn12 Platform.

This ticket KhronosGroup/OpenCL-Docs#1475 shows that (at least at the current interpretation of the OpenCL spec) if the device does not support partitioning it should be valid to either

  • return an array of size 1 containing 0 (as was already handled) OR
  • return size 0.

Up to now there was an assumption in UR that the first would always be true, which led to an array-out-of-bounds access in the latter case, which is what is returned by, e.g., OpenCLOn12.

@VerenaBeckham
VerenaBeckham requested a review from a team as a code owner October 26, 2026 15:46
@VerenaBeckham

Copy link
Copy Markdown
Contributor Author

Tagging @uditagarwal97 @KornevNikita @kswiecicki due to history of this file.

@@ -191,7 +191,7 @@ ur_result_t urDeviceGetInfo(ur_device_handle_t hDevice,
/* The OpenCL implementation returns a value of 0 if no properties are

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you also improve the comment? Something like If device partitioning is not supported, OpenCL may return either a size of 0 or an array containing a single 0. UR reports a size of 0 in both cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, done.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

2 participants