@@ -51,12 +51,17 @@ void handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
51
51
// versions. If this is an OpenCL backend, get the version.
52
52
bool IsOpenCL = false ; // Backend is any OpenCL version
53
53
bool IsOpenCLV1x = false ; // Backend is OpenCL 1.x
54
- bool IsOpenCLV20 = false ; // Backend is OpenCL 2.0
55
- if (Platform.get_backend () == sycl::backend::opencl) {
54
+ bool IsOpenCLVGE20 = false ; // Backend is Greater or Equal to OpenCL 2.0
55
+ bool IsLevelZero = false ; // Backend is any OneAPI Level 0 version
56
+ auto Backend = Platform.get_backend ();
57
+ if (Backend == sycl::backend::opencl) {
56
58
std::string VersionString = DeviceImpl.get_info <info::device::version>();
57
59
IsOpenCL = true ;
58
60
IsOpenCLV1x = (VersionString.find (" 1." ) == 0 );
59
- IsOpenCLV20 = (VersionString.find (" 2.0" ) == 0 );
61
+ IsOpenCLVGE20 =
62
+ (VersionString.find (" 2." ) == 0 ) || (VersionString.find (" 3." ) == 0 );
63
+ } else if (Backend == sycl::backend::ext_oneapi_level_zero) {
64
+ IsLevelZero = true ;
60
65
}
61
66
62
67
size_t CompileWGSize[3 ] = {0 };
@@ -69,7 +74,7 @@ void handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
69
74
// PI_ERROR_INVALID_WORK_GROUP_SIZE if local_work_size is NULL and the
70
75
// reqd_work_group_size attribute is used to declare the work-group size
71
76
// for kernel in the program source.
72
- if (!HasLocalSize && (IsOpenCLV1x || IsOpenCLV20 )) {
77
+ if (!HasLocalSize && (IsOpenCLV1x || IsOpenCLVGE20 )) {
73
78
throw sycl::nd_range_error (
74
79
" OpenCL 1.x and 2.0 requires to pass local size argument even if "
75
80
" required work-group size was specified in the program source" ,
@@ -91,7 +96,6 @@ void handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
91
96
std::to_string (CompileWGSize[0 ]) + " }" ,
92
97
PI_ERROR_INVALID_WORK_GROUP_SIZE);
93
98
}
94
- if (IsOpenCL) {
95
99
if (IsOpenCLV1x) {
96
100
// OpenCL 1.x:
97
101
// PI_ERROR_INVALID_WORK_GROUP_SIZE if local_work_size is specified and
@@ -110,8 +114,8 @@ void handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
110
114
" Total number of work-items in a work-group cannot exceed " +
111
115
std::to_string (MaxWGSize),
112
116
PI_ERROR_INVALID_WORK_GROUP_SIZE);
113
- } else {
114
- // OpenCL 2.x:
117
+ } else if (IsOpenCLVGE20 || IsLevelZero) {
118
+ // OpenCL 2.x or OneAPI Level Zero :
115
119
// PI_ERROR_INVALID_WORK_GROUP_SIZE if local_work_size is specified and
116
120
// the total number of work-items in the work-group computed as
117
121
// local_work_size[0] * ... * local_work_size[work_dim - 1] is greater
@@ -128,10 +132,9 @@ void handleInvalidWorkGroupSize(const device_impl &DeviceImpl, pi_kernel Kernel,
128
132
" Total number of work-items in a work-group cannot exceed " +
129
133
std::to_string (KernelWGSize) + " for this kernel" ,
130
134
PI_ERROR_INVALID_WORK_GROUP_SIZE);
135
+ } else {
136
+ // TODO: Should probably have something similar for the other backends
131
137
}
132
- } else {
133
- // TODO: Should probably have something similar for the other backends
134
- }
135
138
136
139
if (HasLocalSize) {
137
140
// Is the global range size evenly divisible by the local workgroup size?
0 commit comments