Skip to content

[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

Merged
merged 4 commits into from
Aug 5, 2020

Conversation

glyons-intel
Copy link
Contributor

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]

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]>
@glyons-intel glyons-intel requested a review from a team as a code owner July 31, 2020 18:49
@glyons-intel glyons-intel requested a review from againull July 31, 2020 18:49
}

int devIdx = 0;
for (const auto &dev : plt.get_devices()) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

againull
againull previously approved these changes Aug 3, 2020
for (const auto &plt : platform::get_platforms()) {
pltIdx++;
if (plt.has(aspect::host)) {
std::cout << "Platform #" << pltIdx
Copy link
Contributor

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().

Copy link
Contributor Author

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>();
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@@ -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)
Copy link
Contributor

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.

Copy link
Contributor Author

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>();
Copy link
Contributor

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.

@againull againull self-requested a review August 5, 2020 16:38
@againull againull merged commit 89804af into intel:sycl Aug 5, 2020
@glyons-intel glyons-intel deleted the glyons/aspects branch January 28, 2021 21:30
jsji pushed a commit that referenced this pull request Jan 11, 2024
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
…zer-destruct-too-early

[DeviceAsan] Symbolizer may destruct before SanitizerInterceptor
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