Node:Using profiling to create superinstructions, Previous:Example overview, Up:Example
I have not added rules for this in the Makefile
(there are many
options for selecting superinstructions, and I did not want to hardcode
one into the Makefile
), but there are some supporting scripts, and
here's an example:
Suppose you want to use fib.mini
and test.mini
as training
programs, you get the profiles like this:
make fib.prof test.prof #takes a few seconds
You can aggregate these profiles with stat.awk
:
awk -f stat.awk fib.prof test.prof
The result contains lines like:
2 16 36910041 loadlocal lit
This means that the sequence loadlocal lit
statically occurs a
total of 16 times in 2 profiles, with a dynamic execution count of
36910041.
The numbers can be used in various ways to select superinstructions.
E.g., if you just want to select all sequences with a dynamic
execution count exceeding 10000, you would use the following pipeline:
awk -f stat.awk fib.prof test.prof| awk '$3>=10000'| #select sequences fgrep -v -f peephole-blacklist| #eliminate wrong instructions awk -f seq2rule.awk| #transform sequences into superinstruction rules sort -k 3 >mini-super.vmg #sort sequences
The file peephole-blacklist
contains all instructions that
directly access a stack or stack pointer (for mini: call
,
return
); the sort step is necessary to ensure that prefixes
precede larger superinstructions.
Now you can create a version of mini with superinstructions by just
saying make