Skip to content

Commit

Permalink
First commit for open-source release
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrilla committed Feb 15, 2022
0 parents commit 0840333
Show file tree
Hide file tree
Showing 69 changed files with 7,294 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.bin

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# LLVM
*.bc
*.ll

# Stats files
*.csv

# Folders
build/
imgs/

Empty file added .gitmodules
Empty file.
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
arch: amd64
os: linux
dist: focal
language: python
python:
- "3.6" # default
addons:
apt:
packages:
- cmake
- gcc-7
- flex

language: python

cache:
apt: true
pip: true
directories:
- llvm-project
- graphviz

before_install:
- sudo apt-get -y install ninja-build clang
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir ${DEPS_DIR} && cd ${DEPS_DIR}
- travis_retry wget --no-check-certificate https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz
- tar -xvf cmake-3.16.0-Linux-x86_64.tar.gz > /dev/null
- mv cmake-3.16.0-Linux-x86_64 cmake-install
- PATH=${DEPS_DIR}/cmake-install:${DEPS_DIR}/cmake-install/bin:$PATH
- cd ${TRAVIS_BUILD_DIR}

install:
- ./compile_llvm_minimal.sh
- ./compile_graphviz.sh
- cd fusion
- mkdir build
- cd build
- source ../../env.sh
- cmake ../
- make

notifications:
email: never
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ubuntu:20.04
USER root

# Dependencies
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:rock-core/qt4
RUN apt-get update
RUN apt-get install -y cmake \
libgd-dev \
qt4-qmake \
libqt4-dev \
ninja-build \
python3 \
git \
gcc \
g++ \
autoconf \
automake \
libtool \
bison \
flex \
python3-pandas \
python3-termcolor

WORKDIR /opt/
RUN git clone https://github.com/IBM/NOVIA
RUN git clone [email protected]:dtrilla/novia.git
RUN cd novia && ./scripts/install.sh
RUN echo "source /opt/novia/env.sh" >> ~/.bashrc

99 changes: 99 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# NOVIA

NOVIA: A Framework for Discovering Non-Conventional Inline Accelerators, is an LLVM-based toolset that allows for automatic recognition, instantiation and code instrumentations of inline accelerators. NOVIA uses unified bitcode files to analyze a workload and propose inline accelerators to the architect.

The current NOVIA release does not provide the hardware support [NOVIA Functional Unit (NFU)] or the compiler support (clang patch) to compile NFU instructions to RISC-V. Future commits will provide those.

https://dl.acm.org/doi/abs/10.1145/3466752.3480094

# Publication

If you use NOVIA you can cite us:

```
@inbook{10.1145/3466752.3480094,
author = {Trilla, David and Wellman, John-David and Buyuktosunoglu, Alper and Bose, Pradip},
title = {NOVIA: A Framework for Discovering Non-Conventional Inline Accelerators},
year = {2021},
isbn = {9781450385572},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3466752.3480094},
booktitle = {MICRO-54: 54th Annual IEEE/ACM International Symposium on Microarchitecture},
pages = {507–521},
numpages = {15}
}
```

# Install
## Dependencies
* cmake ninja-build gcc g++ (for build)
* libgd-dev qt4-qmake libqt4-dev autoconf automake libtool bison flex (for Graphviz)
* python3 python3-pandas python3-termcolor (for automated scripts)

