~ubuntu-branches/ubuntu/trusty/khronos-opencl-man/trusty

« back to all changes in this revision

Viewing changes to dataTypes.xml

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2013-05-21 18:06:15 UTC
  • Revision ID: package-import@ubuntu.com-20130521180615-6e0s2n3pai95ip2f
Tags: upstream-1.0~svn21772
ImportĀ upstreamĀ versionĀ 1.0~svn21772

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
 
3
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
 
4
 
 
5
<refentry>
 
6
    <refentryinfo>
 
7
        <keywordset>
 
8
            <keyword>Data Types</keyword>
 
9
        </keywordset>
 
10
    </refentryinfo>
 
11
 
 
12
    <refmeta>
 
13
        <refentrytitle>Data Types</refentrytitle>
 
14
 
 
15
        <refmiscinfo>
 
16
            <copyright>
 
17
                <year>2007-2010</year>
 
18
                <holder>The Khronos Group Inc.
 
19
 Permission is hereby granted, free of charge, to any person obtaining a
 
20
copy of this software and/or associated documentation files (the
 
21
"Materials"), to deal in the Materials without restriction, including
 
22
without limitation the rights to use, copy, modify, merge, publish,
 
23
distribute, sublicense, and/or sell copies of the Materials, and to
 
24
permit persons to whom the Materials are furnished to do so, subject to
 
25
the condition that this copyright notice and permission notice shall be included
 
26
in all copies or substantial portions of the Materials.</holder>
 
27
            </copyright>
 
28
        </refmiscinfo>
 
29
        <manvolnum>3</manvolnum>
 
30
    </refmeta>
 
31
 
 
32
<!-- ================================ SYNOPSIS -->
 
33
 
 
34
    <refnamediv id="DataTypes">
 
35
        <refname>Data Types</refname>
 
36
 
 
37
        <refpurpose>
 
38
            OpenCL data types.
 
39
        </refpurpose>
 
40
    </refnamediv>
 
41
 
 
42
<!-- ================================ DESCRIPTION  -->
 
43
 
 
44
    <refsect1 id="description"><title>Description</title>
 
45
 
 
46
        <para>
 
47
          These are the data types available in the OpenCL C programming language. Click on a
 
48
          category name in the table below to see information about specific data types.
 
49
        </para>
 
50
 
 
51
        <informaltable frame="all">
 
52
            <tgroup cols="2" align="left" colsep="1" rowsep="1">
 
53
                <colspec colname="col1" colnum="1" />
 
54
                <colspec colname="col2" colnum="2" />
 
55
 
 
56
                <thead>
 
57
                    <row>
 
58
                        <entry>Data type category</entry>
 
59
                        <entry>Included data types</entry>
 
60
                    </row>
 
61
                </thead>
 
62
 
 
63
                <tbody>
 
64
                    <row>
 
65
                        <entry>
 
66
                            <citerefentry href="scalarDataTypes"><refentrytitle>Scalar data types</refentrytitle></citerefentry>
 
67
                        </entry>
 
68
                        <entry>
 
69
                            <type>bool</type>, <type>char</type>, <type>cl_char</type>,
 
70
                            <type>unsigned char</type>, <type>uchar</type>, <type>cl_uchar</type>,
 
71
                            <type>short</type>, <type>cl_short</type>, <type>unsigned short</type>,
 
72
                            <type>ushort</type>, <type>int</type>, <type>unsigned int</type>,
 
73
                            <type>uint</type>, <type>long</type>, <type>unsigned long</type>,
 
74
                            <type>ulong</type>, <type>float</type>, <type>half</type>, <type>size_t</type>,
 
75
                            <type>ptrdiff_t</type>, <type>intptr_t</type>, <type>uintptr_t</type>,
 
76
                            <type>void</type>, <type>double</type>, and <type>half</type> floating point types.
 
77
                        </entry>
 
78
                    </row>
 
79
 
 
80
                    <row>
 
81
                        <entry>
 
82
                            <citerefentry href="vectorDataTypes"><refentrytitle>Vector data types</refentrytitle></citerefentry>
 
83
                        </entry>
 
84
                        <entry>
 
85
                            <type>char<replaceable>n</replaceable></type>, <type>uchar<replaceable>n</replaceable></type>,
 
86
                            <type>short<replaceable>n</replaceable></type>, <type>ushort<replaceable>n</replaceable></type>,
 
87
                            <type>int<replaceable>n</replaceable></type>, <type>uint<replaceable>n</replaceable></type>,
 
