Export and transform FPCores
FPBench ships two compiler tools for FPCore: an exporter and a transformation tool. Both are available on Github.
The FPBench tools require Racket. Use the official installer to install Racket, or use distro-provided packages provided they are version 7.0 or later of Racket (earlier versions are not supported).
Test that Racket is installed correctly and has a correct version:
racket Welcome to Racket v7.7. > (exit)
Now that Racket is installed, download the FPBench tools, and enter the downloaded directory. Run:
make setup
This byte-compiles the FPBench tools, making them fast to run.
The FPBench exporter compiles FPCore programs to another language. The exporter allows FPBench's benchmarks to be used by tools with a custom input format. The exporter is invoked like so:
racket export.rkt input.fpcore output.lang
For example, to compile benchmarks/rump.fpcore
to C, run:
racket export.rkt benchmarks/rump.fpcore rump.c
The exporter infers the output language from the file extension, and will signal an error if the extension is unknown. The --lang flag can be used to override the file extension.
Supported languages include:
The exporter also supports additional, language-dependent flags, including:
Math
.The argument - can be used in place of the input or output file names to use standard input and output. When outputting to standard out, the --lang flag is necessary to specify the output language.
The FPBench transformation tool applies a variety of transformations to FPCore programs, such as common subexpression elimination, precondition simplification, and de- and resugaring. The transformation tool is invoked like so:
racket transform.rkt args ... input.fpcore output.fpcore
The list args of arguments names a list of transformations, such as:
let
or let*
to
bind initial values and an if
to check the conditions.
This sound transformation is frequently combined with the
unsound --skip-loops to simulate loops by their
first few iterations.while
loop with a
simple let
which binds the initial values and
executes the body (as if the loop executed zero
time). while*
loops are likewise transformed
into let*
.--precondition-ranges
, but further weakens
to precondition to a conjunction of single ranges for each variable.let*
to a series of
nested let
expressions.while*
to a while
loop
with nested let*
expressions.let*
expression.The transformations which are applied in order (left to right) to each FPCore expression in the input file. The ordering is especially important for pairs of operations such as --unroll and --skip-loops.
Like for the exporter, the argument - can be used in place of the input or output file names to use standard input and output.