Skip to content

Commit 02dc606

Browse files
committed
Update tests for new OpenCL version definition
See discussions on: intel/llvm-test-suite#1019
1 parent 1048cbb commit 02dc606

File tree

4 files changed

+20
-47
lines changed

4 files changed

+20
-47
lines changed

sycl/test-e2e/Basic/info_ocl_version.cpp

Lines changed: 0 additions & 36 deletions
This file was deleted.

sycl/test-e2e/GroupAlgorithm/SYCL2020/support.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ bool isSupportedDevice(device D) {
1111

1212
if (PlatformName.find("OpenCL") != std::string::npos) {
1313
std::string Version = D.get_info<info::device::version>();
14-
size_t Offset = Version.find("OpenCL");
15-
if (Offset == std::string::npos)
16-
return false;
17-
Version = Version.substr(Offset + 7, 3);
18-
if (Version >= std::string("2.0"))
14+
15+
// Group collectives are mandatory in OpenCL 2.0 but optional in 3.0.
16+
Version = Version.substr(7, 3);
17+
if (Version >= "2.0" && Version < "3.0")
1918
return true;
2019
}
2120

sycl/test-e2e/GroupAlgorithm/support.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ bool isSupportedDevice(device D) {
1515

1616
if (PlatformName.find("OpenCL") != std::string::npos) {
1717
std::string Version = D.get_info<sycl::info::device::version>();
18-
size_t Offset = Version.find("OpenCL");
19-
if (Offset == std::string::npos)
20-
return false;
21-
Version = Version.substr(Offset + 7, 3);
22-
if (Version >= std::string("2.0"))
18+
19+
// Group collectives are mandatory in OpenCL 2.0 but optional in 3.0.
20+
Version = Version.substr(7, 3);
21+
if (Version >= "2.0" && Version < "3.0")
2322
return true;
2423
}
2524

sycl/test-e2e/SubGroup/helper.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,5 +169,16 @@ bool core_sg_supported(const device &Device) {
169169
auto Vec = Device.get_info<info::device::extensions>();
170170
if (std::find(Vec.begin(), Vec.end(), "cl_khr_subgroups") != std::end(Vec))
171171
return true;
172-
return Device.get_info<info::device::version>() >= "2.1";
172+
173+
if (Device.get_backend() == sycl::backend::opencl) {
174+
// Extract the numerical version from the version string, OpenCL version
175+
// string have the format "OpenCL <major>.<minor> <vendor specific data>".
176+
std::string ver = Device.get_info<info::device::version>().substr(7, 3);
177+
178+
// cl_khr_subgroups was core in OpenCL 2.1 and 2.2, but went back to
179+
// optional in 3.0
180+
return ver >= "2.1" && ver < "3.0";
181+
}
182+
183+
return false;
173184
}

0 commit comments

Comments
 (0)