Jump to content

Compute kernel

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Topbanana (talk | contribs) at 22:25, 22 November 2016 (Link repair: Heterogeneous system architecture -> Heterogeneous System Architecture - You can help!). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computing, a compute kernel is a routine compiled for high throughput accelerators (such as GPUs), DSPs or FPGAs, separate from (but used by) a main program. They are sometimes called compute shaders, sharing execution resources with vertex shaders and pixel shaders on GPUs, but are not limited to execution on one class of device, or graphics APIs.[1][2]

Description

Compute kernels roughly correspond to inner loops when implementing algorithms in traditional languages (except there is no implied sequential operation), or to code passed to internal iterators.

They may be specified by a separate programming language such as "OpenCL C" (managed by the OpenCL API), as "compute shaders" (managed by a graphics API such as OpenGL), or embedded directly in application code written in a high level language, as in the case of C++AMP.

Vector processing

This programming paradigm maps well to vector processors: there is an assumption that each invocation of a kernel within a batch is independent, allowing for data parallel execution. However, atomic operations may sometimes be used for synchronisation between elements (for interdependent work), in some scenarios. Individual invocations are given indices (in 1 or more dimensions) from which arbitrary addressing of buffer data may be performed (including scatter gather operations), so long as the non-overlapping assumption is respected.

Vulkan API

The Vulkan API provides the intermediate SPIR-V representation to describe both Graphical Shaders, and Compute Kernels, in a Language independent and machine independent manner. The intention is: to facilitate language evolution, for a more natural ability to leverage of GPU compute capabilities, inline with hardware developments such as Unified Memory Architecture and Heterogeneous System Architecture, which allow closer co-operation between a CPU and GPU.

See also

References

  1. ^ Introduction to Compute Programming in Metal
  2. ^ CUDA Tutorial - the Kernel