Skip to content

Commit

Permalink
add initial draft of Valid Usage and Undefined Behavior section (#1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbaug authored Mar 31, 2024
1 parent 0da93bb commit b575e9c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions api/opencl_architecture.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2278,3 +2278,33 @@ include::{generated}/api/structs/cl_name_version.txt[]
containing a null-terminated string, whose maximum length is therefore
{CL_NAME_VERSION_MAX_NAME_SIZE} minus one.
--

[[valid-usage]]
=== Valid Usage and Undefined Behavior

The OpenCL specification describes valid usage and how to use the API correctly.
For some conditions where an API is used incorrectly, behavior is well-defined,
such as returning an error code.
For other conditions, behavior is undefined, and may include program
termination.
However, OpenCL implementations must always ensure that incorrect usage by an
application does not affect the integrity of the operating system, the OpenCL
implementation, or other OpenCL client applications in the system.
In particular, any guarantees made by an operating system about whether memory
from one process can be visible to another process or not must not be violated
by an OpenCL implementation for any memory allocation.
OpenCL implementations are not required to make additional security or integrity
guarantees beyond those provided by the operating system unless explicitly
directed by the application’s use of a particular feature or extension.

[NOTE]
--
For instance, if an operating system guarantees that data in all its memory
allocations are set to zero when newly allocated, the OpenCL implementation must
make the same guarantees for any allocations it controls.

Similarly, if an operating system guarantees that use-after-free of host
allocations will not result in values written by another process becoming
visible, the same guarantees must be made by the OpenCL implementation for
memory accessible to an OpenCL device.
--

0 comments on commit b575e9c

Please sign in to comment.