Skip to content
James Price edited this page Oct 28, 2019 · 13 revisions

About Oclgrind

Oclgrind is an open source SPIR interpreter and OpenCL device simulator. The core of this project is an interpreter for SPIR, which can simulate the execution of an OpenCL kernel running on a virtual OpenCL device. Oclgrind is designed to be extensible and aims to provide a platform with which a variety of useful tools can be created to aid OpenCL application development.

The execution of kernels is simulated on an abstract OpenCL device. This device exhibits the properties of the OpenCL execution model; it has four distinct memory address spaces and is aware of work-items, work-groups and the various execution and synchronisation constructs available within OpenCL. The simulation does not model any architecture specific properties such as SIMD execution or cache hierarchies. This means that the execution of kernels within Oclgrind is semantically correct with respect to the OpenCL standard, but completely architecture agnostic. An implementation of the OpenCL 1.2 runtime API is provided as a frontend, allowing existing OpenCL applications to target the simulator without requiring any modifications.

At present, Oclgrind includes support for the following features:

  • Detecting memory access errors (such as reading/writing outside the bounds of an array)
  • Data-race detection
  • Interactive kernel debugging
  • Detecting work-group divergence (barriers and async copies)
  • Collecting histograms of instructions executed
  • Logging OpenCL runtime API errors

Oclgrind is being developed by James Price and Simon McIntosh-Smith of the University of Bristol, and is provided under a 3-clause BSD license. Contributions in the form of bug reports, feature suggestions and pull-requests are always welcome. Please get in touch by raising bugs on the GitHub issues page.

Additional Information

A paper describing the implementation of Oclgrind and some of its tools was presented at IWOCL at Stanford University, in May 2015. A video of the presentation is available here.

The paper itself is available via the ACM conference proceedings for IWOCL'15, and can be cited as below:

@inproceedings{Price:2015:OEO:2791321.2791333,
 author = {Price, James and McIntosh-Smith, Simon},
 title = {Oclgrind: An Extensible OpenCL Device Simulator},
 booktitle = {Proceedings of the 3rd International Workshop on OpenCL},
 series = {IWOCL '15},
 year = {2015},
 isbn = {978-1-4503-3484-6},
 location = {Palo Alto, California},
 pages = {12:1--12:7},
 articleno = {12},
 numpages = {7},
 url = {http://doi.acm.org/10.1145/2791321.2791333},
 doi = {10.1145/2791321.2791333},
 acmid = {2791333},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {GPGPU, OpenCL, SPIR, debugging, simulation},
}

User Guides

For information about developing Oclgrind plugins, see this page.