The Platform-Neutral Compute Intermediate Language, or PENCIL, is a C99-based language developed as part of the CARP Project
A key goal of the language is to serve as an intermediate language for the compilation of domain-specific languages.
The PENCIL representation can then be compiled into efficient, device-specific OpenCL code using a PENCIL-to-OpenCL compiler such as PPCG
This eliminates the need for the DSL implementer to develop different platform-specific backends: all that is needed to target different platforms is a PENCIL backend!
The PENCIL Scala library
contains a Scala library that can be used to implement a PENCIL backend for a DSL compiler.
The library provides the following:
- An in-memory representation of the PENCIL as a set of Scala
- Validation functions for the in-memory PENCIL representation.
- A printer to obtain PENCIL code from the in-memory representation.
This library significantly simplifies the development process of targeting a DSL to PENCIL,
by providing an API for building, manipulating, and printing the PENCIL intermediate representation.
Using the PENCIL Scala library
- Download the library:
git clone firstname.lastname@example.org:carpproject/pencil.git
- Build the library following the instructions in the README.txt file
To use the library, add the pencil.jar file to your CLASSPATH:
There is an example demonstrating the PENCIL library usage:
This example can also be found in the example directory in the PENCIL library repository.
- VOBLA: a DSL for linear algebra targeting PENCIL:
- PENCIL IR internal documentation:
- PENCIL to CUDA/OpenCL compiler: