__attribute__((reqd_work_group_size(X, Y, Z))) is basically a hint for the compiler. It doesn't hurt to have it but at the end of the day, what determines the work-group size is the value you pass to clEnqueueNDRangeKernel().I guess that is what I should use for define work-groups size? Is it the only way, or the right way?
Notice that if you use the attribute above, it clEnqueueNDRangeKernel will return an error if the group size you pass to clEnqueueNDRangeKernel does not match the value in the attribute. In that sense it's more than a hint.
Sorry, I didn't understand the question.If I assign local work size, does work-group size define from this?
For example, in this
If the question is "how do I choose the right work-group size?", the answer is trial and error. There's no easy rule that will give you what is the best size for performance.How work-group (or work-group size) are assigned?