mem: Add a stack distance calculator
authorKanishk Sugand <kanishk.sugand@arm.com>
Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)
committerKanishk Sugand <kanishk.sugand@arm.com>
Tue, 23 Dec 2014 14:31:18 +0000 (09:31 -0500)
commit888975b29d920df9acdcf55db491d802e607cea6
tree515af4570018def165c85e4e7d4c1744b77b3de6
parent177682ead4e277cd25bcb92f7bdd9a37ada9c9cd
mem: Add a stack distance calculator

This patch adds a stand-alone stack distance calculator. The stack
distance calculator is a passive SimObject that observes the addresses
passed to it. It calculates stack distances (LRU Distances) of
incoming addresses based on the partial sum hierarchy tree algorithm
described by Alamasi et al. http://doi.acm.org/10.1145/773039.773043.

For each transaction a hashtable look-up is performed. At every
non-unique transaction the tree is traversed from the leaf at the
returned index to the root, the old node is deleted from the tree, and
the sums (to the right) are collected and decremented. The collected
sum represets the stack distance of the found node. At every unique
transaction the stack distance is returned as
numeric_limits<uint64>::max().

In addition to the basic stack distance calculation, a feature to mark
an old node in the tree is added. This is useful if it is required to
see the reuse pattern. For example, Writebacks to the lower level
(e.g. membus from L2), can be marked instead of being removed from the
stack (isMarked flag of Node set to True). And then later if this same
address is accessed (by L1), the value of the isMarked flag would be
True. This gives some insight on how the Writeback policy of the
lower level affect the read/write accesses in an application.

Debugging is enabled by setting the verify flag to true. Debugging is
implemented using a dummy stack that behaves in a naive way, using STL
vectors. Note that this has a large impact on run time.
src/mem/SConscript
src/mem/StackDistCalc.py [new file with mode: 0644]
src/mem/stack_dist_calc.cc [new file with mode: 0644]
src/mem/stack_dist_calc.hh [new file with mode: 0644]