This is a test repository, experimenting with an approach of building a modular set of tools for verilog and other SiFive related projects.
"CIRT" stands for "Circuit IR and Tools" or perhaps "CIRCuiT + IntermediateRepresenTation + Toolbox" (hat tip to Aliaksei Chapyzhenka). The T can be further expanded as Tool, Translator, Team, Tech, Target, Tree, Type, ...
This name can still be changed if a better one is suggested. :-)
These are the commands Chris used to set this up on a Mac:
-
Install Dependences of LLVM/MLIR according to the instructions, including cmake and ninja.
-
Check out LLVM and CIRT repo's:
$ cd ~/Projects
$ git clone git@github.com:llvm/llvm-project.git
$ git clone git@github.com:sifive/clattner-experimental.git cirt
- HACK: Add symlink because I can't figure out how to get
LLVM_EXTERNAL_CIRT_SOURCE_DIR
to work with cmake (I'd love help with this!):
$ cd ~/Projects/llvm-project
$ ln -s ../cirt cirt
- Configure the build to build MLIR and CIRT using a command like this
(replace
/Users/chrisl
with the paths you want to use):
$ cd ~/Projects/llvm-project
$ mkdir build
$ cd build
$ cmake -G Ninja ../llvm -DLLVM_EXTERNAL_PROJECTS="cirt" -DLLVM_EXTERNAL_CIRT_SOURCE_DIR=/Users/chrisl/Projects/cirt -DLLVM_ENABLE_PROJECTS="mlir;cirt" -DLLVM_TARGETS_TO_BUILD="X86;RISCV" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=DEBUG
The -DCMAKE_BUILD_TYPE=DEBUG
flag enables debug information, which makes the
whole tree compile slower, but allows you to step through code into the LLVM
and MLIR frameworks.
To get something that runs fast, use -DCMAKE_BUILD_TYPE=Release
or
-DCMAKE_BUILD_TYPE=RelWithDebInfo
if you want to go fast and optionally if
you want debug info to go with it. RELEASE
mode makes a very large difference
in performance.
- Build MLIR and run MLIR tests as a smoketest - this isn't needed, but is reasonably fast and a good sanity check:
$ ninja check-mlir
- Build CIRT and run CIRT tests:
$ ninja check-cirt
Talk to Chris.
This project depends on MLIR and LLVM, and it is occasionally useful to improve them. To get set up for this:
- Follow the "How to Contribute" instructions, and install the right tools, e.g. 'arcanist' and
clang-format
. - Get an LLVM Phabricator account
- ask for LLVM commit access.
The patch flow goes like this:
- Check out the LLVM mono repo (as described above).
- Make changes to your codebase.
- Stage your changes with
git add
. - Run clang-format to tidy up the details of the patch with
git clang-format origin/master
- Create a patch in Phabricator with
arc diff
. - Iterate on review, changing your code and sending another patch with
arc diff
.
When your review converges and your patch is approved, do the following:
- commit your changes with
git commit
- rebase your changes with
git pull --rebase
- retest your patch with
ninja check-mlir
(or whatever other target makes sense) - push your changes with
git push