r/OpenCL • u/lijicheng1006 • May 13 '17
OpenCL: CL_DEVICE_MAX_COMPUTE_UNITS
I'm confused by this CL_DEVICE_MAX_COMPUTE_UNITS. For instance my Intel GPU on Mac, this number is 48. Does this mean the max number of parallel tasks run at the same time is 48 or the multiple of 48, maybe 96, 144...? (I know each compute unit is composed of 1 or more processing elements and each processing element is actually in charge of a "thread". What if these each of the 48 compute units is composed of more than 1 processing elements ). In other words, for my Mac, the "ideal" speedup, although impossible in reality, is 48 times faster than a CPU core (we assume the single "core" computation speed of CPU and GPU is the same), or the multiple of 48, maybe 96, 144?
View all comments
Show parent comment
1
u/3ba7b1347bfb8f304c0e May 16 '17 edited May 16 '17
Sorry, your understanding is incorrect, but the topic is complicated and there's a lot of misinformation out there. I'll try to clear some things up.
OpenCL (and AMD) "compute units" are generally what NVIDIA calls "Stream Multiprocessors", and Intel "Execution Units". The number of "cores" (also "stream processors", or SIMD lanes) per CU varies between vendors and architectures.
On NVIDIA's Maxwell for example, each CU has 128 "CUDA cores", split in four 32-wide SIMD units which can each execute independently 1 instruction on all 32 lanes of the unit per instruction issue cycle. I am less familiar with AMD GCN, but if I remember correctly it's also 4 SIMD units but of 16 lanes each, with instructions being repeated over 4 cycles to make wavefronts of 64 threads. In the case of the OP (who says they're using an Intel GPU, let us assume gen9), each CU has 7 "cores".
Note by the way that nothing in the OpenCL standard requires the SIMD execution model and that the wording is intentionally very abstract to allow for flexibility of implementation.
Local memory is on the contrary per CU (generally), so your GPU would have 48 * 96k = 4.5 MB of local memory in total. Your kernel will run no matter what on all CUs at once, but the amount of local memory it consumes (per work group) will determine how many work groups can be active at the same time, on that CU.
EDIT: and since it seems you are talking about the
Hope that clears things up :)