-
Notifications
You must be signed in to change notification settings - Fork 23
mixing cl_khr_icd version 1 and 2 ICD causes qsort to overwrite dispatch table to NULL #39
Copy link
Copy link
Closed
Description
I had a user reporting a crash starting with the enablement of cl_khr_icd version 2.
I debugged a little and it appears that after ocl-icd properly sets the dispatch table through clIcdSetPlatformDispatchDataKHR ocl-icd might reorder the platforms for qsort. This corrupts the set dispatch table:
Thread 1 "clinfo" hit Hardware watchpoint 2: -location p->disp_data.dispatch.clGetPlatformInfo
Old value = (cl_int (*)(cl_platform_id, cl_platform_info, size_t, void *, size_t *)) 0x7fffe67b6a90 <rusticl::api::icd::clGetPlatformInfo>
New value = (cl_int (*)(cl_platform_id, cl_platform_info, size_t, void *, size_t *)) 0x0
0x00007ffff7eaf600 in __memmove_avx_unaligned_erms () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff7eaf600 in __memmove_avx_unaligned_erms () from /lib64/libc.so.6
#1 0x00007ffff7d879e4 in indirect_msort_with_tmp () from /lib64/libc.so.6
#2 0x00007ffff7d87b69 in qsort_r () from /lib64/libc.so.6
#3 0x00007ffff7f80c18 in _sort_platforms (picds=0x555558237980, npicds=4) at ../ocl_icd_loader.c:413
#4 0x00007ffff7f81ab4 in _find_and_check_platforms (num_icds=5) at ../ocl_icd_loader.c:636
#5 0x00007ffff7f82af3 in __initClIcd () at ../ocl_icd_loader.c:917
#6 0x00007ffff7f82c32 in _initClIcd_real () at ../ocl_icd_loader.c:968
#7 0x00007ffff7f82d3f in _initClIcd () at ../ocl_icd_loader.c:997
#8 0x00007ffff7f83761 in clGetPlatformIDs (num_entries=0, platforms=0x0, num_platforms=0x7fffffffd400) at ../ocl_icd_loader.c:1162
#9 0x000055555555580e in main ()
Running with OCL_ICD_PLATFORM_SORT=none does prevent the corruption from occuring.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels