Skip to content

Commit 3b8f7d7

Browse files
author
Andrew Savonichev
committed
Check for compiler before we check for 2.1
We can have a OpenCL 2.1 device but without a compiler. Signed-off-by: Andrew Savonichev <[email protected]>
1 parent ae7bd69 commit 3b8f7d7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,27 @@ static bool isDeviceBinaryTypeSupported(const context &C,
197197
if (Format != PI_DEVICE_BINARY_TYPE_SPIRV)
198198
return true;
199199

200+
vector_class<device> Devices = C.get_devices();
201+
202+
// Program type is SPIR-V, so we need a device compiler to do JIT.
203+
for (const device &D : Devices) {
204+
if (!D.get_info<info::device::is_compiler_available>())
205+
return false;
206+
}
207+
200208
// OpenCL 2.1 and greater require clCreateProgramWithIL
201209
if (pi::useBackend(pi::SYCL_BE_PI_OPENCL) &&
202210
C.get_platform().get_info<info::platform::version>() >= "2.1")
203211
return true;
204212

205-
for (const device &D : C.get_devices()) {
213+
for (const device &D : Devices) {
206214
// We need cl_khr_il_program extension to be present
207215
// and we can call clCreateProgramWithILKHR using the extension
208216
vector_class<string_class> Extensions =
209217
D.get_info<info::device::extensions>();
210218
if (Extensions.end() ==
211219
std::find(Extensions.begin(), Extensions.end(), "cl_khr_il_program"))
212220
return false;
213-
214-
if (!D.get_info<info::device::is_compiler_available>())
215-
return false;
216221
}
217222

218223
return true;

0 commit comments

Comments
 (0)