没有合适的资源?快使用搜索试试~ 我知道了~
OpenCL specific 1.0
需积分: 0 15 下载量 162 浏览量
2009-05-05
20:11:04
上传
评论
收藏 2.54MB PDF 举报
温馨提示
试读
302页
OpenCl 标准说明文档 标准函数说明 范例
资源详情
资源评论
资源推荐
Last Revision Date: 12/8/08 Page 1
The OpenCL Specification
Version: 1.0
Document Revision: 29
Khronos OpenCL Working Group
Editor: Aaftab Munshi
Last Revision Date: 12/8/08 Page 2
1. INTRODUCTION ............................................................................................................11
2. GLOSSARY......................................................................................................................13
3. THE OPENCL ARCHITECTURE .................................................................................18
3.1 Platform Model ...................................................................................................................................... 18
3.2 Execution Model ....................................................................................................................................19
3.2.1 Execution Model: Context and Command Queues..............................................................................................21
3.2.2 Execution Model: Categories of Kernels .............................................................................................................22
3.3 Memory Model.......................................................................................................................................23
3.3.1 Memory Consistency .............................................................................................................................................25
3.4 Programming Model .............................................................................................................................25
3.4.1 Data Parallel Programming Model .......................................................................................................................25
3.4.2 Task Parallel Programming Model .......................................................................................................................25
3.4.3 Synchronization .....................................................................................................................................................26
3.5 The OpenCL Framework..................................................................................................................... 26
4. THE OPENCL PLATFORM LAYER ............................................................................28
4.1 Querying Platform Info ........................................................................................................................28
4.2 Querying Devices ...................................................................................................................................29
4.3 Contexts...................................................................................................................................................38
5. THE OPENCL RUNTIME ..............................................................................................43
5.1 Command Queues .................................................................................................................................43
5.2 Memory Objects ....................................................................................................................................48
5.2.1 Creating Buffer Objects.........................................................................................................................................49
5.2.2 Reading, Writing and Copying Buffer Objects....................................................................................................51
5.2.3 Retaining and Releasing Memory Objects...........................................................................................................54
5.2.4 Creating Image Objects .........................................................................................................................................55
5.2.4.1 Image Format Descriptor .............................................................................................................................................59
5.2.5 Querying List of Supported Image Formats.........................................................................................................61
5.2.5.1 Minimum List of Supported Image Formats ..............................................................................................................62
5.2.6 Reading, Writing and Copying Image Objects ....................................................................................................64
5.2.7 Copying between Image and Buffer Objects .......................................................................................................68
5.2.8 Mapping and Unmapping Memory Objects.........................................................................................................71
5.2.8.1 Behavior of OpenCL commands that access mapped regions of a memory object.................................................77
5.2.9 Memory Object Queries ........................................................................................................................................77
5.3 Sampler Objects..................................................................................................................................... 80
Last Revision Date: 12/8/08 Page 3
5.4 Program Objects....................................................................................................................................83
5.4.1 Creating Program Objects .....................................................................................................................................83
5.4.2 Building Program Executables..............................................................................................................................86
5.4.3 Build Options .........................................................................................................................................................87
5.4.3.1 Preprocessor options.....................................................................................................................................................88
5.4.3.2 Math Intrinsics Options................................................................................................................................................88
5.4.3.3 Optimization Options ...................................................................................................................................................89
5.4.3.4 Options to Request or Suppress Warnings..................................................................................................................90
5.4.4 Unloading the OpenCL Compiler.........................................................................................................................90
5.4.5 Program Object Queries ........................................................................................................................................91
5.5 Kernel Objects ....................................................................................................................................... 96
5.5.1 Creating Kernel Objects ........................................................................................................................................96
5.5.2 Setting Kernel Arguments .....................................................................................................................................98
5.5.3 Kernel Object Queries .........................................................................................................................................100
5.6 Executing Kernels................................................................................................................................103
5.7 Event Objects .......................................................................................................................................110
5.8 Out-of-order Execution of Kernels and Memory Object Commands ........................................114
5.9 Profiling Operations on Memory Objects and Kernels ................................................................117
5.10 Flush and Finish ................................................................................................................................119
6. THE OPENCL C PROGRAMMING LANGUAGE.....................................................120
6.1 Supported Data Types ........................................................................................................................120
6.1.1 Built-in Scalar Data Types ..................................................................................................................................120
6.1.1.1 The half data type .......................................................................................................................................................122
6.1.2 Built-in Vector Data Types .................................................................................................................................123
6.1.3 Other Built-in Data Types ...................................................................................................................................124
6.1.4 Reserved Data Types ...........................................................................................................................................124
6.1.5 Alignment of Types .............................................................................................................................................125
6.1.6 Vector Literals......................................................................................................................................................125
6.1.7 Vector Components .............................................................................................................................................126
6.2 Conversions and Type Casting..........................................................................................................130
6.2.1 Implicit Conversions............................................................................................................................................130
6.2.2 Explicit Casts .......................................................................................................................................................130
6.2.3 Explicit Conversions............................................................................................................................................131
6.2.3.1 Data Types ..................................................................................................................................................................132
6.2.3.2 Rounding Modes.........................................................................................................................................................132
6.2.3.3 Out of Range Behavior and Saturated Conversions.................................................................................................132
6.2.3.4 Explicit Conversion Examples ..................................................................................................................................133
6.2.4 Reinterpreting Data As Another Type................................................................................................................134
6.2.4.1 Reinterpreting Types Using Unions..........................................................................................................................134
6.2.4.2 Reinterpreting Types Using as_typen() ....................................................................................................................135
6.2.5 Pointer Casting .....................................................................................................................................................136
6.3 Operators ..............................................................................................................................................137
6.4 Vector Operations ...............................................................................................................................142
Last Revision Date: 12/8/08 Page 4
6.5 Address Space Qualifiers ...................................................................................................................143
6.5.1 __global (or global) .............................................................................................................................................143
6.5.2 __local (or local) ..................................................................................................................................................144
6.5.3 __constant (or constant) ......................................................................................................................................144
6.5.4 __private (or private) ...........................................................................................................................................144
6.6 Image Access Qualifiers .....................................................................................................................146
6.7 Function Qualifiers .............................................................................................................................147
6.7.1 __kernel (or kernel) .............................................................................................................................................147
6.7.2 Optional Attribute Qualifiers ..............................................................................................................................147
6.8 Restrictions ...........................................................................................................................................149
6.9 Preprocessor Directives and Macros................................................................................................151
6.10 Attribute Qualifiers...........................................................................................................................153
6.10.1 Specifying Attributes of Types .........................................................................................................................154
6.10.2 Specifying Attributes of Functions ...................................................................................................................156
6.10.3 Specifying Attributes of Variables ...................................................................................................................156
6.10.4 Specifying Attributes of Blocks and Control-Flow-Statements .....................................................................158
6.10.5 Extending Attribute Qualifiers..........................................................................................................................158
6.11 Built-in Functions ..............................................................................................................................159
6.11.1 Work-Item Functions.........................................................................................................................................159
6.11.2 Math Functions ..................................................................................................................................................161
6.11.2.1 Floating-point macros and pragmas for math.h......................................................................................................166
6.11.3 Integer Functions ...............................................................................................................................................168
6.11.4 Common Functions............................................................................................................................................171
6.11.5 Geometric Functions..........................................................................................................................................173
6.11.6 Relational Functions ..........................................................................................................................................175
6.11.7 Vector Data Load and Store Functions ............................................................................................................177
6.11.8 Image Read and Write Functions......................................................................................................................181
6.11.8.1 Samplers....................................................................................................................................................................181
6.11.8.2 Built-in Image Functions .........................................................................................................................................183
6.11.9 Synchronization Functions ................................................................................................................................190
6.11.10 Explicit Memory Fence Functions..................................................................................................................191
6.11.11 Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch............................192
7. OPENCL NUMERICAL COMPLIANCE ....................................................................194
7.1 Rounding Modes..................................................................................................................................194
7.2 INF, NaN and Denormalized Numbers............................................................................................194
7.3 Floating-Point Exceptions ..................................................................................................................195
7.4 Relative Error as ULPs.......................................................................................................................195
7.5 Edge Case Behavior ............................................................................................................................198
7.5.1 Additional Requirements Beyond C99 TC2 ......................................................................................................198
7.5.2 Changes to C99 TC2 Behavior ...........................................................................................................................201
7.5.3 Edge Case Behavior in Flush To Zero Mode.....................................................................................................202
Last Revision Date: 12/8/08 Page 5
8. IMAGE ADDRESSING AND FILTERING .................................................................203
8.1 Normalized Coordinates.....................................................................................................................203
8.2 Addressing Mode and Filtering.........................................................................................................203
8.3 Conversion Rules .................................................................................................................................208
8.3.1 Conversion rules for normalized integer channel data types ...........................................................................208
8.3.1.1 Converting normalized integer channel data types to floating-point values ..........................................................208
8.3.1.2 Converting floating-point values to normalized integer channel data types ..........................................................209
8.3.2 Conversion rules for half floating-point channel data type...............................................................................211
8.3.3 Conversion rules for floating-point channel data type ......................................................................................211
8.3.4 Conversion rules for signed and unsigned 8-bit, 16-bit and 32-bit integer channel data types ......................211
9. OPTIONAL EXTENSIONS...........................................................................................213
9.1 Compiler Directives for Optional Extensions .................................................................................214
9.2 Getting OpenCL Extension Function Pointers ...............................................................................215
9.3 Double Precision Floating-Point .......................................................................................................216
9.3.1 Conversions ..........................................................................................................................................................217
9.3.2 Math Functions ....................................................................................................................................................217
9.3.3 Common Functions..............................................................................................................................................221
9.3.4 Geometric Functions............................................................................................................................................222
9.3.5 Relational Functions ............................................................................................................................................223
9.3.6 Vector Data Load and Store Functions...............................................................................................................224
9.3.7 Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch ................................227
9.3.8 IEEE754 Compliance ..........................................................................................................................................228
9.3.9 Relative Error as ULPs ........................................................................................................................................229
9.4 Selecting Rounding Mode ..................................................................................................................232
9.5 Atomic Functions for 32-bit integers................................................................................................234
9.6 Local Atomics for 32-bit integers......................................................................................................236
9.7 64-bit Atomics ......................................................................................................................................238
9.8 Writing to 3D image memory objects ..............................................................................................240
9.9 Byte Addressable Stores .....................................................................................................................242
9.10 Half Floating-Point............................................................................................................................243
9.10.1 Conversions........................................................................................................................................................243
9.10.2 Math Functions ..................................................................................................................................................244
9.10.3 Common Functions............................................................................................................................................247
9.10.4 Geometric Functions..........................................................................................................................................248
9.10.5 Relational Functions ..........................................................................................................................................249
9.10.6 Image Read and Write Functions......................................................................................................................250
9.10.7 Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch ..............................254
9.10.8 IEEE754 Compliance ........................................................................................................................................255
9.10.9 Relative Error as ULPs......................................................................................................................................256
剩余301页未读,继续阅读
dahan_wangtao
- 粉丝: 33
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0