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:
[li]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.[/1y7oevow][/li][li]if there are kernel objects attached to program.[/1y7oevow][/ol][/li]
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.
Check the The OpenCL Specification document, section “6.6 Access qualifiers”. read_only, write_only and read_write don’t apply to buffers, they apply to images only. The fact that you used read_only qualifier for buffers and ATI compiler processed it just means that their compiler allowed you to step aside from standard.