12. BBV: an experimental basic block
vector generation tool
To use this tool, you must specify
--tool=exp-bbv
on the Valgrind command line.
12.1. Overview
A basic block is a linear section of code with one entry point and one exit point. A
basic block vector
(BBV) is a list
of all basic blocks entered during program execution, and a count of how many times each basic block was run.
BBV is a tool that generates basic block vectors for use with the SimPoint analysis tool. The SimPoint methodology
enables speeding up architectural simulations by only running a small portion of a program and then extrapolating
total behavior from this small portion.
Most programs exhibit phase-based behavior, which means that at various
times during execution a program will encounter intervals of time where the code behaves similarly to a previous
interval. If you can detect these intervals and group them together, an approximation of the total program behavior
can be obtained by only simulating a bare minimum number of intervals, and then scaling the results.
In computer architecture research, running a benchmark on a cycle-accurate simulator can cause slowdowns on the
order of 1000 times, making it take days, weeks, or even longer to run full benchmarks. By utilizing SimPoint this
can be reduced significantly, usually by 90-95%, while still retaining reasonable accuracy.
A more complete introduction to how SimPoint works can be found in the paper "Automatically Characterizing Large
Scale Program Behavior" by T. Sherwood, E. Perelman, G. Hamerly, and B. Calder.
12.2. Using Basic Block Vectors to create
SimPoints
To quickly create a basic block vector file, you will call Valgrind like this:
valgrind --tool=exp-bbv /bin/ls
In this case we are running on
/bin/ls
, but this can be any program. By default a file called
bb.out.PID
will
be created, where PID is replaced by the process ID of the running process. This file contains the basic block vector.
For long-running programs this file can be quite large, so it might be wise to compress it with gzip or some other
compression program.
To create actual SimPoint results, you will need the SimPoint utility, available from the SimPoint webpage. Assuming
you have downloaded SimPoint 3.2 and compiled it, create SimPoint results with a command like the following:
./SimPoint.3.2/bin/simpoint -inputVectorsGzipped \
-loadFVFile bb.out.1234.gz \
-k 5 -saveSimpoints results.simpts \
-saveSimpointWeights results.weights
where bb.out.1234.gz is your compressed basic block vector file generated by BBV.
The SimPoint utility does random linear projection using 15-dimensions, then does k-mean clustering to calculate
which intervals are of interest. In this example we specify 5 intervals with the -k 5 option.
158
Содержание Software
Страница 176: ...Valgrind FAQ Release 3 8 0 10 August 2012 Copyright 2000 2012 Valgrind Developers Email valgrind valgrind org ...
Страница 177: ...Valgrind FAQ Table of Contents Valgrind Frequently Asked Questions 1 ii ...
Страница 302: ...README mips based on newer GCC versions if possible 95 ...
Страница 303: ...GNU Licenses ...
Страница 304: ...GNU Licenses Table of Contents 1 The GNU General Public License 1 2 The GNU Free Documentation License 8 ii ...