0
votes

I am working in a multikernel OpenCL implementation and I am not sure how different kernels map into compute units.

All my kernels execute concurrently and I think that only workgroups executing the same kernel are assigned to a single compute unit. So I deduce I have at least one compute unit for every different kernel I use. Am I right?

I know that I can use clGetDeviceInfo and look in the field CL_DEVICE_MAX_COMPUTE_UNITS, but it does not tell me how the kernels are distributed or how many compute units I am using.

And related to this question, if I do not specify how many compute units are going to be used with "attribute((num_compute_units(X)))", how many are used?

Thanks

1

1 Answers

0
votes

For most OpenCL work you can safely ignore the number of compute units. Also, if you plan to run on different kinds of hardware, you really should ignore it. For kernels that use shared local memory you will need to worry about maximum work group sizes, but that's a different thing. In that case you can code to the minimum across the hardware you plan to support, or write flexible kernels that can handle any workgroup size.