Skip to content

[SYCL] Add device::get_info<info::device::aspects> specialisation #7937

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

Merged
merged 7 commits into from
Jan 16, 2023

Conversation

andylshort
Copy link

Specialised function to get a vector of the complete list of supported aspects for the current device, as per Table 25 of the spec.

Initial implementation uses the list of aspects, inserts them into an initial vector with a macro, and tests each using the existing ::has() functionality, removing them form the list if not applicable, returning only what is supported on the device. Thought this would reduce code duplication and could reuse the aspect definition list file. If this isn't appropriate, please do suggest alternatives.

The current test works but if it needs further development, do let me know.

Lamzed-Short, Andrew added 7 commits December 22, 2022 08:57
Defined new specialisation to return vector of aspects supported on
the current device.

Linux symbol update provided, Windows one still needs adding.
Tests using the default mock platform and device in PiMockPlugin and
tests for presence of relevant aspects.
@andylshort andylshort requested a review from a team as a code owner January 5, 2023 17:00
@andylshort andylshort requested review from steffenlarsen and a team January 5, 2023 17:00
try {
return !impl->has(Aspect);
} catch (const runtime_error &ex) {
if (ex.get_cl_code() == PI_ERROR_INVALID_DEVICE)
Copy link
Contributor

@AlexeySachkov AlexeySachkov Jan 5, 2023

Choose a reason for hiding this comment

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

That's surprising for me that our device_impl can throw INVALID_DEVICE in has method. What's wrong with asking if a device has an aspect? How can device be invalid in that case?

Copy link
Author

Choose a reason for hiding this comment

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

device_impl::has is implemented as a switch, it throws PI_ERROR_INVALID_DEVICE in the default case, so I thought it best to handle that one instance and rethrow others. Some testing I did threw this error so I added it, is it best to remove the try and let the exception be thrown normally and assume all aspects have an implemented code path?

@andylshort andylshort temporarily deployed to aws January 5, 2023 17:50 — with GitHub Actions Inactive
@andylshort andylshort temporarily deployed to aws January 7, 2023 12:24 — with GitHub Actions Inactive
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Sorry for the delay! Looks great! 😄

@andylshort andylshort temporarily deployed to aws January 13, 2023 13:39 — with GitHub Actions Inactive
@andylshort andylshort temporarily deployed to aws January 13, 2023 14:35 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen merged commit 7869c17 into intel:sycl Jan 16, 2023
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.

3 participants