88
                            <type>long<replaceable>n</replaceable></type>, <type>ulong<replaceable>n</replaceable></type>,
 
89
                            <type>float<replaceable>n</replaceable></type>, double<replaceable>n</replaceable>, and optional half<replaceable>n</replaceable> types.
 
90
                        </entry>
 
91
                    </row>
 
92
 
 
93
                    <row>
 
94
                        <entry>
 
95
                            <citerefentry href="abstractDataTypes"><refentrytitle>Abstract data types</refentrytitle></citerefentry>
 
96
                        </entry>
 
97
                        <entry>
 
98
                            <type>cl_platform_id</type>, <type>cl_device_id</type>,
 
99
                            <type>cl_context</type>, <type>cl_command_queue</type>,
 
100
                            <type>cl_mem</type>, <type>cl_program</type>,
 
101
                            <type>cl_kernel</type>, <type>cl_event</type>, and
 
102
                            <type>cl_sampler</type>.
 
103
                        </entry>
 
104
                    </row>
 
105
 
 
106
                    <row>
 
107
                        <entry>
 
108
                            <citerefentry href="reservedDataTypes"><refentrytitle>Reserved Data Types</refentrytitle></citerefentry>
 
109
                        </entry>
 
110
                        <entry>
 
111
                            <type>bool<replaceable>n</replaceable></type>,
 
112
                            <type>half<replaceable>n</replaceable></type>, <type>quad</type>,
 
113
                            <type>quad<replaceable>n</replaceable></type>,
 
114
                            <type>complex half</type>, <type>complex half<replaceable>n</replaceable></type>,
 
115
                            <type>imaginary half</type>, <type>imaginary half<replaceable>n</replaceable></type>,
 
116
                            <type>complex float</type>, <type>complex float<replaceable>n</replaceable></type>,
 
117
                            <type>imaginary float</type>, <type>imaginary float<replaceable>n</replaceable></type>,
 
118
                            <type>complex double</type>, <type>complex double<replaceable>n</replaceable></type>,
 
119
                            <type>imaginary double</type>, <type>imaginary double<replaceable>n</replaceable></type>,
 
120
                            <type>complex quad</type>, <type>complex quad<replaceable>n</replaceable></type>,
 
121
                            <type>imaginary quad</type>, <type>imaginary quad<replaceable>n</replaceable></type>,
 
122
                            <type>float<replaceable>n</replaceable></type>x<emphasis>m</emphasis>,
 
123
                            <type>double<replaceable>n</replaceable></type>x<emphasis>m</emphasis>,
 
124
                            <type>long double</type>, <type>long double<replaceable>n</replaceable></type>,
 
125
                            <type>long long</type>, <type>long long<replaceable>n</replaceable></type>,
 
126
                            <type>unsigned long long</type>, <type>ulong long</type>, and
 
127
                            <type>ulong long<replaceable>n</replaceable></type>.
 
128
                        </entry>
 
129
                    </row>
 
130
 
 
131
                    <row>
 
132
                        <entry>
 
133
                            <citerefentry href="otherDataTypes"><refentrytitle>Other data types</refentrytitle></citerefentry>
 
134
                        </entry>
 
135
                        <entry>
 
136
                            <type>image2d_t</type>, <type>image3d_t</type>, <type>image2d_array_t</type>,
 
137
                            <type>image1d_t</type>, <type>image31_buffer_t</type>, <type>image1d_array_t</type>,
 
138
                            <type>sampler_t</type>, and <type>event_t</type>.
 
139
                        </entry>
 
140
                    </row>
 
141
                </tbody>
 
142
            </tgroup>
 
143
        </informaltable>
 
144
    </refsect1>
 
145
 
 
146
    <!-- ================================ NOTES  -->
 
147
   <refsect1 id="notes"><title>Alignment of Types</title>
 
148
        <para>
 
149
          A data item declared to be a data type in memory is always aligned to the size of the
 
150
          data type in bytes. For example, a <type>float4</type> variable will be aligned to a
 
151
          16-byte boundary, and a <type>char2</type> variable will be aligned to a 2-byte boundary.
 
152
        </para>
 
153
 
 
154
        <para>
 
155
          For 3-component vector data types, the size of the data type is 4 *
 
156
          sizeof(component). This means that a 3-component vector data type
 
157
          will be aligned to a 4 * sizeof(component) boundary. The <citerefentry
 
158
          href="vloadn"><refentrytitle>vload3</refentrytitle></citerefentry> and <citerefentry
 
159
          href="vstoren"><refentrytitle>vstore3</refentrytitle></citerefentry> built-in functions
 
