OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

Do work items in the same work group execute the same instructions?


For Intel CPU and HD Graphics, do work items in the same work group execute the same instructions? If so, that means all the processing unit within the same compute unit share the same PC, but what confuses me is the "barrier", which will synchnize all the work items in the same work group, which means that while one thread is computing some other threads is waiting for it, which means they are not executing the same instruction. 

Anyone could help to answer me?

0 Kudos
2 Replies

Sorry for the delay in responding. Not sure if you got your answer, but work items within the same work group (in fact all the workgroups) execute the same kernel. So, yes, they execute same instructions but on different data (hence the implicit parallelism). You need the barrier if you want to synchronize work-items within a workgroup. You are synchronizing the data (that the same instructions modify). Hope this answers your questions.




Let me correct myself here. In cases where you have branches, for example, you are executing different set of instructions (this is called SPMD as opposed to SIMD). In the case of SIMD you are executing same instructions on different data so the PC is shared by all the processing elements. In the case of SPMD the PEs maintain their own program counters since the actual instructions executed could be different.