Giter Site home page Giter Site logo

hoangt / llvm-tracer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from harvard-acc/llvm-tracer

0.0 2.0 0.0 104 KB

An LLVM pass to profile dynamic LLVM IR instructions and runtime values

License: Other

Makefile 3.00% Python 2.61% C 6.63% C++ 87.76%

llvm-tracer's Introduction

LLVM IR Trace Profiler (LLVM-Tracer) 1.1 Public Release

LLVM-Tracer is an LLVM instrumentation pass to print out a dynamic LLVM IR trace, including dynamic register values and memory addresses.

If you use LLVM-Tracer in your research, please cite:

ISA-Independent Workload Characterization and its Implications for Specialized Architectures, Yakun Sophia Shao and David Brooks, International Symposium on Performance Analysis of Systems and Software (ISPASS), April 2013

============================================ Requirements:

LLVM 3.4.0 and Clang 3.4.0 64-bit

Build:

  1. Set LLVM_HOME to where you installed LLVM Add LLVM and Clang binary to your PATH:

    export $LLVM_HOME=/path/to/your/llvm/installation
    export $PATH=$LLVM_HOME/bin:$PATH
    export $LD_LIBRARY_PATH=$LLVM_HOME/lib/:$LD_LIBRARY_PATH
    
  2. Go to where you put LLVM-Tracer source code

    cd /path/to/LLVM-Tracer/full-trace/
    make
    cd /path/to/LLVM-Tracer/profile-func/
    make
    

Run:

After you build LLVM-Tracer, you can use example triad programs in the example directory to test LLVM-Tracer.

Example program: triad

  1. Go to /your/path/to/LLVM-Tracer/example/triad

  2. Run LLVM-Tracer to generate a dynamic LLVM IR trace a. LLVM-Tracer tracks regions of interest inside a program. In the triad example, we want to analyze the triad kernel instead of the setup and initialization work done in main. To tell LLVM-Tracer the functions we are interested, set enviroment variable WORKLOAD to be the function names (if you have multiple functions interested, separated by comma):

    export WORKLOAD=triad export WORKLOAD=md,md_kernel

    b. Generate LLVM IR:

    clang -g -O1 -S -fno-slp-vectorize -fno-vectorize -fno-unroll-loops -fno-inline -emit-llvm -o triad.llvm triad.c

    c. Run LLVM-Tracer pass: Before you run, make sure you already built LLVM-Tracer. Set $TRACER_HOME to where you put LLVM-Tracer code.

    export TRACER_HOME=/your/path/to/LLVM-Tracer opt -S -load=$TRACER_HOME/full-trace/full_trace.so -fulltrace triad.llvm -o triad-opt.llvm llvm-link -o full.llvm triad-opt.llvm $TRACER_HOME/profile-func/tracer_logger.llvm

    d. Generate machine code:

    llc -filetype=asm -o full.s full.llvm gcc -fno-inline -o triad-instrumented full.s

    e. Run binary. It will generate a file called dynamic_trace under current directory.

    ./triad-instrumented

    f. We provide a python script to run the above steps automatically for SHOC.

    cd /your/path/to/LLVM-Tracer/triad export TRACER_HOME=/your/path/to/LLVM-Tracer python llvm_compile.py $TRACER_HOME/example/triad triad


Emma Wang and Sophia Shao

Harvard University, 2014

llvm-tracer's People

Contributors

rgly avatar xyzsam avatar emma926 avatar exhausted-engy avatar

Watchers

James Cloos avatar  avatar

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.