Skip to content

lowRISC/longfruit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LongFruit

LongFruit is a tool to:

  1. Generate compilable random C code excerpts.
  2. Compile that code with both GCC and Clang. Currently it only targets RISC-V.
  3. Analyse the the generated assembly code. Currently this means comparing the "cost" of the generated assembly instructions between GCC and Clang. This cost is given by a simple model, which maps instructions to a class (e.g. ALU, load/store) and assigns costs to those classes.
  4. Identify which cases are interesting. Currently this means cases where the total cost of the assembly generated by Clang is larger than the total cost generated by GCC.
  5. Minimise interesting cases. This is done by invoking creduce and testing potential reductions with the cost estimator. Currently cases are considered valid reductions if the new cost for GCC is equal to the original cost and the cost for Clang is greater than or equal to the original cost.
  6. Store minimized interesting cases.

This tool is currently optimized for simplicity, but it has enough power to find various Clang/LLVM RISC-V codegen patterns that should be improved.

Usage

Run longfruit.py to generate cases for further investigation. Those cases will be stored in files named case-XXXXXXXX.txt, as they are found.

The information regarding the current code being minimized is stored in scenario.ini. To manually trigger the cost test run test.py and check the status code (0 means a valid minimization). To print the test results pass the the -v option. To manually save the case to a case-XXXXXXXX.txt file pass the -s option.

Installation

Longfruit depends on creduce to reduce the interesting cases, so you'll need to install that dependency.

creduce expects the "interestingness test" program to refer to files that aren't being reduced using absolute paths. Because of that, the test.py script currently contains a path variable that points to ~/tools/longfruit. If you install this tool somewhere else you'll need to either change that string or create a symlink.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages