Bellerophon

Bellerophon is a software tool designed for getting approximate variants of a C++ source-code. It is meant to be used together with clang-Chimera and exploits genetic algorithms as exploration strategy.

How it works

Bellerophon alters the input source-code by exploiting approximate computing techniques and explores possible variants by means of objective functions.

The solution space is given by the combination of different configurations of approximate computing techniques applied to the source code and each of them is characterized by different parameters.

Indeed, in Bellerophon, the user is able to specify a reward function, as well as a penalty function, in conjunction to an error/quality function which gives, by means of a metric, the distance between the original output and the approximate one.

In order to support new approximate computing techniques, Bellerophon introduces the plug-ins, which are an abstraction of a particular technique and embody the business logic necessary to actually apply such a technique on a C++ code. Therefore, the definition of a plug-in goes in parallel with the definition of the clang-Chimera Operator, and requires:

The exploration of approximate variants is achieved by employing the ParadisEO, a software framework for methaheuristics.

The compilation strategy adopted by Bellerophon allows to compile just what it is necessary to retrieve information about approximate variants of a source-code project. Indeed, it is able to load (shared) library objects and archives, as well as C++ source.

Bellerophon makes use of the Just-in-Time engine provided by LLVM: each time the software needs to be altered for testing a new variant, Bellerophon do not invoke the system loader, conversely uses the same image loaded into the memory.

Using

Executing bellerophon without any input argument will prompt a short help message, which reports the main flags and options.

Compilation Database

Bellerophon makes use of Clang-Tool and requires a compilation database. It can be provided to bellerophon as a JSON file named compilation_database.json. We suggest to exploit CMake for automatically get a compilation_database.json file.

Objective Functions

The main aim of Bellerophon is to solve a multi-objective problem. Each approximate variant of the code is evaluated through some objective functions.

The user must specify in the source-code at least the error function. This function, by means of a suitable metric, has to estimate the error with respect to results obtained from the original version of the code.

Bellerophon takes into account such a function and tries to minimize its output.

Each approximate variant can be characterized by additional objective functions, namely reward and penalty functions.

The default reward function in Bellerophon is the sum of every approximation grade applied to a given variant, but the user is able to specify a different reward function which overrides the default one.

Objective Functions Definition

All the objective functions are provided to Bellerophon through the source-code, hence in C/C++. During the exploration, Bellerophon defines a variant and execute on it the objective functions. They have be coded with the proper signature:

double BELLERO_getError(){
...
  }

double BELLERO_Reward(){
...
}

double BELLERO_Penalty(){
...
}

Plug-ins

Bellerophon is designed to be extended with any approximate computing technique that can be applied on C/C++ code or even tested by means of software simulation. For this reason, it is compiled with plug-ins, which are provided into the Plugins folder of the source-code.

Each plug-in provides to Bellerophon the logic to access to a source-code and alters values which represents the approximate grade of a particular approximate computing technique. These methods are implemented by means of the inheritance of two classes, namely the AprxContext and AprxTechnique.