What Is an OpenCL Compute Unit?

In OpenCL architecture, a compute unit represents an independent execution core within a compute device that manages and schedules parallel tasks. This article explores how OpenCL formally defines a compute unit, breaks down its internal relationship with processing elements, examines how it maps to work-groups and the memory hierarchy, and compares the abstraction across major hardware architectures like GPUs and multi-core CPUs.

The OpenCL Platform and Device Model

The OpenCL specification organizes heterogeneous computing hardware through a rigid, hierarchical platform model. At the top sits the host processor, typically a standard CPU, connected to one or more OpenCL devices such as dedicated GPUs, integrated graphics, digital signal processors (DSPs), or FPGAs.

An OpenCL device is further partitioned into one or more compute units (CUs). Each compute unit is in turn composed of one or more processing elements (PEs). While the processing element is the fundamental scalar or vector execution component responsible for executing individual instructions, the compute unit acts as the primary organizational cluster that schedules, coordinates, and synchronizes groups of these execution streams.

The Relationship Between Compute Units and Work-Groups

OpenCL executes code through functions called kernels. When a host enqueues a kernel, it defines an execution domain known as the NDRange, composed of discrete parallel threads called work-items. Work-items are organized into rectangular clusters called work-groups.

The OpenCL execution model establishes a direct mapping between work-groups and compute units:

Memory Architecture and Scope

The OpenCL memory model is closely aligned with the physical boundaries of the compute unit. OpenCL defines four distinct memory regions, two of which are tightly coupled to the compute unit:

  1. Local Memory: This address space is shared exclusively among work-items belonging to a specific work-group. In hardware, local memory is typically implemented as high-bandwidth, low-latency on-chip memory directly embedded inside the compute unit.
  2. Private Memory: Dedicated solely to an individual work-item, this memory usually maps to physical registers within the processing elements inside the compute unit.
  3. Global and Constant Memory: These regions reside at the device level, accessible by all compute units on the device, though compute units often incorporate their own localized cache hierarchies (such as L1 caches) to accelerate access.

Because local memory is scoped strictly to a single work-group residing on a single compute unit, memory coherency across independent compute units is relaxed until a kernel reaches completion or passes through atomic operations.

Hardware Implementations: GPUs vs. CPUs

Because OpenCL is designed for heterogeneous hardware, vendors map the concept of a compute unit onto their physical architectures differently:

Through this abstraction, OpenCL allows developers to write scalable parallel code that automatically adapts to the number of available execution clusters on any compliant device.