Found it. I am not sure why I had &ret
(cl_int
return value) as the last parameter instead of having it as the return value of clBuildProgram
. Moving it and setting the last parameter to NULL fixes the problem:
wrong:
clBuildProgram(*program, 1, &device_id, opts.str().c_str(), NULL, &ret);
correct:
ret = clBuildProgram(*program, 1, &device_id, opts.str().c_str(), NULL, NULL);
I do understand why this problem occured - apparently the compiler / the OpenCL libraries understood that I wanted to use pfn_notify
and asynchronously build my kernel. I am, however, not sure if this behavior is fully conformant to the OpenCL documentation:
If pfn_notify is NULL, clBuildProgram does not return until the build has completed.
In my code, the pfn_notify
argument was actually NULL
, however user_data was (erroneously) not. While my code didn't make any sense, I believe that user_data should be ignored when pfn_notify
is NULL
.
I posted this on the Intel forums to see if they agree with my interpretation of the documentation.