barrier() stalls which threads

Hi

I thought barrier() waits till threads/invocations in the local workgroup come to the same point i.e. Only threads in the same local workgroup are effected.

Am I wrong?

Does barrier server to stall till all threads (all threads in all local workgroups) come to the same point in code?

thanks