## Automatically installed dependencies
* llvm 13.0.0 (https://github.com/llvm/llvm-project/tree/llvmorg-13.0.0)
* graphviz commit 93d330be (https://gitlab.com/graphviz/graphviz/-/commit/93d330be85c25a5f0b0c86e73f40b4f8d7a42264out)


## Native
This requires the dependencies mentioned in the previous section, and will install the automated dependencies.

`./scripts/install.sh`

## Docker Install
`docker build . -t novia:v1`

## Docker Run
`docker run -it novia:v1 /bin/bash`

# Getting Started
NOVIA comes with several automated examples in the subdirectory fusion/examples. The examples contain the base source code, a makefile that generates the input bitcode for novia and a configuration file needed for novia to compile bitcode (mainly the libraries and linking flags needed).

0. `source env.sh`
1. `cd fusion/examples/incremental`
2. `make`
3. `novia incremental.bc`

Type `novia -h` for additional help.

# Usage Instructions
0. `source env.sh` before usage.
1. Generate a unified LLVM IR bitcode file of the binary to analyze:
1. Use clang and -emit-llvm flag to generate bitcode files
2. Use llvm-link to merge several bitcode fites into a unified bitcode file
2. Apply methodology:
1. Generate a configuration file with two variables $EXECARGS (Execution arguments that will be used when profiling the workload) $LDFLAGS (Linking flags and libraries needed to compile the workload). **You can find examples of that in the example directory (e.g., fusion/examples/incremental/conf.sh)**
2. Run the novia tool ( `novia *bitcode_file*` ) [`source env.sh` or use the full path to the tool in fusion/bin]
3. The tool will generate a **novia** folder containing the intermediatte bitcode files of the analysis

# Directory Structure

- fusion: novia related scripts and files
- fusion/examples: synthetically crafted examples
- fusion/analysis/scripts: data treatment scripts
- fusion/src: source code
- fusion/bin: link to novia executable script
- scripts: installation scripts

# Generated Files

When the novia automated analysis script is executed on a bitcode file, the following directories and files will be generated in the bitcode's directory:

- novia folder:
- **copy of original analyzed bitcode file**
- **executable binary of instrumented bitcode file**
- novia/output: annotated bitcode and configuration file for the SoC/Accelerator integration
- novia/bitcode: folder with intermediate optimized bitcode files
- novia/data: raw data files for analysis and output summaries:
- **bblist.txt**: List of basic blocks analyzed by the tool
- **histogram.txt**: Profiling data per basic block:
- data fields-[cycle count,total application cycle count,iterations]
- **weights.txt**: Derived data analysis from histogram.txt:
- data fields-[time % of bitcode,time % of entire application,iterations]
- **orig.csv**/**merge.csv**/**split.csv**: Data metrics for different novia stages
- **io_overhead.csv**: Metrics refering to input and output variables for the accelerators
- **stats.csv**: Other metrics
- **source.log**: Location in source code of basic blocks and accelerators
- novia/imgs: DFGs of the analyzed basic blocks, merged ISs and final accelerator candidates in .png format

18 changes: 18 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

export LLVM_COMPILER_PATH=$DIR/llvm-project/build/bin
export LLVM_COMPILER=clang

export GRAPHVIZ_TOP=$DIR/graphviz/
export GRAPHVIZ_ROOT=$DIR/graphviz/build/

export LLVM_TOP=$DIR/llvm-project/
export LLVM_ROOT=$DIR/llvm-project/build/
export LLVM_BIN=$DIR/llvm-project/build/bin/

export FUSE_LIB=$DIR/fusion/build/lib/

export PATH=$PATH:$DIR/fusion/bin
export PATH=$PATH:$LLVM_COMPILER_PATH

export NUM_THREADS=1
38 changes: 38 additions & 0 deletions fusion/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0076 NEW)

project(fusion VERSION 1.0 DESCRIPTION "LLVM fusion passes")

#set(LLVM_ROOT "${CMAKE_CURRENT_SOURCE_DIR}../../llvm-project/build/" CACHE PATH "Root of LLVM install.")
set(CMAKE_PREFIX_PATH "$ENV{LLVM_ROOT}/bin/")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_CXX_STANDARD 17)

if( NOT EXISTS $ENV{LLVM_ROOT}/include/llvm )
message(FATAL_ERROR "LLVM_ROOT ($ENV{LLVM_ROOT}) is not a valid LLVM install.
Did you source env.sh?")
endif()

if( NOT EXISTS $ENV{GRAPHVIZ_ROOT}/include )
message(FATAL_ERROR "GRAPHVIZ_ROOT ($ENV{GRAPHVIZ_ROOT}) is not a valid GRAPHVIZ install.
Did you source env.sh?")
endif()

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{LLVM_ROOT}/lib/cmake/llvm/")
include(LLVMConfig)
include(AddLLVM)

add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIRS})

include_directories($ENV{GRAPHVIZ_ROOT}/include/graphviz/)
link_directories($ENV{GRAPHVIZ_ROOT}/lib/)

add_compile_options(-fno-rtti)
add_compile_options(-ggdb)
#add_compile_options(-O3)
add_compile_options(-fPIC)

add_subdirectory(src)
Loading

0 comments on commit 0840333

Please sign in to comment.