Cosense is a part of the Noisy&Newton Project. Please check it for more details.
The main idea of CoSense is to use sensor specifications to help compilation optimization, including value range propagation, function overload & elimination, type compression, condition simplification, and constant substitution.
The correct way to clone this repository to get the submodules is:
git clone --recursive git@github.com:systems-nuts/CoSense.git
To update all submodules:
git pull --recurse-submodules
git submodule update --remote --recursive
If you forgot to clone with --recursive
and end up with empty submodule directories, you can remedy this with
git submodule update --init
Building the Noisy compiler and debug tools depends on the libflex
, Wirth-tools
, and DTrace-scripts
repositories. These repositories are already included as submodules:
Libflex: git@github.com:phillipstanleymarbell/libflex.git
Wirth tools: git@github.com:phillipstanleymarbell/Wirth-tools.git
DTrace-scripts: git@github.com:phillipstanleymarbell/DTrace-scripts.git
For linear algebra in Newton, we use the Eigen library. This is also already linked to the repository as a submodule:
Eigen: git@github.com:eigenteam/eigen-git-mirror.git
The build also depends on the C protobuf compiler, sloccount
, and on Graphviz.
sudo apt install libprotobuf-c-dev protobuf-c-compiler sloccount graphviz-devel
Furthermore, LLVM is a build and runtime dependency on this project. Currently, passes related to LLVM are tested with LLVM 13 versions.
Make sure llvm-config
is installed for one of the above versions. In case it is named differently, e.g., llvm-config-x
you will need to create a symbolic link:
cd /location/of/llvm-config-x
ln -s llvm-config-x llvm-config
Once you have the above repositories,
- Create a file
config.local
in the root of the Noisy tree and edit it to contain
LIBFLEXPATH = full-path-to-libflex-repository-clone
CONFIGPATH = full-path-to-libflex-repository-clone
OSTYPE = linux
MACHTYPE = x86_64
For example,
LIBFLEXPATH=/home/me/Noisy-lang-compiler/submodules/libflex
CONFIGPATH=/home/me/Noisy-lang-compiler/submodules/libflex
OSTYPE = linux
MACHTYPE = x86_64
- Copy
config.local
to the libflex directory
$ cp config.local submodules/libflex
-
In
src/common/Makefile
andsrc/newton/Makefile
, changeCOMPILERVARIANT
as necessary (default isgcc
). -
Build Libflex by going to the directory you cloned for Libflex and running
make
. The Makefile assumes the environment variablesOSTYPE
andMACHTYPE
are set.
$ cd submodules/libflex
$ make
- From the root of this top-level repository, build the Noisy and Newton compilers by running
make
. The makefile assumes the environment variablesOSTYPE
andMACHTYPE
are set.
$ make -j32
Our micro-benchmark test cases are listed in applications/newton/llvm-ir
.
- Following the LLVM Benchmarking tips. We summarize it in a bash file.
sudo bash ./env.sh
In this bash file, we'll set the necessary benchmarking configs and then run the whole micro-benchmarks to check the compilation and execution. To reset the configs, run
sudo bash ./reset.sh
- We have an
auto_test.cpp
to run and log the micro-benchmarks. To compile the test file and run:
make auto_test_compile
./auto_test 2> err.log
Users can get the average performance in average_speedup.log
and the detailed performance numbers in perf.log
. For the compilation log, please check compile.log
, and please check err.log
if any error happens.
- Optional. We provide Python scripts to plot the figures as shown in our paper.
plot_sensor_ranges.py
: Plot the heatmaps.bar_plot.py
: Plot the average speedup bar figure.