Skip to content

Commit 56c47fe

Browse files
Fix has_opencl_extension in case the device list is empty. (#5064)
@gshimansky's patch.
1 parent 001fd5a commit 56c47fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

third_party/intel/backend/driver.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,10 @@ extern "C" EXPORT_FUNC PyObject *wait_on_sycl_queue(PyObject *cap) {
366366

367367
extern "C" EXPORT_FUNC PyObject *has_opencl_extension(int device_id,
368368
const char *extension) {
369-
if (device_id > sycl_opencl_device_list.size()) {
370-
std::cerr << "Device is not found " << std::endl << std::flush;
371-
return NULL;
369+
if (device_id >= sycl_opencl_device_list.size()) {
370+
std::cerr << "Device is not found, extension " << extension << std::endl
371+
<< std::flush;
372+
Py_RETURN_FALSE;
372373
}
373374
const sycl::device &device = sycl_opencl_device_list[device_id];
374375

0 commit comments

Comments
 (0)