| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" |
| "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> |
| <refentry> |
| <refentryinfo> |
| <keywordset> |
| <keyword>EXTENSION</keyword> |
| </keywordset> |
| </refentryinfo> |
| |
| <refmeta> |
| <refentrytitle>EXTENSION</refentrytitle> |
| |
| <refmiscinfo> |
| <copyright> |
| <year>2007-2010</year> |
| <holder>The Khronos Group Inc. |
| Permission is hereby granted, free of charge, to any person obtaining a |
| copy of this software and/or associated documentation files (the |
| "Materials"), to deal in the Materials without restriction, including |
| without limitation the rights to use, copy, modify, merge, publish, |
| distribute, sublicense, and/or sell copies of the Materials, and to |
| permit persons to whom the Materials are furnished to do so, subject to |
| the condition that this copyright notice and permission notice shall be included |
| in all copies or substantial portions of the Materials.</holder> |
| </copyright> |
| </refmiscinfo> |
| <manvolnum>3</manvolnum> |
| </refmeta> |
| |
| <!-- ================================ SYNOPSIS --> |
| |
| <refnamediv id="EXTENSION"> |
| <refname>EXTENSION</refname> |
| |
| <refpurpose> |
| A #pragma directive to set the behavior for OpenCL extensions. |
| </refpurpose> |
| </refnamediv> |
| |
| |
| <!-- ALTERNATIVE SYNTAX SYNOPSIS (NON-FUNCTION) --> |
| <refsect2 id="synopsis"> |
| <title> |
| </title> |
| |
| <informaltable frame="none"> |
| <tgroup cols="1" align="left" colsep="0" rowsep="0"> |
| <colspec colname="col1" colnum="1" /> |
| <tbody> |
| <row> |
| <entry> |
| #pragma OPENCL EXTENSION <varname>extension_name</varname> : <varname>behavior</varname> |
| #pragma OPENCL EXTENSION all : <varname>behavior</varname> |
| </entry> |
| </row> |
| </tbody> |
| </tgroup> |
| </informaltable> |
| </refsect2> |
| |
| |
| |
| <!-- ================================ PARAMETERS --> |
| |
| |
| <refsect1 id="parameters"> |
| <title>Parameters</title> |
| <variablelist> |
| |
| <varlistentry> |
| <term> |
| <varname> <!-- parameter name --> |
| extension_name |
| </varname> |
| </term> |
| |
| <listitem> |
| <para> <!-- parameter description --> |
| The name of the extension. The <varname>extension_name</varname> will have names of the form <function>cl_khr_</function><<varname>name</varname>> for an extension approved by the OpenCL working group and will have |
| names of the form <function>cl_</function><<varname>vendor_name</varname>>_<<varname>name</varname>> for vendor extensions. The token <function>all</function> means that the behavior applies to all extensions supported by the compiler. The table below shows the legal values for <varname>extension_name</varname>: |
| </para> |
| |
| <informaltable frame="all"> |
| <tgroup cols="2" align="left" colsep="1" rowsep="1"> |
| <colspec colname="col1" colnum="1" /> |
| <colspec colname="col2" colnum="2" /> |
| |
| <thead> |
| <row> |
| <entry>Extension name</entry> |
| <entry>Description</entry> |
| </row> |
| </thead> |
| |
| <tbody> |
| |
| <row> |
| <entry><citerefentry><refentrytitle>cl_khr_fp64</refentrytitle></citerefentry></entry> |
| <entry>Double precision floating-point</entry> |
| </row> |
| |
| |
| <row> |
| <entry><citerefentry><refentrytitle>cl_khr_int64_base_atomics</refentrytitle></citerefentry></entry> |
| <entry>64-bit integer base atomic operations</entry> |
| </row> |
| |
| <row> |
| <entry><citerefentry><refentrytitle>cl_khr_int64_extended_atomics</refentrytitle></citerefentry></entry> |
| <entry>64-bit integer extended atomic operations</entry> |
| </row> |
| |
| <row> |
| <entry><citerefentry><refentrytitle>cl_khr_3d_image_writes</refentrytitle></citerefentry></entry> |
| <entry>Writes to 3D image objects</entry> |
| </row> |
| |
| <row> |
| <entry><citerefentry><refentrytitle>cl_khr_fp16</refentrytitle></citerefentry></entry> |
| <entry>Half-precision floating-point</entry> |
| </row> |
| |
| <row> |
| <entry><citerefentry href="gl_sharing"><refentrytitle>CL_APPLE_gl_sharing</refentrytitle></citerefentry></entry> |
| <entry>MacOS X OpenGL sharing</entry> |
| </row> |
| <row> |
| <entry><citerefentry href="gl_sharing"><refentrytitle>CL_KHR_gl_sharing</refentrytitle></citerefentry></entry> |
| <entry>OpenGL sharing</entry> |
| </row> |
| <row> |
| <entry><citerefentry href="gl_event"><refentrytitle>cl_khr_gl_event</refentrytitle></citerefentry></entry> |
| <entry>CL event objects from GL sync objects</entry> |
| </row> |
| <row> |
| <entry> |
| <citerefentry href="d3d10_sharing"><refentrytitle>cl_khr_d3d10_sharing</refentrytitle></citerefentry></entry> |
| <entry>Sharing memory objects wth Direct3D 10</entry> |
| </row> |
| |
| </tbody> |
| </tgroup> |
| </informaltable> |
| </listitem> |
| </varlistentry> |
| |
| |
| <varlistentry> |
| <term> |
| <varname> <!-- parameter name --> |
| behavior |
| </varname> |
| </term> |
| |
| <listitem> |
| <para> <!-- parameter description --> |
| One of the following values: |
| </para> |
| |
| <informaltable frame="all"> |
| <tgroup cols="2" align="left" colsep="1" rowsep="1"> |
| <colspec colname="col1" colnum="1" /> |
| <colspec colname="col2" colnum="2" /> |
| |
| <thead> |
| <row> |
| <entry>behavior</entry> |
| <entry>Description</entry> |
| </row> |
| </thead> |
| |
| <tbody> |
| |
| <row> |
| <entry>require</entry> |
| <entry><literallayout>Behave as specified by the extension <varname>extension_name</varname>. |
| |
| Report an error on the <function>#pragma OPENCL EXTENSION</function> if the |
| <varname>extension_name</varname> is not supported, or if <function>all</function> is specified.</literallayout> |
| </entry> |
| </row> |
| |
| <row> |
| <entry>disable</entry> |
| <entry>Behave (including issuing errors and warnings) as if the extension <varname>extension_name</varname> is not part of the language definition. |
| |
| If <function>all</function> is specified, then behavior must revert back to that of the non-extended core version of the language being compiled to. |
| |
| Warn on the <function>#pragma OPENCL EXTENSION</function> if the extension <varname>extension_name</varname> is not supported. |
| </entry> |
| </row> |
| |
| </tbody> |
| </tgroup> |
| </informaltable> |
| </listitem> |
| </varlistentry> |
| |
| <!-- END PARAMETER TABLE --> |
| |
| </variablelist> |
| </refsect1> |
| |
| |
| <!-- ================================ DESCRIPTION --> |
| |
| <refsect1 id="description"><title>Description</title> |
| <para> |
| The <function>#pragma OPENCL EXTENSION</function> directive is a simple, low-level mechanism to set the behavior for each extension. It does not define policies such as which combinations are appropriate; those must be defined elsewhere. The order of directives matter in setting the behavior for each extension. Directives that occur later override those seen earlier. The <function>all</function> |
| variant sets the behavior for all extensions, overriding all previously issued extension directives, but only if the <varname>behavior</varname> is set to <function>disable</function>. |
| </para> |
| <para> |
| The initial state of the compiler is as if the directive <constant>#pragma OPENCL EXTENSION all : disable</constant> was issued, telling the compiler that all error and warning reporting must be done according to this specification, ignoring any extensions. |
| </para> |
| <para> |
| Every extension which affects the OpenCL language semantics, syntax or adds built-in functions to the language must create a preprocessor <constant>#define</constant> that matches the extension name string. This <constant>#define</constant> would be available in the language if and only if the extension is supported on a given implementation. |
| </para> |
| </refsect1> |
| |
| |
| |
| <!-- ================================ EXAMPLE --> |
| |
| <refsect2 id="example1"> |
| <title> |
| Example |
| </title> |
| |
| <para> |
| An extension which adds the extension string "<function>cl_khr_fp64</function>" should also add a preprocessor |
| <function>#define</function> called <function>cl_khr_fp64</function>. A kernel can now use this preprocessor <constant>#define</constant> to do something like the following: |
| </para> |
| |
| <informaltable frame="none"> |
| <tgroup cols="1" align="left" colsep="0" rowsep="0"> |
| <colspec colname="col1" colnum="1" /> |
| <tbody> |
| <row> |
| <entry> |
| #ifdef cl_khr_fp64 |
| // do something using the extension |
| #else |
| // do something else or #error! |
| #endif |
| </entry> |
| </row> |
| </tbody> |
| </tgroup> |
| </informaltable> |
| </refsect2> |
| |
| |
| |
| <!-- ================================ SPECIFICATION --> |
| <!-- Set the "uri" attribute in the <olink /> element to the "named destination" for the PDF page |
| --> |
| <refsect1 id="specification"><title>Specification</title> |
| <para> |
| <imageobject> |
| <imagedata fileref="pdficon_small1.gif" format="gif" /> |
| </imageobject> |
| |
| <olink uri="EXTENSION">OpenCL Specification</olink> |
| </para> |
| </refsect1> |
| |
| |
| <!-- ================================ ALSO SEE --> |
| <!-- Enter comma-delimited list of all other pages in the system to link to, using |
| <citerefentry /><refentrytitle /> to make it a link. For any case where the text of the link needs to differ |
| from the filename of the html file this links to, use the "href" attribute in <citerefentry />. For example: |
| <citerefentry href="thatPage"><refentrytitle>clGetDeviceInfo</refentrytitle></citerefentry> |
| |
| |
| <refsect1 id="seealso"><title>Also see</title> |
| <para> |
| <citerefentry><refentrytitle>EXTENSION</refentrytitle></citerefentry> |
| </para> |
| </refsect1> |
| --> |
| |
| |
| <!-- ============================== COPYRIGHT --> |
| <!-- Content included from copyright.inc.xsl --> |
| |
| <refsect3 id="Copyright"><title></title> |
| <imageobject> |
| <imagedata fileref="KhronosLogo.jpg" format="jpg" /> |
| </imageobject> |
| <para /> |
| </refsect3> |
| |
| </refentry> |
| |