Download OpenCL™ Optimization Guide

Transcript
Contents
Legal Information ................................................................................................................. 4
Getting Help and Support ...................................................................................................... 6
Introduction.......................................................................................................................... 7
About this Document ....................................................................................................... 7
Basic Concepts................................................................................................................ 7
Using Data Parallelism ..................................................................................................... 8
Related Products ............................................................................................................. 9
Coding for the Intel® Processor Graphics ........................................................................... 10
Execution of OpenCL™ Work-Items: the SIMD Machine ....................................................... 10
Memory Hierarchy .......................................................................................................... 14
Platform-Level Considerations ............................................................................................ 16
Intel® Turbo Boost Technology Support............................................................................ 16
Global Memory Size ........................................................................................................ 16
Application-Level Optimizations.......................................................................................... 17
Minimizing Data Copying ................................................................................................. 17
Avoiding Needless Synchronization ................................................................................... 17
Reusing Compilation Results with clCreateProgramWithBinary ............................................. 18
Interoperability with Other APIs ....................................................................................... 18
Interoperability between OpenCL and OpenGL .......................................................... 18
Using Microsoft DirectX* Resources ......................................................................... 18
Aligning Pointers to Microsoft DirectX* Buffers Upon Mapping ..................................... 19
Note on Working with other APIs ............................................................................. 19
Note on Intel® Quick Sync Video ............................................................................ 20
Optimizing OpenCL™ Usage with Intel® Processor Graphics .............................................. 21
Optimizing Utilization of Execution Units............................................................................ 21
Work-Group Size Recommendations Summary................................................................... 21
Memory Access Considerations ........................................................................................ 22
Memory Access Overview ....................................................................................... 22
Recommendations ................................................................................................. 23
Kernel Memory Access Optimization Summary .......................................................... 28
Using Loops ................................................................................................................... 28
Check-list for OpenCL™ Optimizations ................................................................................ 31
Mapping Memory Objects ................................................................................................ 31
Using Buffers and Images Appropriately ............................................................................ 32
Using Floating Point for Calculations ................................................................................. 33
Using Compiler Options for Optimizations .......................................................................... 34
Using Built-In Functions .................................................................................................. 34
Loading and Storing Data in Greatest Chunks .................................................................... 35
Applying Shared Local Memory ........................................................................................ 37
Using Specialization in Branching ..................................................................................... 38
Considering native_ and half_ Versions of Math Built-Ins..................................................... 41
Using the Restrict Qualifier for Kernel Arguments ............................................................... 41
Avoiding Handling Edge Conditions in Kernels .................................................................... 42
Performance Debugging...................................................................................................... 45
Host-Side Timing ........................................................................................................... 45
2