24 cl::desc(
"Merge context profiles before calculating thresholds."));
35 cl::desc(
"A count is hot if it exceeds the minimum count to"
36 " reach this percentile of total counts."));
40 cl::desc(
"A count is cold if it is below the minimum count"
41 " to reach this percentile of total counts."));
44 "profile-summary-huge-working-set-size-threshold",
cl::Hidden,
46 cl::desc(
"The code working set size is considered huge if the number of"
47 " blocks required to reach the -profile-summary-cutoff-hot"
48 " percentile exceeds this count."));
51 "profile-summary-large-working-set-size-threshold",
cl::Hidden,
53 cl::desc(
"The code working set size is considered large if the number of"
54 " blocks required to reach the -profile-summary-cutoff-hot"
55 " percentile exceeds this count."));
61 cl::desc(
"A fixed hot count that overrides the count derived from"
62 " profile-summary-cutoff-hot"));
66 cl::desc(
"A fixed cold count that overrides the count derived from"
67 " profile-summary-cutoff-cold"));
75 200000, 300000, 400000, 500000, 600000, 700000, 800000,
76 900000, 950000, 990000, 999000, 999900, 999990, 999999};
84 return Entry.Cutoff < Percentile;
102 addEntryCount(R.Counts[0]);
103 for (
size_t I = 1, E = R.Counts.size();
I < E; ++
I)
104 addInternalCount(R.Counts[
I]);
111 if (!isCallsiteSample) {
115 }
else if (FS.getContext().hasAttribute(
122 for (
const auto &
I : FS.getBodySamples()) {
126 for (
const auto &
I : FS.getCallsiteSamples())
127 for (
const auto &CS :
I.second)
134 if (DetailedSummaryCutoffs.empty())
137 auto Iter = CountFrequencies.begin();
138 const auto End = CountFrequencies.end();
143 for (
const uint32_t Cutoff : DetailedSummaryCutoffs) {
152 while (CurrSum < DesiredCount && Iter !=
End) {
155 CurrSum += (Count * Freq);
159 assert(CurrSum >= DesiredCount);
169 uint64_t HotCountThreshold = HotEntry.MinCount;
172 return HotCountThreshold;
187 return std::make_unique<ProfileSummary>(
192std::unique_ptr<ProfileSummary>
196 "This can only be called on an empty summary builder");
208 ProfilesToUse = &ContextLessProfiles;
211 for (
const auto &
I : *ProfilesToUse) {
221 return std::make_unique<ProfileSummary>(
226void InstrProfSummaryBuilder::addEntryCount(
uint64_t Count) {
228 "Count value should be less than the max count value.");
235void InstrProfSummaryBuilder::addInternalCount(
uint64_t Count) {
237 "Count value should be less than the max count value.");
239 if (Count > MaxInternalBlockCount)
240 MaxInternalBlockCount = Count;
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static cl::opt< unsigned > ColdCountThreshold("mfs-count-threshold", cl::desc("Minimum number of times a block must be executed to be retained."), cl::init(1), cl::Hidden)
static const uint32_t DefaultCutoffsData[]
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
APInt sdiv(const APInt &RHS) const
Signed division function for APInt.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
std::unique_ptr< ProfileSummary > getSummary()
void addRecord(const InstrProfRecord &)
void computeDetailedSummary()
void addCount(uint64_t Count)
This is called when a count is seen in the profile.
static const ProfileSummaryEntry & getEntryForPercentile(const SummaryEntryVector &DS, uint64_t Percentile)
Find the summary entry for a desired percentile of counts.
uint64_t MaxFunctionCount
static const ArrayRef< uint32_t > DefaultCutoffs
A vector of useful cutoff values for detailed summary.
SummaryEntryVector DetailedSummary
static uint64_t getHotCountThreshold(const SummaryEntryVector &DS)
static uint64_t getColdCountThreshold(const SummaryEntryVector &DS)
std::unique_ptr< ProfileSummary > getSummary()
std::unique_ptr< ProfileSummary > computeSummaryForProfiles(const sampleprof::SampleProfileMap &Profiles)
void addRecord(const sampleprof::FunctionSamples &FS, bool isCallsiteSample=false)
Representation of the samples collected for a function.
static void flattenProfile(SampleProfileMap &ProfileMap, bool ProfileIsCS=false)
This class provides operator overloads to the map container using MD5 as the key type,...
initializer< Ty > init(const Ty &Val)
@ ContextDuplicatedIntoBase
This is an optimization pass for GlobalISel generic memory operations.
cl::opt< uint64_t > ProfileSummaryHotCount
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
cl::opt< bool > UseContextLessSummary
cl::opt< uint64_t > ProfileSummaryColdCount
uint64_t getInstrMaxCountValue()
Return the max count value. We reserver a few large values for special use.
void sort(IteratorTy Start, IteratorTy End)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
cl::opt< int > ProfileSummaryCutoffCold
std::vector< ProfileSummaryEntry > SummaryEntryVector
cl::opt< unsigned > ProfileSummaryLargeWorkingSetSizeThreshold
cl::opt< int > ProfileSummaryCutoffHot
cl::opt< unsigned > ProfileSummaryHugeWorkingSetSizeThreshold
Profiling information for a single function.