ICE is a python-based LLVM optimizer currently supporting if-conversion optimization. ICE issimple, modular and a decoupled optimization framework to run LLVM-IR optimization passes. We demonstrate the effectiveness of the tool through the if-conversion optimization. We observe an overall reduction in latency with a modest resource increase. The modular nature of the framework allows users to easily add support for additional optimization passes easily by incrementally supporting the subset of LLVM-IR needed for that particular optimization.
Installation The following softwares need to be installed
- Python [https://www.python.org/downloads/]
- pip [https://phoenixnap.com/kb/how-to-install-python-3-windows]
- numpy [https://docs.scipy.org/doc/numpy/user/install.html]
- LLVM-tool Chain _ CLANG [https://releases.llvm.org/download.html]
- PyGraphviz- [https://pygraphviz.github.io/documentation/latest/install.html]
- Bambu HLS - [https://panda.dei.polimi.it/?page_id=31]
Directory Structure
src/
- Contains the source code for ICEpredicate.py
- Contains the base class declaration and core logic for if-conversionCFG.py
- Base class definition of CDFGIR.py
- Definition of ICE-IRUtil,py
- Utility functions required for preprocessing dataWriter.py
- Helper functions for Code generationoutput/
- The transformed code is output in this directory
benchmarks/
- Contains the C-code for all the benchmarks tested by ICEinput_unoptimized/
- Contains the unoptimized version of LLVM-IR extracted from the benchmarksoutput_optimized
- Contains the optimized version of LLVM-IR after if-conversion
Usage
python predicate.py -h
usage: predicate.py [-h] [-fname]
optional arguments: -h, --help show this help message and exit -fname provide the name of the input file [only *.c files]
Sample Usage
From the root directory,
cd src/
python predicate.py -fname example.c
- The fname argument takes input file name and reads the from the
../benchmarks/
directory and performs if-conversion optimization - The output is obtained in
src/output/
directory - The output is suffixed with a string '_named'. For example, if the input file name is
example.c
, the tranformed output will be named asexample_transformed.ll
- The transformed LLVM-IR file is fed through Bambu HLS tool with the following command
cd src/output/
bambu --compiler=I386_CLANG6 example_tranformed.ll --simulate
- The generated Verilog design can be obtained in the same directory