Intel FPGA SDK for Opencl Pro Edition: Programming Guide Send Feedback

Intel FPGA SDK for Opencl Pro Edition: Programming Guide Send Feedback

Intel® FPGA SDK for OpenCL™ Pro Edition Programming Guide Updated for Intel® Quartus® Prime Design Suite: 21.2 Subscribe UG-OCL002 | 2021.06.23 Send Feedback Latest document on the web: PDF | HTML Contents Contents 1. Intel® FPGA SDK for OpenCL™ Overview......................................................................... 7 1.1. Intel FPGA SDK for OpenCL Pro Edition Programming Guide Prerequisites......................7 1.2. Intel FPGA SDK for OpenCL FPGA Programming Flow..................................................8 2. Intel FPGA SDK for OpenCL Offline Compiler Kernel Compilation Flows........................ 10 2.1. One-Step Compilation for Simple Kernels................................................................ 11 2.2. Multistep Intel FPGA SDK for OpenCL Pro Edition Design Flow.................................... 12 3. Obtaining General Information on Software, Compiler, and Custom Platform...............16 3.1. Displaying the Software Version (version)............................................................... 16 3.2. Displaying the Compiler Version (-version).............................................................. 16 3.3. Listing the Intel FPGA SDK for OpenCL Utility Command Options (help).......................17 3.3.1. Displaying Information on an Intel FPGA SDK for OpenCL Utility Command Option (help <command_option>)............................................................. 17 3.4. Listing the Intel FPGA SDK for OpenCL Offline Compiler Command Options (no argument, -help, or -h)......................................................................................17 3.5. Listing the Available FPGA Boards and Custom Platforms (-list-boards and -list- board-packages)...............................................................................................17 3.6. Displaying the Compilation Environment of an OpenCL Binary (env)........................... 18 4. Managing an FPGA Board.............................................................................................. 19 4.1. Installing an FPGA Board (install)...........................................................................20 4.2. Uninstalling an FPGA Board (uninstall).................................................................... 22 4.3. Querying the Device Name of Your FPGA Board (diagnose)........................................ 22 4.4. Running a Board Diagnostic Test (diagnose <device_name>).....................................23 4.5. Programming the FPGA Offline or without a Host (program <device_name>)............... 23 4.6. Programming the Flash Memory (flash <device_name>)........................................... 23 5. Structuring Your OpenCL Kernel................................................................................... 25 5.1. Guidelines for Naming the Kernel........................................................................... 25 5.2. Programming Strategies for Optimizing Data Processing Efficiency..............................26 5.2.1. Unrolling a Loop (unroll Pragma) ............................................................27 5.2.2. Disabling Pipelining of a Loop (disable_loop_pipelining Pragma) .......... 28 5.2.3. Coalescing Nested Loops...........................................................................29 5.2.4. Fusing Adjacent Loops (loop_fuse Pragma)...............................................30 5.2.5. Marking Loops to Prevent Automatic Fusion (nofusion Pragma)................... 32 5.2.6. Specifying a Loop Initiation interval (II)...................................................... 32 5.2.7. Loop Concurrency (max_concurrency Pragma) .........................................34 5.2.8. Loop Speculation (speculated_iterations Pragma) ............................... 35 5.2.9. Loop Interleaving Control (max_interleaving Pragma)..............................35 5.2.10. Floating Point Optimizations (fp contract and fp reassociate Pragma)................................................................................................. 37 5.2.11. Specifying Work-Group Sizes................................................................... 38 5.2.12. Specifying Number of Compute Units........................................................ 39 5.2.13. Specifying Number of SIMD Work-Items.................................................... 40 5.2.14. Specifying the private_copies Memory Attribute....................................41 5.2.15. Specifying the use_stall_enable_clusters Cluster-control Attribute ..... 42 5.3. Programming Strategies for Optimizing Pointer-to-Local Memory Size......................... 42 Intel FPGA SDK for OpenCL Pro Edition: Programming Guide Send Feedback 2 Contents 5.4. Implementing the Intel FPGA SDK for OpenCL Channels Extension............................. 43 5.4.1. Overview of the Intel FPGA SDK for OpenCL Channels Extension.................... 43 5.4.2. Channel Data Behavior............................................................................. 44 5.4.3. Multiple Work-Item Ordering for Channels................................................... 45 5.4.4. Restrictions in the Implementation of Intel FPGA SDK for OpenCL Channels Extension ................................................................................. 46 5.4.5. Enabling the Intel FPGA SDK for OpenCL Channels for OpenCL Kernel............. 48 5.5. Implementing OpenCL Pipes..................................................................................60 5.5.1. Overview of the OpenCL Pipe Functions.......................................................61 5.5.2. Pipe Data Behavior...................................................................................62 5.5.3. Multiple Work-Item Ordering for Pipes.........................................................62 5.5.4. Restrictions in OpenCL Pipes Implementation...............................................64 5.5.5. Enabling OpenCL Pipes for Kernels............................................................. 65 5.5.6. Direct Communication with Kernels via Host Pipes........................................ 75 5.6. Implementing Arbitrary Precision Integers...............................................................82 5.7. Using Predefined Preprocessor Macros in Conditional Compilation............................... 83 5.8. Declaring __constant Address Space Qualifiers........................................................ 83 5.9. Including Structure Data Types as Arguments in OpenCL Kernels................................84 5.9.1. Matching Data Layouts of Host and Kernel Structure Data Types.....................84 5.9.2. Disabling Insertion of Data Structure Padding ............................................. 86 5.9.3. Specifying the Alignment of a Struct...........................................................86 5.10. Inferring a Register............................................................................................ 87 5.10.1. Inferring a Shift Register......................................................................... 88 5.11. Enabling Double Precision Floating-Point Operations................................................89 5.12. Single-Cycle Floating-Point Accumulator for Single Work-Item Kernels.......................89 5.12.1. Programming Strategies for Inferring the Accumulator................................ 90 5.13. Integer Promotion Rules......................................................................................91 6. Designing Your Host Application................................................................................... 93 6.1. Host Programming Requirements........................................................................... 93 6.1.1. Host Machine Memory Requirements.......................................................... 93 6.1.2. Host Binary Requirement.......................................................................... 93 6.1.3. Multiple Host Threads............................................................................... 94 6.1.4. Out-of-order Command Queues................................................................. 94 6.1.5. Requirement for Multiple Command Queues to Execute Kernels Concurrently... 94 6.2. Allocating OpenCL Buffers for Manual Partitioning of Global Memory........................... 94 6.2.1. Partitioning Buffers Across Multiple Interfaces of the Same Memory Type.........95 6.2.2. Partitioning Buffers Across Different Memory Types (Heterogeneous Memory).. 96 6.2.3. Creating a Pipe Object in Your Host Application............................................ 98 6.2.4. Enabling All Global Memory....................................................................... 98 6.3. Triggering Collection Profiling Data During Kernel Execution.......................................99 6.3.1. Profiling Autorun Kernels ........................................................................ 101 6.3.2. Profile Data Acquisition........................................................................... 103 6.4. Accessing Custom Platform-Specific Functions........................................................103 6.5. Modifying Host Program for Structure Parameter Conversion.................................... 104 6.6. Managing Host Application...................................................................................105 6.6.1. Displaying Example Makefile Fragments (example-makefile or makefile)........105 6.6.2. Compiling and Linking Your Host Application.............................................. 106 6.6.3. Using OpenCL

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    242 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us