CosenseAQ is a part of the Noisy&Newton Project. Please check it for more details.
This is an extension of CoSense
The main idea of CoSenseAQ is to use sensor specifications to help compilation optimization, including value range and resolution propagation, auto quantization, 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 [email protected]:systems-nuts/CoSenseAQ.gitTo update all submodules:
	git pull --recurse-submodules
	git submodule update --remote --recursiveIf you forgot to clone with --recursive and end up with empty submodule directories, you can remedy this with
	git submodule update --initBuilding the Noisy compiler and debug tools depends on the libflex, Wirth-tools, and DTrace-scripts repositories. These repositories are already included as submodules:
	Libflex:		[email protected]:phillipstanleymarbell/libflex.git
	Wirth tools:		[email protected]:phillipstanleymarbell/Wirth-tools.git
	DTrace-scripts:		[email protected]: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:			[email protected]: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-develFurthermore, 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-configOnce you have the above repositories,
- Create a file 
config.localin 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_64For example,
	LIBFLEXPATH=/home/me/Noisy-lang-compiler/submodules/libflex
	CONFIGPATH=/home/me/Noisy-lang-compiler/submodules/libflex
	OSTYPE		= linux
	MACHTYPE	= x86_64- Copy 
config.localto the libflex directory 
	$ cp config.local submodules/libflex- 
In
src/common/Makefileandsrc/newton/Makefile, changeCOMPILERVARIANTas necessary (default isgcc). - 
Build Libflex by going to the directory you cloned for Libflex and running
make. The Makefile assumes the environment variablesOSTYPEandMACHTYPEare 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 variablesOSTYPEandMACHTYPEare set. 
	$ make -j32Our 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.shIn 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.cppto run and log the micro-benchmarks. To compile the test file and run: 
make auto_test_compile
./auto_test 2> err.logUsers 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.