OpenCL on FPGA is high-level synthesis behind a familiar API. The host program still runs on a CPU and enqueues kernels, but each kernel is compiled offline, over hours, into a bitstream that lays your code down as a deep hardware pipeline. How fast that pipeline runs depends on how the kernel is structured for pipelining, memory access and loop unrolling. Source portability alone does not set its speed: vendors made OpenCL kernels functionally portable to FPGAs, but their performance portability is poor. Direct ports of kernels written for CPUs and GPUs usually perform poorly on FPGAs, and FPGA-specific optimisation can recover up to two orders of magnitude. For inference, the FPGA earns its place where deterministic latency, power efficiency or direct I/O matter more than raw compute. A GPU usually wins on raw compute.
If you need the standard itself first, start with what OpenCL is as a cross-vendor compute standard. The WebAssembly Python inference overview covers a very different route to running inference off the usual CUDA stack.
From Host Program and Kernel to a Bitstream
The Khronos OpenCL specification defines a host connected to one or more devices, each divided into compute units (CUs) that are further divided into processing elements (PEs). Kernels execute on the devices and the host program runs on the host. The work itself is done by work-items grouped into work-groups, over an N-dimensional index space the specification calls an ND-range. The same model covers both a GPU and an FPGA as accelerator devices.
On an FPGA board, host code written in C or C++ identifies the platform, sets up the computation, transfers data and programs the FPGA, while an offline compiler turns the kernel code into the FPGA bitstream. The kernel has to be compiled offline because placement and routing take far too long for run-time compilation. The host loads the finished bitstream at run time. Zohouri’s thesis puts typical synthesis at 3 to 5 hours on a Stratix V (up to 8), and 8 to 12 hours on the larger Arria 10, with very congested designs taking over a day. Compiling a generic OpenCL kernel for a CPU or GPU takes milliseconds to seconds. That gap makes iterating through the design phase on an FPGA challenging.
What the compiler builds is a circuit, not a program. In Intel’s standard vector-addition example, the compiler creates a three-stage pipeline with two load units and one store unit. A new work-item enters every clock cycle, and different work-items occupy different stages at once. Each operation gets its own custom circuit on the FPGA, whereas on a CPU or GPU instructions share a common pipeline. A PE becomes a pipeline that processes one work-item at a time, and a CU can replicate several PE instances, which share the local memory inside that CU.
The memory model maps onto physical resources in a specific way. With the Intel FPGA SDK for OpenCL, global memory lives in the board’s external DDR banks. Local and private memory become registers or Block RAM, depending on size and access pattern, and constant memory goes into Block RAM. FPGAs have no cache hierarchy. They have a large amount of on-chip memory that the kernel uses as a scratchpad. When the compiler cannot work out a global access pattern, it generates a small private cache (512 Kbit) for that access out of Block RAM.
The SDK also offers two programming models, and the one you pick changes the hardware:
- NDRange. This does not produce thread-level parallelism by default. The compiler builds one compute unit as a deep pipeline that all work-items flow through, maps each region between two barriers to a separate pipeline, and flushes each pipeline at its barrier.
- Single work-item. One work-item runs the whole kernel and the loop iterations are pipelined. Scheduling is static, so the initiation interval (II, the cycles between successive iterations) is fixed at compile time by loop-carried and memory dependencies.
Why Does My GPU-Tuned OpenCL Kernel Run Slowly on the FPGA?
The kernel runs slowly because GPU-style code does not match the FPGA’s pipelined architecture. Zohouri’s thesis shows that a direct port of kernels optimised for CPUs and GPUs usually performs poorly on FPGAs, and that FPGA-specific optimisation then yields up to two orders of magnitude improvement. The NUS performance-analysis study (HPCA 2016) makes the same point about its Rodinia baseline, which was written for GPUs and was “far from optimum” on the FPGA. Thread-coarsening research reaches the same conclusion: GPU-optimised OpenCL often needs manual work before it maps well.
The root cause is architectural. GPUs use SIMD-like hardware to run tens of thousands of work-items simultaneously, while FPGAs use pipelining to overlap work-items. Barriers and atomics are more efficiently supported on a GPU, while on an FPGA barriers cause pipeline flushes, and OpenCL-enabled FPGA boards have less global memory bandwidth than high-end GPUs. If you think in terms of how GPU thread execution shapes inference, with occupancy and many threads, the FPGA is a data-flow engine instead. In a single work-item kernel the compiler maps each loop nest to a pipeline, and the questions become pipeline depth and II.
GPU Habits and What the FPGA Compiler Does with Them
| GPU-style habit | What the FPGA toolchain produces | What FPGA-oriented code does instead |
|---|---|---|
| Massive NDRange thread parallelism | One deep pipeline that all work-items pass through, not parallel threads | Single work-item kernels with pipelined loops, which suit the FPGA better in most cases |
| Barriers around local-memory tiles | A separate pipeline per barrier region, flushed at each barrier | Move data between iterations through registers. In NDRange kernels with local-memory optimisations, barriers can never be removed |
| Accumulating a float into one variable | An II equal to the floating-point latency, for example 8 clocks for addition on Stratix V | A shift register of partial sums sized to that latency, which brings the II back to one |
| Uncoalesced or scattered global reads | Stalls. FPGA DDR bandwidth is already small, so even one uncoalesced read per iteration hurts | Wide, sequential accesses: one 512-bit burst-coalesced load unit beats eight 32-bit ones |
| Large private arrays as scratch | Arrays above a size limit converted to Block RAM, with barrel shifters, memory replication and dependency stalls | Split intermediates into smaller arrays or individual variables |
| Relying on cache to rescue locality | No cache hierarchy, and all local memory is user-managed | Explicit on-chip buffering, and the compiler’s auto-cache disabled where it only wastes Block RAM |
Thread coarsening merges several work-items into one so that the compiler sees more instruction-level parallelism and can build deeper pipelines. On the benchmarks in that study it reached up to 3.5x speedup at limited resource cost. Irregular memory access and control-flow divergence erode the gain sharply.
In these studies, automatic optimisation fell short of manual optimisation. In the HPCA 2016 study, the Altera SDK’s resource-driven -O3 approach actually slowed some baselines down, while framework-guided manual optimisation reached far higher speedups. The thread-coarsening authors also found that manual optimisations usually beat automatic ones. Debugging is harder too, because the HDL the OpenCL compiler emits is mostly unreadable and may contain black-box vendor IP.
One exception keeps this honest. Kernels with loops that cannot be fully pipelined (variable exit conditions, complex loop-carried dependencies) or with random external memory access can do better under NDRange. The rule is to match the execution model to the loop structure, not to ban NDRange.
What Resource and Clock Figures Do Published OpenCL Inference Designs Report?
The published OpenCL FPGA designs in the table below do show consistent patterns, though: DSP blocks pushed close to full, clocks in the low hundreds of MHz, and memory bandwidth setting the ceiling on parallelism.
| Design (source) | Device | Workload | Reported result |
|---|---|---|---|
| OpenCL Deep Learning Accelerator, Aydonat et al. (2017) | Intel Arria 10 | AlexNet | 1020 img/s, 23 img/s/W, 1382 GFLOPs |
| CNN2Gate (2020), automated from ONNX | Intel Arria 10 | VGG-16 / AlexNet | 205 ms / 18 ms latency |
| Systolic-CNN (2020), single-precision | Arria 10 / Stratix 10 | AlexNet; ResNet-50 | 7 ms / 2 ms; 84 ms / 33 ms per image |
| Systolic-CNN (2020) | Arria 10 / Stratix 10 | Same set | DSP utilisation above 90% on both boards |
| Romein and Veenboer (NVIDIA GTC 2019) | Intel Arria 10 | Matrix multiply | 0.774 TFlop/s at 37 W; 89% of DSPs, 40% of on-chip memory; 288 MHz against a 450 MHz peak |
| UCLA FCCM 2018 study (SDAccel, HLS C) | Xilinx Virtex-7 | 15 Rodinia kernels | About 200 MHz, 21% to 32% of the GPU’s clock |
The DLA authors report that their 23 img/s/W is competitive with the best published AlexNet implementation on an NVIDIA Titan X. They got there with an architecture built to maximise data reuse and minimise external bandwidth, plus the Winograd transform.
Systolic-CNN shows where bandwidth stops you. Sweeping the number of PEs for AlexNet’s fully connected layers, runtime bottomed out at 16. Beyond that point the design was limited by off-chip memory bandwidth, not compute. A different parameter that does not touch bandwidth scaled linearly with DSP use, up to 100% DSP utilisation. The authors attribute a 6x latency gap to a fixed-point RTL design mostly to data format (floating to fixed point, then 32-bit to 16-bit).
For the two small models below, the published figures are in microseconds. They come from Vitis HLS and hls4ml flows rather than OpenCL, which rely on the same pipelining, II and unrolling concepts. A Transformer for time-series anomaly detection on a PYNQ-Z2 reached 37.14 µs while using 90% of LUTs, 30% of flip-flops and 5% of BRAM. An LFADS neuroscience model on a Xilinx Alveo U55C running at 200 MHz reached 41.97 µs. In that LFADS work, bit width decided which resource ran out. DSP use fell steeply from 32 to 22 bits, and below 12 bits the multiplications moved into LUTs.
In our view, the useful expectation for a candidate kernel is a set of questions rather than a number. Will it be DSP-bound or bandwidth-bound? What clock will timing closure allow? How much does the chosen precision change both answers?
Deterministic Latency, Power and I/O: Where the FPGA Wins and Where a GPU Does
Latency determinism is a clear FPGA advantage. In the Transformer study above, the FPGA’s 37.14 µs was a fixed figure. The same model took a mean of 353.35 µs (standard deviation 113.50) on CPU and 626.34 µs (standard deviation 323.18) on GPU. The authors note that FPGA inference time stays constant, while CPU and GPU times vary with system load. Read the GPU number with care: the model was small and ran a single sample, so the GPU’s transfer overhead exceeded the CPU’s whole inference time. The result covers single samples, not batched throughput.
Power is where the sources disagree. Zohouri’s thesis reports better power efficiency than same-generation GPUs in every application studied, up to 5.6x. The UCLA study found 6 of 15 Rodinia kernels reaching at least half the GPU’s performance at an average of 28% of GPU power. On the other hand, Romein and Veenboer measured 20.9 GFlop/W for matrix multiplication on an Arria 10, against 38.4 GFlop/W on a Titan X (Pascal) and 36.7 on an AMD Vega FE, and concluded that GPUs win on energy efficiency. Dense matrix multiply favoured the GPU, while stencil computation is where FPGAs compete. We read the FPGA power advantage as specific to the workload and the device generation, not a property of FPGAs in general.
Bandwidth is the FPGA’s structural weakness. Zohouri’s thesis cites 34.1 GB/s for a typical Arria 10 board against 336.6 GB/s for a same-generation GTX 980 Ti, roughly a 10x gap. The UCLA study found that FPGAs complete more operations per cycle in each pipeline but reach a lower effective parallel factor, largely because of that off-chip bandwidth. I/O runs the other way. FPGAs offer massive connectivity through their I/O pins, while high power draw and limited external I/O restrict GPUs in industrial and mission-critical settings.
| If the inference requirement is… | It leans towards |
|---|---|
| Fixed, bounded latency per sample with no load-dependent variance | FPGA |
| Sensor or network data entering the accelerator directly | FPGA |
| A strict power envelope on a pipeline-friendly model | FPGA, after measuring on your workload |
| Peak throughput on large batched dense layers | GPU |
| Memory-bandwidth-heavy layers with little reuse | GPU |
| Frequent model changes and short iteration cycles | GPU, unless the FPGA design is model-invariant like Systolic-CNN |
How Do We Check an OpenCL-on-FPGA Path Clears the Target Before Committing to HLS Work?
Estimate analytically first, measure on hardware second, and do not let a 10-hour synthesis run be the first time you learn the answer. A single pipeline needs P + II × (L − 1) cycles, where P is the pipeline depth, II the initiation interval and L the trip count.
- Model the kernel before synthesis. The FlexCL analytical model predicted performance with an average error of 9.5% against RTL implementations on Rodinia, and it explores a design space in seconds. In the same study, the vendor tool’s own estimate failed to return a result for about 42% of designs and was 30.4% to 84.9% off on the rest.
- Use the compiler’s resource estimate to prune the design space. CNN2Gate uses the Intel OpenCL compiler’s resource estimates to choose parallelism parameters. Its exploration takes under five minutes, against synthesis close to ten hours on an Arria 10.
- Profile the built design with the vendor profiler. Intel’s Best Practices Guide defines the ideal pipeline as 0% stall, 100% occupancy and bandwidth equal to the board’s. Where stall plus occupancy sums to about 100%, the profiler flags that location as the stall source. A low stall figure marks a victim of a stall further along. Loop-carried dependencies show up as bubbles between iterations. The Intel FPGA Dynamic Profiler also reports the hit rate of compiler-generated caches, which tells you whether to switch them off.
- Separate host transfer from in-fabric stalls. In the Polytechnique Montréal instrumentation study, the single work-item version needed 21.2x fewer cycles than the NDRange version. The NDRange stalls came from unsuitable host-FPGA data transfer, not from anything inside the FPGA.
- Instrument at cycle level when the profiler is not enough. Source-level instruments inserted in OpenCL kernels measure II, latency and stalls at FPGA clock-cycle accuracy. Each instrument cost at most 0.31% of ALUTs, flip-flops or LUs.
Worked Example: What II Does to a Latency Budget
Assume a pipeline depth of 200 cycles, 50,000 work-items and a 200 MHz clock. The work-item count matches the instrumentation study, and the clock is the figure the UCLA study gives for large HLS designs. With II = 1, the kernel needs 200 + 1 × 49,999 = 50,199 cycles, about 0.25 ms. Now suppose the same kernel accumulates into a single floating-point variable, and the II therefore rises to the 8-clock addition latency reported for Stratix V. It then needs 200 + 8 × 49,999 = 400,192 cycles, about 2.0 ms. One unresolved dependency costs 8x before memory stalls even enter the calculation.
A performance and porting assessment supplies the profiling baseline that tells whether a kernel clears its latency, power and utilisation target. Once a bitstream exists, shipping it is a separate release-readiness gate. A release-readiness decision framework covers the bitstream, resource-utilisation and deterministic-latency checks such a deployment must pass.
When OpenCL on FPGA Earns Its Cost Against a CUDA GPU Path or Hand-Written RTL
Against hand-written RTL, well-optimised OpenCL comes close. Sanaullah et al. (Boston University, FPT 2018) report their optimised kernels within 12% of hand-tuned HDL on average, and within about 2x of the best equivalent GPU code. A Virginia Tech study (HPEC 2022) measured an optimised OpenCL Sobel filter at 84% of an optimised Verilog version, with a 6.1x productivity gain. The OpenCL version took three weeks against roughly four months for Verilog. The same study shows why “optimised” carries the weight: its Verilog design ran about 60,000x faster than the unoptimised single-task OpenCL baseline. In that study, the productivity gain outweighs the performance loss only for the optimised OpenCL version. In our view, hand-written RTL still earns its cost where the last few percent, a custom data format or the tightest resource fit decides whether the product works.
Against a GPU path, the order of questions matters. If the model runs on a GPU today and the deployment has no hard latency-variance, power or I/O constraint, the GPU usually wins on compute. Making that existing path faster is the GPU optimisation work TechnoLynx delivers as GPU Performance Engineering. Before reaching for an FPGA, it is also worth checking whether heterogeneous mapping across CPU, GPU and accelerators solves the problem with hardware you already have.
Porting to a new target is worth funding when a measurable trigger names it: a performance ceiling, a constraint of the deployment target, or a lock-in cost. For an FPGA, that trigger is usually a latency-variance budget a GPU cannot hold, a power envelope it cannot fit, or an I/O path it cannot terminate.
The toolchain question is now part of the decision too. Intel is discontinuing the Intel FPGA SDK for OpenCL (Product Discontinuation Notice PDN2219) and recommends the oneAPI Base Toolkit with SYCL, with a published guide for migrating OpenCL FPGA designs. In the Virginia Tech study, oneAPI needed 1.25x less development time than OpenCL, with equivalent kernel execution time under identical optimisations. For new work on Intel FPGAs, Intel points to SYCL rather than OpenCL.
That leaves one question to settle before anyone opens a synthesis log: which number fails on the GPU today, and by how much? If nobody can name it, the FPGA port is moving the bottleneck to hardware the team knows less well.
FAQ
How Are FPGAs Programmed?
Traditionally, FPGAs are programmed in hardware description languages such as Verilog or VHDL. High-level synthesis tools now let developers write C, C++ or OpenCL that the vendor toolchain converts into those low-level descriptions. Xilinx’s Vivado HLS and the Intel and Xilinx OpenCL SDKs were the vendor-supported routes that brought software developers to FPGAs.
What’s the Difference Between CUDA and OpenCL?
OpenCL is an open, royalty-free standard that targets GPUs, CPUs, FPGAs and DSPs, while CUDA is supported by a single vendor. Both offer a similar model of explicit parallelism and offload to an accelerator. For the GPU-side choice, see which is better, CUDA or OpenCL, for GPU programming.