Results 1 to 4 of 4

Thread: OpenCL Language Clarification

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    7

    OpenCL Language Clarification

    Hi,
    I'm seeking clarification of section 6.3, clause g of the OpenCL spec 1.1 rev 36
    Given the following kernel

    __kernel void test()
    {
    float3 a;
    if (a.s0 && a.s1 && a.s2)
    {
    }
    }

    should the line
    if (a.s0 && a.s1 && a.s2)
    compile or not? [due to section 6.3, clause g of the OpenCL spec 1.1 rev 36]

    Intel say the above code is not valid. AMD say it is valid. I'm seeking clarification so that I know which bug report to pursue.

    Thanks
    Steve.

  2. #2
    Senior Member
    Join Date
    Sep 2002
    Location
    Santa Clara
    Posts
    105

    Re: OpenCL Language Clarification

    Intel is correct here. Section 6.3, item g states that "The logical operators and (&&), or (||) operate on all scalar and vector built-in types except the built-in scalar and vector float types".

    I would suggest the following change:

    if (as_int(a.s0) && as_int(a.s1) && as_int(a.s2))
    {
    ....
    }

    I've modified it to treat the float components as integers and then you can use the logical operators. This is supported and should work.

  3. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    7

    Re: OpenCL Language Clarification

    Thanks, that was my reading of the spec too.
    I actually used

    if ((a.s0 != 0) && (a.s1 != 0) && (a.s2 != 0))

    I'll go back to AMD with this clarification.

    Thanks

  4. #4
    Junior Member
    Join Date
    Jun 2011
    Posts
    7

    Re: OpenCL Language Clarification

    Just a quick update for anyone that reads this going forwards:

    I've had ongoing discussion with AMD on this issue and they have said

    "After further discussing this internally, this will not be fixed. The reason is that OpenCL inherits from C and C defines this interaction very well and it is viewed as a cut&paste typo to include this restriction on the logical operators that wasn't fixed in time before the OpenCL 1.1 spec was ratified. We view this as a spec error and will see about correcting it in future versions of the spec."

    Let's hope there are no issues with this and the spec is changed accordingly.

    Steve

Similar Threads

  1. Replies: 0
    Last Post: 02-14-2013, 04:23 PM
  2. How to use in QT language..
    By Ulimit77 in forum OpenGL ES general technical discussions
    Replies: 3
    Last Post: 05-30-2005, 12:35 PM

Posting Permissions

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