-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Added support for aspects and the has() function. #2237
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
The SYCL 2020 Provisional Spec adds a new concept called device "aspects", which provide a way for an application to query whether a device supports certain features which are not available on all devices. The device::has() function returns true if a device supports the aspect, and false otherwise. The platform::has() function returns true if all devices on the platform support the given aspect, and false otherwise. Signed-off-by: Gail Lyons <[email protected]>
sycl/test/basic_tests/aspects.cpp
Outdated
} | ||
|
||
int devIdx = 0; | ||
for (const auto &dev : plt.get_devices()) { |
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.
Some devices support these features and some devices not, i.e. this test could fail on some devices. I mean, for example, we probably cannot assume that any gpu must support fp16 or fp64 etc.
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.
Done.
Signed-off-by: Gail Lyons <[email protected]>
for (const auto &plt : platform::get_platforms()) { | ||
pltIdx++; | ||
if (plt.has(aspect::host)) { | ||
std::cout << "Platform #" << pltIdx |
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.
Currently this test only checks that has() method can be called, but it doesn't check its result. Probably it is better to query same info using existing SYCL methods (like get_info) and compare it with the result of has().
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.
The aspect::has() function calls get_info() to see if the requested aspect is supported. Whether it is right or wrong, has() and get_info() will always agree.
@@ -210,8 +209,7 @@ vector_class<device> device_impl::create_sub_devices( | |||
const cl_device_partition_property Properties[3] = { | |||
CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, | |||
(cl_device_partition_property)AffinityDomain, 0}; | |||
size_t SubDevicesCount = | |||
get_info<info::device::partition_max_sub_devices>(); | |||
size_t SubDevicesCount = get_info<info::device::partition_max_sub_devices>(); |
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.
It doesn't look like you've made any changes here and above in this file. Could you please preserve old formatting?
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.
This is not me, it is clang-format. I do not know why it suddenly changed these lines.
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.
it is because clang-format was applied to the whole file. Please apply it only to the changes made in this PR.
Signed-off-by: Gail Lyons <[email protected]>
Signed-off-by: Gail Lyons <[email protected]>
sycl/CMakeLists.txt
Outdated
@@ -14,7 +14,7 @@ include(AddSYCLExecutable) | |||
set(SYCL_MAJOR_VERSION 2) | |||
set(SYCL_MINOR_VERSION 1) | |||
set(SYCL_PATCH_VERSION 0) | |||
set(SYCL_DEV_ABI_VERSION 5) | |||
set(SYCL_DEV_ABI_VERSION 4) |
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.
Gail, looks like you reverted the version change by mistake.
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.
It was the ABI version that I updated, and that I am now reverting.
@@ -210,8 +209,7 @@ vector_class<device> device_impl::create_sub_devices( | |||
const cl_device_partition_property Properties[3] = { | |||
CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, | |||
(cl_device_partition_property)AffinityDomain, 0}; | |||
size_t SubDevicesCount = | |||
get_info<info::device::partition_max_sub_devices>(); | |||
size_t SubDevicesCount = get_info<info::device::partition_max_sub_devices>(); |
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.
it is because clang-format was applied to the whole file. Please apply it only to the changes made in this PR.
Commit also adds new extension metadata FPGAClusterAttributesV2INTEL. Specification: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/INTEL/SPV_INTEL_fpga_cluster_attributes.asciidoc Original commit: KhronosGroup/SPIRV-LLVM-Translator@4f0122b
…zer-destruct-too-early [DeviceAsan] Symbolizer may destruct before SanitizerInterceptor
The SYCL 2020 Provisional Spec adds a new concept called device "aspects",
which provide a way for an application to query whether a device supports
certain features which are not available on all devices.
The device::has() function returns true if a device supports the aspect,
and false otherwise. The platform::has() function returns true if all
devices on the platform support the given aspect, and false otherwise.
Signed-off-by: Gail Lyons [email protected]