I came across an issue when compiling OpenCL programs. I'm working on a compiler that supports moving operations to OpenCL. I implemented a method that first calls clCreateProgramWithSource and then, given that the errcode_ret was CL_SUCCESS, calls clBuildProgram immediately after, passing null for pfn_notify.
For certain operations, the second call results in CL_INVALID_OPERATION. According to the spec, this is due to one of the following reasons:
- if the build of a program executable for any of the devices listed in device_list by a previous call to clBuildProgram for program has not completed.[/*:m:1y7oevow]
- if there are kernel objects attached to program.[/*:m:1y7oevow]
I don't see how any of the two conditions might be satisfied. There cannot be any uncompleted calls to clBuildProgram for program, because program was just created from the source before. By the same reasoning, there can also not be any kernels attached to program.
What could I be missing here?