160
          can be used to read and write, respectively, 3-component vector data types from an
 
161
          array of packed scalar data type.
 
162
        </para>
 
163
 
 
164
        <para>
 
165
          A built-in data type that is not a power of two bytes in size must be aligned to the next
 
166
          larger power of two. This rule applies to built-in types only, not <code>structs</code>
 
167
          or <code>unions</code>.
 
168
        </para>
 
169
 
 
170
        <para>
 
171
          The OpenCL compiler is responsible for aligning data items to the appropriate
 
172
          alignment as required by the data type. For arguments to a <citerefentry
 
173
          href="functionQualifiers"><refentrytitle>__kernel</refentrytitle></citerefentry>
 
174
          function declared to be a pointer to a data type, the OpenCL compiler can
 
175
          assume that the pointee is always appropriately aligned as required by the
 
176
          data type. The behavior of an unaligned load or store is undefined, except
 
177
          for the <citerefentry><refentrytitle>vloadn</refentrytitle></citerefentry>,
 
178
          <citerefentry><refentrytitle>vload_halfn</refentrytitle></citerefentry>,
 
179
          <citerefentry><refentrytitle>vstoren</refentrytitle></citerefentry>, and
 
180
          <citerefentry><refentrytitle>vstore_halfn</refentrytitle></citerefentry> functions. The
 
181
          vector load functions can read a vector from an address aligned to the element type
 
182
          of the vector. The vector store functions can write a vector to an address aligned
 
183
          to the element type of the vector.
 
184
        </para>
 
185
 
 
186
        <para>
 
187
          The user is responsible for ensuring that data passed into and out of OpenCL buffers are
 
188
          natively aligned relative to the start of the buffer as described above. This implies
 
189
          that OpenCL buffers created with <constant>CL_MEM_USE_HOST_PTR</constant> need to provide
 
190
          an appropriately aligned host memory pointer that is aligned to the data types used to
 
191
          access these buffers in a kernel(s). As well, the user is responsible to ensure that
 
192
          data passed into and out of OpenCL images are properly aligned to the granularity of
 
193
          the data representing a single pixel (e.g.  <varname>image_num_channels</varname>
 
194
          * sizeof(<varname>image_channel_data_type</varname>)) except for
 
195
          <constant>CL_RGB</constant> and <constant>CL_RGBx</constant> images where
 
196
          the data must be aligned to the granularity of a single channel in a pixel
 
197
          (i.e. sizeof(<varname>image_channel_data_type</varname>)).
 
198
        </para>
 
199
 
 
200
        <para>
 
201
          OpenCL makes no requirement about the alignment of OpenCL application defined data
 
202
          types outside of buffers and images, except that the underlying vector primitives (e.g.
 
203
          <type>__cl_float4</type>) where defined shall be directly accessible as such
 
204
          using appropriate named fields in the <constant>cl_type</constant> union. Nevertheless,
 
205
          it is recommended that the <code>cl_platform.h</code> header should attempt to
 
206
          naturally align OpenCL defined application data types (e.g. <type>cl_float4</type>)
 
207
          according to their type.
 
208
        </para>
 
209
    </refsect1>
 
210
 
 
211
<!-- ================================ SPECIFICATION  -->
 
212
<!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page
 
213
-->
 
214
    <refsect1 id="specification"><title>Specification</title>
 
215
        <para>
 
216
            <imageobject>
 
217
                <imagedata fileref="pdficon_small1.gif" format="gif" />
 
218
            </imageobject>
 
219
 
 
220
            <olink uri="scalarDataTypes">OpenCL Specification</olink>
 
221
        </para>
 
222
    </refsect1>
 
223
 
 
224
<!-- ================================ ALSO SEE
 
225
 
 
226
    <refsect1 id="seealso"><title>Also see</title>
 
227
        <para>
 
228
            <citerefentry><refentrytitle>cl_khr_fp64</refentrytitle></citerefentry>
 
229
        </para>
 
230
    </refsect1> -->
 
231
 
 
232
<!-- ============================== COPYRIGHT -->
 
233
<!-- Content included from copyright.inc.xsl -->
 
234
 
 
235
    <refsect3 id="Copyright"><title></title>
 
236
        <imageobject>
 
237
                <imagedata fileref="KhronosLogo.jpg" format="jpg" />
 
238
        </imageobject>
 
239
        <para />
 
240
    </refsect3>
 
241
 
 
242
<!-- 17-Oct-2011 -->
 
243
</refentry>
 
244