blob: 2e9a4c6105df0f1b096d691c9f8abeb81b43c5f5 [file] [log] [blame]
<?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>cl_khr_initialize_memory</keyword>
</keywordset>
</refentryinfo>
<refmeta>
<refentrytitle>cl_khr_initialize_memory</refentrytitle>
<refmiscinfo>
<copyright>
<year>2007-2013</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="cl_khr_initialize_memory">
<refname>cl_khr_initialize_memory</refname>
<refpurpose>
Extension adds support for initializing local and private memory before a kernel begins execution.
</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 cl_khr_initialize_memory : enable
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect2>
<!-- ================================ DESCRIPTION -->
<refsect1 id="description"><title>Description</title>
<para>
Memory is allocated in various forms in OpenCL both explicitly (global memory) or implicitly
(local, private memory). This allocation so far does not provide a straightforward mechanism to
initialize the memory on allocation. In other words what is lacking is the equivalent of calloc for
the currently supported malloc like capability. This functionality is useful for a variety of
reasons including ease of debugging, application controlled limiting of visibility to previous
contents of memory and in some cases, optimization.
</para>
<para>
This extension adds support for initializing local and private memory before a kernel begins
execution. This extension name is <code>cl_khr_initialize_memory</code>.
</para>
<para>
Add a new context property to table 4.5 in section 4.4
(see <citerefentry><refentrytitle>clCreateContext</refentrytitle></citerefentry>):
</para>
<informaltable frame="all">
<tgroup cols="3" align="left" colsep="1" rowsep="1">
<colspec colname="col1" colnum="1" />
<colspec colname="col2" colnum="2" />
<colspec colname="col3" colnum="3" />
<thead>
<row>
<entry>cl_context_properties enum</entry>
<entry>Property value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>CL_CONTEXT_MEMORY_-
INITIALIZE_KHR</constant></entry>
<entry><type>cl_context_memory_-
initialize_khr</type></entry>
<entry>
<para>
Describes which memory types for the
context must be initialized. This is a
bit-field, where the following values are
currently supported:
</para>
<para>
<constant>CL_CONTEXT_MEMORY_INITIALIZE_LOCAL_KHR</constant> – Initialize local memory
to zeros.
</para>
<para>
<constant>CL_CONTEXT_MEMORY_INITIALIZE_PRIVATE_KHR</constant> – Initialize private
memory to zeros.
</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Updates to section 6.9 –Restrictions:
</para>
<para>
<!-- The spec rev. 19 shows this constant with no underscores -->
If the context is created with
<constant>CL CONTEXT MEMORY INITIALIZE KHR</constant>, appropriate memory
locations as specified by the bit-field is
initialized with zeroes, prior to the start of execution of
any kernel. The driver chooses when, prior to
kernel execution, the initialization of local and/or
private memory is performed. The only requirement
is there should be no values set from outside
the context, which can be read during a kernel execution.
</para>
</refsect1>
<!-- ================================ EXAMPLE -->
<!-- DO NOT DELETE IN CASE AN EXAMPLE IS ADDED IN THE FUTURE -->
<!--
<refsect2 id="example1">
<title>
Example
</title>
<informaltable frame="none">
<tgroup cols="1" align="left" colsep="0" rowsep="0">
<colspec colname="col1" colnum="1" />
<tbody>
<row>
<entry>
Example goes here - it will be set in "code" type with white space preserved.
</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="cl_khr_initialize_memory">OpenCL Specification</olink>
</para>
</refsect1>
<!-- ================================ ALSO SEE -->
<!--
<refsect1 id="seealso"><title>Also see</title>
</refsect1>
-->
<!-- ============================== COPYRIGHT -->
<!-- Content included from copyright.inc.xsl -->
<refsect3 id="Copyright"><title></title>
<imageobject>
<imagedata fileref="KhronosLogo.jpg" format="jpg" />
</imageobject>
</refsect3>
<!-- 24-Dec-2013, rev. 19 -->
</refentry>