The Opencl™ Specification
Total Page:16
File Type:pdf, Size:1020Kb
The OpenCL™ Specification Khronos® OpenCL Working Group Version v3.0.6-68-g7d736c4, Thu, 02 Sep 2021 20:01:22 +0000: from git branch: commit: 7d736c4fda6b26166bfe2bcc5cfab82170af04e7 Table of Contents 1. Introduction. 2 1.1. Normative References . 3 1.2. Version Numbers . 3 1.3. Unified Specification . 3 2. Glossary . 4 3. The OpenCL Architecture. 18 3.1. Platform Model . 18 3.2. Execution Model . 19 3.2.1. Mapping work-items onto an NDRange . 23 3.2.2. Execution of kernel-instances . 25 3.2.3. Device-side enqueue . 26 3.2.4. Synchronization . 27 3.2.5. Categories of Kernels . 29 3.3. Memory Model . 29 3.3.1. Fundamental Memory Regions . 30 3.3.2. Memory Objects . 32 3.3.3. Shared Virtual Memory. 34 3.3.4. Memory Consistency Model for OpenCL 1.x . 35 3.3.5. Memory Consistency Model for OpenCL 2.x . 35 3.3.6. Overview of atomic and fence operations . 38 3.3.7. Memory Ordering Rules . 39 3.4. The OpenCL Framework. 50 3.4.1. Mixed Version Support . 50 3.4.2. Backwards Compatibility . 51 3.4.3. Versioning. 52 4. The OpenCL Platform Layer . 54 4.1. Querying Platform Info. 54 4.2. Querying Devices . 56 4.3. Partitioning a Device . 84 4.4. Contexts. 89 5. The OpenCL Runtime . 97 5.1. Command Queues. 97 5.2. Buffer Objects . 104 5.2.1. Creating Buffer Objects . 104 5.2.2. Reading, Writing and Copying Buffer Objects . 111 5.2.3. Filling Buffer Objects . 122 5.2.4. Mapping Buffer Objects. 124 5.3. Image Objects . 127 5.3.1. Creating Image Objects . 128 5.3.2. Querying List of Supported Image Formats . 139 5.3.3. Reading, Writing and Copying Image Objects . 143 5.3.4. Filling Image Objects . 149 5.3.5. Copying between Image and Buffer Objects . 151 5.3.6. Mapping Image Objects. 155 5.3.7. Image Object Queries. 158 5.4. Pipes. 160 5.4.1. Creating Pipe Objects . 160 5.4.2. Pipe Object Queries . 162 5.5. Querying, Unmapping, Migrating, Retaining and Releasing Memory Objects . 163 5.5.1. Retaining and Releasing Memory Objects . 163 5.5.2. Unmapping Mapped Memory Objects. 166 5.5.3. Accessing mapped regions of a memory object . 168 5.5.4. Migrating Memory Objects. 168 5.5.5. Memory Object Queries. 171 5.6. Shared Virtual Memory . 174 5.6.1. SVM sharing granularity: coarse- and fine- grained sharing. 175 5.6.2. Memory consistency for SVM allocations. 187 5.7. Sampler Objects . ..