IC profiling infrastructure

Hi All,

We had sent out an RFC in October on indirect call target profiling. The
proposal was about profiling target addresses seen at indirect call sites.
Using the profile data we're seeing up to %8 performance improvements on
individual spec benchmarks where indirect call sites are present. We've
already started uploading our patches to the phabricator. I'm looking
forward to your reviews and comments on the code and ready to respond to
your design related queries.

There were few questions posted on the RFC that were not responded. Here
are the much delayed comments.

1) Added dependencies: Our implementation adds dependency on calloc/free
as we’re generating/maintaining a linked list at run time. We also added
dependency on the usage of mutexes to prevent memory leaks in the case
multiple threads trying to insert a new target address for the same IC
site into the linked list. To least impact the performance we only added
mutexes around the pointer assignment and kept any dynamic memory
allocation/free operations outside of the mutexed code.

2) Indirect call data being present in sampling profile output: This is
unfortunately not helping in our case due to perf depending on lbr
support. To our knowledge lbr support is not present on ARM platforms.

3) Losing profiling support on targets not supporting malloc/mutexes: The
added dependency on calloc/free/mutexes may perhaps be eliminated
(although our current solution does not handle this) through having a
separate run time library for value profiling purposes. Instrumentation
can link in two run time libraries when value profiling (an instance of it
being indirect call target profiling) is enabled on the command line.

4) Performance of the instrumented code: Instrumentation with IC profiling
patches resulted in 7% degradation across spec benchmarks at -O2. For the
benchmarks that did not have any IC sites, no performance degradation was
observed. This data is gathered using the ref data set for spec.

-Betul Buyukkurt

Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
Foundation Collaborative Project