@@ -218,19 +218,20 @@ getOrBuild(KernelProgramCache &KPCache, KeyT &&CacheKey, AcquireFT &&Acquire,
218
218
}
219
219
}
220
220
221
+ // TODO replace this with a new PI API function
221
222
static bool isDeviceBinaryTypeSupported (const context &C,
222
223
RT::PiDeviceBinaryType Format) {
224
+ // All formats except PI_DEVICE_BINARY_TYPE_SPIRV are supported.
225
+ if (Format != PI_DEVICE_BINARY_TYPE_SPIRV)
226
+ return true ;
227
+
223
228
const backend ContextBackend =
224
229
detail::getSyclObjImpl (C)->getPlugin ().getBackend ();
225
230
226
231
// The CUDA backend cannot use SPIR-V
227
- if (ContextBackend == backend::cuda && Format == PI_DEVICE_BINARY_TYPE_SPIRV )
232
+ if (ContextBackend == backend::cuda)
228
233
return false ;
229
234
230
- // All formats except PI_DEVICE_BINARY_TYPE_SPIRV are supported.
231
- if (Format != PI_DEVICE_BINARY_TYPE_SPIRV)
232
- return true ;
233
-
234
235
vector_class<device> Devices = C.get_devices ();
235
236
236
237
// Program type is SPIR-V, so we need a device compiler to do JIT.
@@ -240,9 +241,14 @@ static bool isDeviceBinaryTypeSupported(const context &C,
240
241
}
241
242
242
243
// OpenCL 2.1 and greater require clCreateProgramWithIL
243
- if ((ContextBackend == backend::opencl) &&
244
- C.get_platform ().get_info <info::platform::version>() >= " 2.1" )
245
- return true ;
244
+ if (ContextBackend == backend::opencl) {
245
+ std::string ver = C.get_platform ().get_info <info::platform::version>();
246
+ if (ver.find (" OpenCL 1.0" ) == std::string::npos &&
247
+ ver.find (" OpenCL 1.1" ) == std::string::npos &&
248
+ ver.find (" OpenCL 1.2" ) == std::string::npos &&
249
+ ver.find (" OpenCL 2.0" ) == std::string::npos)
250
+ return true ;
251
+ }
246
252
247
253
for (const device &D : Devices) {
248
254
// We need cl_khr_il_program extension to be present
0 commit comments