]> git.feebdaed.xyz Git - 0xmirror/gcc.git/commit
AutoFDO: Implement summary information in auto-profile
authorDhruv Chawla <dhruvc@nvidia.com>
Mon, 1 Sep 2025 10:02:40 +0000 (03:02 -0700)
committerDhruv Chawla <dhruvc@nvidia.com>
Tue, 23 Dec 2025 05:23:11 +0000 (10:53 +0530)
commitdbe8e0efb7b029bb013fa570691887f033966687
tree402c4749ff2af639dee7cecb0138c35d31ab00c6
parent4dfa48077e3892c652517cd5711915f4aa6875ef
AutoFDO: Implement summary information in auto-profile

This patch aims to implement summary support in auto-profile, similar to
LLVM. The summary information stores various information about the
profile being read such as the number of functions, the maximum sample
count, the total number of samples and so on.

It also adds a section called the "detailed summary" which contains a
histogram-based calculation of the minimum execution count for a sample
needed to belong to a specific percentile of samples. This is used to
decide the hot count threshold (which can be controlled with a command
line parameter). The default is any sample belonging to the 99th percentile
being marked as hot.

This patch requires the changes from https://github.com/google/autofdo/pull/251
to work correctly.

Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:

* auto-profile.cc (struct summary_info): New struct.
(summary_info::read): New function.
(summary_info::get_threshold_count): Likewise.
(function_instance::read_function_instance): Read
afdo_profile_info->sum_max directly from summary info.
(autofdo_source_profile::read): Set afdo_hot_bb_threshold from
param_hot_bb_count_ws_permille.
(read_profile): Call summary_info->read.
(end_auto_profile): Free afdo_summary_info.
* gcov-io.h (GCOV_TAG_AFDO_SUMMARY): New define.
gcc/auto-profile.cc
gcc/gcov-io.h