-
Notifications
You must be signed in to change notification settings - Fork 130
[SYCL] Fix tests using device version #1019
base: intel
Are you sure you want to change the base?
Changes from all commits
15e9e75
31b6565
8a01a78
234b4f7
447a4e5
4fda975
8e4f4d2
a3286e9
634f00f
0cda86d
6dbb529
f144695
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,5 +169,16 @@ bool core_sg_supported(const device &Device) { | |
auto Vec = Device.get_info<info::device::extensions>(); | ||
if (std::find(Vec.begin(), Vec.end(), "cl_khr_subgroups") != std::end(Vec)) | ||
return true; | ||
return Device.get_info<info::device::version>() >= "2.1"; | ||
|
||
if (Device.get_backend() == sycl::backend::opencl) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this not internal to opencl plugin? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the OpenCL backend defines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean that plugin would check native version and return if "cl_khr_subgroups" extension is supported or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see what you mean, we could maybe do that, but I'm not sure it's quite correct, looking into it, I believe Could we leave it as-is in this PR that's just changing the version number, and I'll look into updating that in a follow-up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, sure |
||
// Extract the numerical version from the version string, OpenCL version | ||
// string have the format "OpenCL <major>.<minor> <vendor specific data>". | ||
std::string ver = Device.get_info<info::device::version>().substr(7, 3); | ||
|
||
// cl_khr_subgroups was core in OpenCL 2.1 and 2.2, but went back to | ||
// optional in 3.0 | ||
return ver >= "2.1" && ver < "3.0"; | ||
} | ||
|
||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change to the device version stuff looks good to me, but I'm a bit confused -- do we currently return false for all the non-OpenCL backends? Or do the NVIDIA and AMD backends report support for cl_khr_subgroups in their extensions list? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think the initial intent was for backends supporting it to return In theory we should probably report it from the Nvidia and AMD backends but I don't think we currently do. It's not ideal because since this is a runtime check it mostly looks like the tests are working even if they're disabled. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that's pretty confusing. Thanks for explaining it. I think long-term we should look to remove this check entirely. Sub-groups are a core feature of SYCL 2020 and should work everywhere. But I'm happy for that to be done as part of a separate PR. |
||
} |
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.
@Pennycook @steffenlarsen I had to update these as well, but it looks like these tests were never running on OpenCL.
Since the OpenCL plugin was trimming the version it always returned just the number without
OpenCL
in front, so I believe it would always get caught by theOffset == std::string::npos
condition and exit.As I understand it, the group collectives are mandatory starting in OpenCL 2.0 but they're optional again in OpenCL 3.0, and without using interop I don't think we have a way to know if the implementation supports them. But also I think these are mandatory in SYCL2020 so I'm not too sure how we should handle it.
So I think this check is slightly better than before, but we may need to revisit this later on, at the very least it should fix the issues showing up in the CI for the CPU OpenCL which is 3.0 and seemingly doesn't work with the group collectives right now.
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.
Group algorithms and sub-groups are mandatory in SYCL.
I think we should somehow be checking for these missing features, so we can give a warning/error when somebody tries to use a backend that's missing certain things. @bashbaug might have some ideas about how to query things in this case. Using OpenCL interop might be the way to go.