The BenchGen project aims to synthesize programs that are sufficiently expressive to stress-test computing systems, such as operating systems, compiler optimizations, memory allocation libraries and even computer architectures.
BenchGen implements an L-System to generate programs from a seed string and a set of production rules, enabling the creation of large programs through iterative expansion of the L-System. The program generator is entirely written in C++. To know more about how BenchGen works, you can read a brief report about it.
The BenchGen is develop in Compilers Lab and is financed by FAPEMIG and Google. We appreciate their support and contributions to the development of this project.
After cloning the repository, you can build the project by running the make
command in the src/gen
directory. Notice that clang++ is used as the default compiler.
To run BenchGen, you need to provide the following five parameters: An example of usage is:
git clone --branch v1.0.0-alpha https://github.com/lac-dcc/BenchGen.git
make -C ./BenchGen/src/gen/
./benchGen 1 productionRule.txt seedString.txt myProgram array
git clone --branch v1.0.0-beta https://github.com/lac-dcc/BenchGen.git
make -C ./BenchGen/src/gen/
./benchGen 1 productionRule.txt seedString.txt myProgram array programmingLanguage
See more: here
The L-system grammar used by BenchGen currently supports three commands:
if-then-else
)for
and while
)BenchGen also employs data structures in its benchmarks, providing four functions for data manipulation:
Based on this, we can define production rules that describe how the benchmark will be structured:
CALL(new A)
A = LOOP(B C contains);
B = IF(new LOOP(remove contains), new A remove contains);
C = new contains B;
This program, for instance, begins with a function call that creates a new data structure using the new command. Then, a loop structure is created according to rule A, which calls rules B and C, checking the structure using the contains command.
For more details, our technical report provides additional information on the syntax of control structures in Section 3.1.
BenchGen, in its beta version, supports generating benchmarks in multiple programming languages. To contribute by adding new programming languages, you can follow this documentation, which explains step-by-step how to add and use BenchGen with your programming language!
To contribute to the alpha version of BenchGen, we have open issues where you can help us make BenchGen even better.
You can also report bugs by opening an issue here.