Results 1 to 1 of 1

Thread: Barrier?

Hybrid View

  1. #1
    Newbie
    Join Date
    May 2013
    Posts
    1

    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?

    [3]

    if (get_local_id(0) % 2 == 0)
    {
    ...
    barrier();
    ...
    }
    else
    {
    ...
    barrier();
    ...
    }

    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?


    Thanks a lot!
    Last edited by Andy.Kuo; 05-23-2013 at 10:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •