angavrilov edited this page Sep 29, 2010 · 7 revisions


The goal of this project is creating a library that would allow writing basic GPU programs using a subset of Common Lisp syntax and standard library (notably, with full macro support), plus appropriate extensions. The term basic is mainly defined by my current needs :)

Operation principles

GPU code is expressed as S-expressions following Common Lisp syntax with some custom declarations and special forms. It is parsed by a CL walker and translated to C code, which is compiled to GPU byte code using an external compiler provided by the GPU vendor. The resulting compiled code is then wrapped in order to allow easy invocation from ordinary Lisp functions.


The underlying platform and used implementation methods impose the following major restrictions:

  • No consing is possible in GPU code (platform restriction).
  • All variable and expression types must be either declared or easily inferrable.
  • Arithmetic functions follow C type promotion rules and have C rounding and overflow semantics.
  • The type system currently supports only primitive C types and specialized arrays of primitive types.
  • The order of argument evaluation is undefined for built-in functions. The code generator warns if its side effect analysis detects any obviously unsafe code.
  • User-defined functions are supported via unconditional inlining. Recursion is not allowed.

Individual built-in functions have their own specific limitations.

Supported implementations

  • ECL 10.4.1
  • Clozure CL
  • SBCL


External dependencies

The library has quite a lot of external dependencies, more than half of them not asdf-installable. To compensate for this I made a download script, and a pre-downloaded bundle (although it does tend to go stale).

GPU code

Runtime support