PDA

View Full Version : Invalid Operation using clBuildProgram



Banjobeni
06-26-2011, 06:36 AM
Hi,

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?

Banjobeni
06-27-2011, 05:08 AM
I have found the source of the problem. It seems ATI does not accept the read_write modifier for buffer objects.

And then it outputs CL_INVALID_OPERATION. So if you get this error, double check whether you're using an ATI card and read_write for a buffer object.

There is only one thing that is worse than not returning an error: returning the wrong one.

david.garcia
07-06-2011, 05:16 AM
It seems ATI does not accept the read_write modifier for buffer objects.

Correction: the standard does not allow the read_only qualifier for buffer objects.

Banjobeni
07-06-2011, 05:23 AM
I have used read_only successfully many times. It is read_write that makes the compilation for an ATI card fail and output the wrong error.

Where would that be detailed in the spec?

Maxim Milakov
07-06-2011, 05:31 AM
I have used read_only successfully many times. It is read_write that makes the compilation for an ATI card fail and output the wrong error.

Where would that be detailed in the spec?

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.

Banjobeni
07-06-2011, 05:37 AM
Thanks for correcting that.

Could you maybe try to be more specific when you write stuff like this:

Correction: the standard does not allow the read_only qualifier for buffer objects.
In the end, it is correct, but suggests that other modifiers are valid. And now they are not.

Maxim Milakov
07-06-2011, 05:58 AM
Thanks for correcting that.

Could you maybe try to be more specific when you write stuff like this:

Correction: the standard does not allow the read_only qualifier for buffer objects.
In the end, it is correct, but suggests that other modifiers are valid. And now they are not.

Banjobeni, you cited david.garcia's words, not mine.

Banjobeni
07-06-2011, 06:02 AM
Oh, sorry, my bad. It seems I got used to the fact that only David Garcia answers my questions :-)

Sorry again, I did not mean to be rude in any way.

david.garcia
07-06-2011, 03:04 PM
Could you maybe try to be more specific when you write stuff like this

Sure. It takes time to find the exact section and it seemed to me like most people didn't care about the details and simply took my word for it, so sometimes I don't bother.