GithubHelp home page GithubHelp logo

ibm / novia Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 4.0 4.08 MB

NOVIA ontology toolset for discovery of unconventional inline accelerators

Dockerfile 0.37% Shell 6.35% CMake 0.79% Python 6.28% Makefile 0.75% C++ 85.47%
hardware-designs llvm agile-integration

novia's Introduction

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 (Published in novia 1.5.0 branch with limited functionality).

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

Native

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

cd ./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).

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

Type novia -h for additional help.

Usage Instructions

  1. source env.sh before usage.
  2. 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
  3. 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

novia's People

Contributors

dtrilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

novia's Issues

issues with clang/llvm

Hello again! I've been attempting to run Novia on my own bitcode and have run into problems with clang and LLVM.

As a preface, I have built two Novia Docker images:

  1. NOVIA built with scripts/compile_llvm_minimal.sh
  2. NOVIA built with scripts/compile_llvm.sh

Motivation

I have my own code (a sparse-matrix multiply called spmm) that is built using CMake's -flto flag to emit LLVM IR bitcode (see this Stack Overflow post for how I accomplish this). I realize that I could copy one of the examples in fusion/examples and create a Makefile, but it would be nice to have my CMake build process work since my code can become quite complex.

Building NOVIA with scripts/compile_llvm_minimal.sh

I followed the README and am able to successfully emit bitcode in the examples (fusion/examples/*). However, when attempting to use CMake on my own code (spmm), I see the following error:

root@etc-gpu-09:/opt/spmm/build# make
Scanning dependencies of target spmm
[ 25%] Building CXX object src/CMakeFiles/spmm.dir/main.cc.o
[ 50%] Building CXX object src/CMakeFiles/spmm.dir/dmm.cc.o
[ 75%] Building CXX object src/CMakeFiles/spmm.dir/spmm.cc.o
[100%] Linking CXX executable spmm
/usr/bin/ld: /opt/NOVIA/llvm-project/build/bin/../lib/LLVMgold.so: error loading plugin: /opt/NOVIA/llvm-project/build/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/CMakeFiles/spmm.dir/build.make:114: src/spmm] Error 1
make[1]: *** [CMakeFiles/Makefile2:94: src/CMakeFiles/spmm.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

Below is a screenshot of what the setup looks like from within the container:

novia-screenshot

I believe this is because scripts/compile_llvm_minimal.sh does not build lld, LLVM's linker. As such, I attempted to build the second Docker image using scripts/compile_llvm.sh for a full build.

Building NOVIA with scripts/compile_llvm.sh

For the second image, the only modification is to scripts/install.sh, which now looks like this:

...
$DIR/scripts/compile_graphviz.sh
$DIR/scripts/compile_llvm.sh
...

After building, I run the container and attempt to use clang, but there does not appear to be one:

> source NOVIA/env.sh
> clang --version
bash: clang: command not found

Within my CMakeErrors.log, I see many issues indicating something going wrong with the build process. A sample of this is as follows:

Run Build Command(s):/usr/bin/ninja cmTC_d4fe0 && [1/2] Building C object CMakeFiles/cmTC_d4fe0.dir/CheckIncludeFile.c.o
FAILED: CMakeFiles/cmTC_d4fe0.dir/CheckIncludeFile.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_d4fe0.dir/CheckIncludeFile.c.o   -c CheckIncludeFile.c
CheckIncludeFile.c:1:10: fatal error: malloc/malloc.h: No such file or directory
    1 | #include <malloc/malloc.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

Is there some -D___ flag in scripts/install_llvm.sh that is missing?

Support for other versions of llvm

Is there a specific reason why llvm-13 was chosen? Will there eventually be support for other versions of llvm in the future?

Thank you for the help!

Feature request: dot files instead of PNGs

Hello there! Would it be possible to integrate the generation of .dot files alongside the .pngs generated by NOVIA?

It would be useful on our end since some of our software analysis utilities ingest .dot files.

Problem with automated analysis script

Hi there, I've successfully followed the Docker Install and Docker Run steps as outlined in the README. However, I run into issues with the automated analysis scripts when running the examples. It seems that the formatting of source.log creates errors when being parsed by preanalysis.py.

For each example, except for incremental, I see the following error during the Pre-merge Report:

Traceback (most recent call last):
  File "/opt/NOVIA/fusion/analysis/scripts/preanalysis.py", line 59, in <module>
    main(sys.argv[1:])
  File "/opt/NOVIA/fusion/analysis/scripts/preanalysis.py", line 30, in main
    funcs = re.search("\[.*\]",line).group(0)[1:-2].split(';')
AttributeError: 'NoneType' object has no attribute 'group'

I see that the first line,Original, from source.log is being searched for brackets. re.search("\[.*\]","Original") returns NoneType, which prompts the error AttributeError: 'NoneType' object has no attribute 'group'. Within preanalysis.py at line 30, would skipping lines that do not have these brackets permanently solve this issue without breaking the pipeline? Modifying lines 27-32 of preanalysis.py as such appears to work for me:

for num, line in enumerate(fsource, 1):
    if str(fstats['BB'][i]) in line:
        start = num
        if re.search("\[.*\]", line) is not None:
            funcs = re.search("\[.*\]",line).group(0)[1:-2].split(';')
            if(funcs[0] != ''):

Thank you for the help! NOVIA is quite a neat tool ๐Ÿ˜

Edit: I've opened a pull request with this fix.

Request for more details about compilation and hardware generation

Thanks for your amazing work!

I have noticed that novia-1.5.0 has been updated several months ago, and I'm trying to reproduce the result of your paper. I have tried the newest commit of novia-1.5.0, and it seems that some scripts are broken and novia may crash sometimes.

Could you please provide more information about the compilation and hardware generation parts? Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.