-
Notifications
You must be signed in to change notification settings - Fork 787
[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
Conversation
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.
try { | ||
return !impl->has(Aspect); | ||
} catch (const runtime_error &ex) { | ||
if (ex.get_cl_code() == PI_ERROR_INVALID_DEVICE) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this 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! 😄
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.