File: qualifierExampleInc.xml

package info (click to toggle)
khronos-opencl-man 1.0~svn33624-5.1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,380 kB
  • sloc: xml: 58,847; makefile: 603; ruby: 183; sh: 22
file content (52 lines) | stat: -rw-r--r-- 1,607 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!-- common example(s) for global, local, constant, and private -->

    <para>
      There is no generic address space name for program scope variables. All program scope
      variables must be declared in the <function>__constant</function> address space. For example:
    </para>

    <informaltable frame="none">
      <tgroup cols="1" align="left" colsep="0" rowsep="0">
        <colspec colname="col1" colnum="1" />
        <tbody>
          <row>
            <entry>
// declares a pointer p in the __private address space that
// points to an int object in address space __global
       __global int *p;

// declares an array of 4 floats in the __private address space.
       float x[4];
            </entry>
          </row>
        </tbody>
      </tgroup>
    </informaltable>

    <para>
      There is no address space for function return values. Using an address space qualifier in
      a function return type declaration will generate a compilation error, unless the return
      type is declared as a pointer type and the qualifier is used on the points-to address space.
    </para>

    <para>
      For example:
    </para>

    <informaltable frame="none">
      <tgroup cols="1" align="left" colsep="0" rowsep="0">
        <colspec colname="col1" colnum="1" />
        <tbody>
          <row>
            <entry>
__private int f() { ... } // should generate an error
__local int *f() { ... } // allowed
__local int * __private f() { ... }; // should generate an error.
            </entry>
          </row>
        </tbody>
      </tgroup>
    </informaltable>

<!-- 14-Oct-2011 -->