Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add initial draft of Valid Usage and Undefined Behavior section #1105

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
--