Byfl helps application developers understand code performance in a hardware-independent way. The idea is that it instruments your code at compile time then gathers and reports data at run time. For example, suppose you wanted to know how many bytes are accessed by the following C code:
double array[100000][100];
volatile double sum = 0.0;
for (int row=0; row<100000; row++)
sum += array[row][0];
Reading the hardware performance counters (e.g., using PAPI) can be misleading. The performance counters on most processors tally not the number of bytes but rather the number of cache-line accesses. Because the array is stored in row-major order, each access to array
will presumably reference a different cache line while each access to sum
will presumably reference the same cache line.
Byfl does the equivalent of transforming the code into the following:
unsigned long int bytes accessed = 0;
double array[100000][100];
volatile double sum = 0.0;
for (int row=0; row<100000; row++) {
sum += array[row][0];
bytes_accessed += 3*sizeof(double);
}
In the above, one can consider the bytes_accessed
variable as a "software performance counter," as it is maintained entirely by software.
In practice, however, Byfl doesn't do source-to-source transformations (unlike, for example, ROSE) as implied by the preceding code sample. Instead, it integrates into the LLVM compiler infrastructure as an LLVM compiler pass. Because Byfl instruments code in LLVM's intermediate representation (IR), not native machine code, it outputs the same counter values regardless of target architecture. In contrast, binary-instrumentation tools such as Pin may tally operations differently on different platforms.
The name "Byfl" comes from "bytes/flops". The very first version of the code counted only bytes and floating-point operations (flops).
There are six "release" branches of Byfl on GitHub:
master
, corresponding to LLVM trunkllvm-3.9
, corresponding to LLVM 3.9.x releasesllvm-3.8
, corresponding to LLVM 3.8.x releasesllvm-3.7
, corresponding to LLVM 3.7.x releasesllvm-3.6
, corresponding to LLVM 3.6.x releasesllvm-3.5
, corresponding to LLVM 3.5.x releases
Be sure to download the Byfl branch that corresponds to your installed LLVM version. (Run llvm-config --version
to check.) Then, the usual
./configure
make
make install
procedure should work. See INSTALL.md for a more complete explanation.
Byfl documentation is maintained in the Byfl wiki on GitHub.
Los Alamos National Security, LLC (LANS) owns the copyright to Byfl, which it identifies internally as LA-CC-12-039. The license is BSD-ish with a "modifications must be indicated" clause. See LICENSE.md for the full text.
Scott Pakin, [email protected]
A list of all contributors to Byfl is available online.