The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Barrier?

Hi,

I have the following questions regarding to usage of barrier. It would be very appreciated if anyone could answer it.

[1]

If (condition)
{
…
barrier();
…
}
else
{
…
}

Question: "condition" for all work items in the same workgroup should be all true or all false in order to reach the exactly same barrier in IF-TRUE block, and this should be guaranteed from progragm logic by a programmer. Is it correct?

[2]

void func()
{
…
if (condition2)
barrier();
…
}

If (condition1)
{
…
func();
…
}
else
{
...
}

Question: similar to above case, if one of work item in a workgroup reaches "barrier" inside a function, all work items in the same workgroup should reach the same "barrier", too. Thus, "condition1" and "condition2" should be all true for all work items in the same workgroup in this case. Is it correct?

Question: assume workgroup size is greater than 2, this case should be illegal because condition of “get_local_id(0) % 2 == 0” cannot be all true or all false for all work items in the same workgroup due to barrier() inside. Is it correct?