Legal Information Getting Help and Support Introduction Coding for the Intel® Processor Graphics Platform-Level Considerations Application-Level Optimizations Optimizing OpenCL™ Usage with Intel® Processor Graphics Check-list for OpenCL™ Optimizations Performance Debugging Using Multiple OpenCL™ Devices Coding for the Intel® CPU OpenCL™ Device OpenCL™ Kernel Development for Intel® CPU OpenCL™ device
Mapping Memory Objects Using Buffers and Images Appropriately Using Floating Point for Calculations Using Compiler Options for Optimizations Using Built-In Functions Loading and Storing Data in Greatest Chunks Applying Shared Local Memory Using Specialization in Branching Considering native_ and half_ Versions of Math Built-Ins Using the Restrict Qualifier for Kernel Arguments Avoiding Handling Edge Conditions in Kernels
Using Shared Context for Multiple OpenCL™ Devices Sharing Resources Efficiently Synchronization Caveats Writing to a Shared Resource Partitioning the Work Keeping Kernel Sources the Same Basic Frequency Considerations Eliminating Device Starvation Limitations of Shared Context with Respect to Extensions
Why Optimizing Kernel Code Is Important? Avoid Spurious Operations in Kernel Code Perform Initialization in a Separate Task Use Preprocessor for Constants Use Signed Integer Data Types Use Row-Wise Data Accesses Tips for Auto-Vectorization Local Memory Usage Avoid Extracting Vector Components Task-Parallel Programming Model Hints
Several environment variables are related to vectorizer. The first one is CL_CONFIG_USE_VECTORIZER, which can be set to False and True respectively. Notice that just like any other environment variables this one affects the behavior of the vectorizer of the entire system (or shell instances) until variable gets unset explicitly (or shell(s) terminates). This specific variable affects code generation for Intel® Xeon Phi™ coprocessor device as well.
Another variable is CL_CONFIG_CPU_VECTORIZER_MODE (that affects code generation for CPU OpenCL device only). It effectively sets the vectorization “width” (when CL_CONFIG_USE_VECTORIZER = True):
- CL_CONFIG_CPU_VECTORIZER_MODE = 0 (default). The compiler makes heuristic decisions whether to vectorize each kernel, and if so which vector width to use.
- CL_CONFIG_CPU_VECTORIZER_MODE = 1. No vectorization by compiler. Explicit vector data types in kernels are left intact. This mode is the same as CL_CONFIG_USE_VECTORIZER = False.
- CL_CONFIG_CPU_VECTORIZER_MODE = 4. Disables heuristic and vectorizes to the width of 4.
- CL_CONFIG_CPU_VECTORIZER_MODE = 8. Disables heuristic and vectorizes to the width of 8.
NOTE:Some kernels cannot be vectorized, so the vectorizer does not handle them, regardless the mode. Also be careful with manual overriding the compiler heuristic, build process fails if the target hardware doesn't support the specific vectorization width. Inspect the compiler output in the offline compiler tool (described in the product User’s Guide) on the messages related to vectorization.
Did you find the information on this page useful?