|
LLVM 23.0.0git
|
Profiling information for a single function. More...
#include "llvm/ProfileData/InstrProf.h"
Public Types | |
| enum | CountPseudoKind { NotPseudo = 0 , PseudoHot , PseudoWarm } |
| enum | PseudoCountVal { HotFunctionVal = -1 , WarmFunctionVal = -2 } |
Public Member Functions | |
| InstrProfRecord ()=default | |
| InstrProfRecord (std::vector< uint64_t > Counts) | |
| InstrProfRecord (std::vector< uint64_t > Counts, std::vector< uint8_t > BitmapBytes) | |
| InstrProfRecord (InstrProfRecord &&)=default | |
| InstrProfRecord (const InstrProfRecord &RHS) | |
| InstrProfRecord & | operator= (InstrProfRecord &&)=default |
| InstrProfRecord & | operator= (const InstrProfRecord &RHS) |
| bool | isBlockUniform (unsigned BlockIdx) const |
| Check if a basic block is entered via a wave-uniform branch. | |
| LLVM_ABI void | computeBlockUniformity () |
| Recompute uniformity metadata from raw uniform counters, when present. | |
| uint32_t | getNumValueKinds () const |
| Return the number of value profile kinds with non-zero number of profile sites. | |
| uint32_t | getNumValueSites (uint32_t ValueKind) const |
| Return the number of instrumented sites for ValueKind. | |
| uint32_t | getNumValueData (uint32_t ValueKind) const |
| Return the total number of ValueData for ValueKind. | |
| ArrayRef< InstrProfValueData > | getValueArrayForSite (uint32_t ValueKind, uint32_t Site) const |
Return the array of profiled values at Site. | |
| void | reserveSites (uint32_t ValueKind, uint32_t NumValueSites) |
| Reserve space for NumValueSites sites. | |
| LLVM_ABI void | addValueData (uint32_t ValueKind, uint32_t Site, ArrayRef< InstrProfValueData > VData, InstrProfSymtab *SymTab) |
| Add ValueData for ValueKind at value Site. | |
| LLVM_ABI void | merge (InstrProfRecord &Other, uint64_t Weight, function_ref< void(instrprof_error)> Warn) |
Merge the counts in Other into this one. | |
| LLVM_ABI void | scale (uint64_t N, uint64_t D, function_ref< void(instrprof_error)> Warn) |
| Scale up profile counts (including value profile data) by a factor of (N / D). | |
| void | sortValueData () |
| Sort value profile data (per site) by count. | |
| void | Clear () |
| Clear value data entries, edge counters, and uniformity data. | |
| void | clearValueData () |
| Clear value data entries. | |
| LLVM_ABI void | accumulateCounts (CountSumOrPercent &Sum) const |
| Compute the sums of all counts and store in Sum. | |
| LLVM_ABI void | overlap (InstrProfRecord &Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, uint64_t ValueCutoff) |
| Compute the overlap b/w this IntrprofRecord and Other. | |
| LLVM_ABI void | overlapValueProfData (uint32_t ValueKind, InstrProfRecord &Src, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap) |
| Compute the overlap of value profile counts. | |
| CountPseudoKind | getCountPseudoKind () const |
| void | setPseudoCount (CountPseudoKind Kind) |
Public Attributes | |
| std::vector< uint64_t > | Counts |
| std::vector< uint8_t > | BitmapBytes |
| std::vector< uint64_t > | UniformCounts |
| For AMDGPU offload profiling: raw or merged uniform counters. | |
| std::vector< uint8_t > | UniformityBits |
| For AMDGPU offload profiling: 1 bit per basic block indicating whether the block is usually entered with all lanes active. | |
| uint16_t | OffloadDeviceWaveSize = 0 |
Profiling information for a single function.
Definition at line 906 of file InstrProf.h.
| Enumerator | |
|---|---|
| NotPseudo | |
| PseudoHot | |
| PseudoWarm | |
Definition at line 1026 of file InstrProf.h.
| Enumerator | |
|---|---|
| HotFunctionVal | |
| WarmFunctionVal | |
Definition at line 1031 of file InstrProf.h.
|
default |
|
inline |
Definition at line 919 of file InstrProf.h.
References Counts, and llvm::move().
|
inline |
Definition at line 920 of file InstrProf.h.
References BitmapBytes, Counts, and llvm::move().
|
default |
References InstrProfRecord().
|
inline |
Definition at line 924 of file InstrProf.h.
References BitmapBytes, Counts, InstrProfRecord(), OffloadDeviceWaveSize, RHS, UniformCounts, and UniformityBits.
| void llvm::InstrProfRecord::accumulateCounts | ( | CountSumOrPercent & | Sum | ) | const |
Compute the sums of all counts and store in Sum.
Definition at line 774 of file InstrProf.cpp.
References llvm::Count, Counts, llvm::CountSumOrPercent::CountSum, getNumValueSites(), getValueArrayForSite(), I, llvm::CountSumOrPercent::NumEntries, llvm::NumValueSites, and llvm::CountSumOrPercent::ValueCounts.
Referenced by overlap().
| void llvm::InstrProfRecord::addValueData | ( | uint32_t | ValueKind, |
| uint32_t | Site, | ||
| ArrayRef< InstrProfValueData > | VData, | ||
| InstrProfSymtab * | SymTab ) |
Add ValueData for ValueKind at value Site.
We do not support adding sites out of order. Site must go up from 0 one by one.
Definition at line 1124 of file InstrProf.cpp.
References assert(), and llvm::ArrayRef< T >::size().
|
inline |
Clear value data entries, edge counters, and uniformity data.
Definition at line 1003 of file InstrProf.h.
References clearValueData(), Counts, OffloadDeviceWaveSize, UniformCounts, and UniformityBits.
|
inline |
| void llvm::InstrProfRecord::computeBlockUniformity | ( | ) |
Recompute uniformity metadata from raw uniform counters, when present.
Definition at line 952 of file InstrProf.cpp.
References Counts, I, UniformCounts, and UniformityBits.
|
inline |
Definition at line 1035 of file InstrProf.h.
References Counts, HotFunctionVal, NotPseudo, PseudoHot, PseudoWarm, and WarmFunctionVal.
Referenced by merge().
Return the total number of ValueData for ValueKind.
Definition at line 1140 of file InstrProf.h.
References N.
|
inline |
Return the number of value profile kinds with non-zero number of profile sites.
Definition at line 1133 of file InstrProf.h.
Return the number of instrumented sites for ValueKind.
Definition at line 1147 of file InstrProf.h.
Referenced by accumulateCounts(), overlap(), and overlapValueProfData().
|
inline |
Return the array of profiled values at Site.
Definition at line 1152 of file InstrProf.h.
Referenced by accumulateCounts(), llvm::annotateValueSite(), and llvm::getNumValueDataForSiteInstrProf().
Check if a basic block is entered via a wave-uniform branch.
Returns true if uniform (safe for PGO spill optimization) or if no uniformity data is available (conservative default).
Definition at line 952 of file InstrProf.h.
References UniformityBits.
| void llvm::InstrProfRecord::merge | ( | InstrProfRecord & | Other, |
| uint64_t | Weight, | ||
| function_ref< void(instrprof_error)> | Warn ) |
Merge the counts in Other into this one.
Optionally scale merged counts by Weight.
Definition at line 990 of file InstrProf.cpp.
References llvm::bitmap_mismatch, BitmapBytes, computeBlockUniformity(), llvm::count_mismatch, llvm::counter_overflow, Counts, getCountPseudoKind(), llvm::getInstrMaxCountValue(), I, InstrProfRecord(), llvm::mergeUniformityBits(), NotPseudo, OffloadDeviceWaveSize, llvm::Other, PseudoHot, PseudoWarm, llvm::SaturatingMultiplyAdd(), setPseudoCount(), UniformCounts, and UniformityBits.
|
inline |
Definition at line 932 of file InstrProf.h.
References BitmapBytes, Counts, InstrProfRecord(), OffloadDeviceWaveSize, RHS, UniformCounts, and UniformityBits.
|
default |
References InstrProfRecord().
| void llvm::InstrProfRecord::overlap | ( | InstrProfRecord & | Other, |
| OverlapStats & | Overlap, | ||
| OverlapStats & | FuncLevelOverlap, | ||
| uint64_t | ValueCutoff ) |
Compute the overlap b/w this IntrprofRecord and Other.
Definition at line 841 of file InstrProf.cpp.
References accumulateCounts(), llvm::OverlapStats::addOneMismatch(), assert(), llvm::OverlapStats::Base, Counts, llvm::CountSumOrPercent::CountSum, getNumValueSites(), I, InstrProfRecord(), llvm::CountSumOrPercent::NumEntries, llvm::Other, llvm::OverlapStats::Overlap, overlapValueProfData(), llvm::OverlapStats::score(), llvm::OverlapStats::Test, and llvm::OverlapStats::Valid.
Referenced by llvm::InstrProfWriter::overlapRecord(), and overlapValueProfData().
| void llvm::InstrProfRecord::overlapValueProfData | ( | uint32_t | ValueKind, |
| InstrProfRecord & | Src, | ||
| OverlapStats & | Overlap, | ||
| OverlapStats & | FuncLevelOverlap ) |
Compute the overlap of value profile counts.
Definition at line 823 of file InstrProf.cpp.
References assert(), getNumValueSites(), I, InstrProfRecord(), llvm::Other, and overlap().
Referenced by overlap().
Reserve space for NumValueSites sites.
Definition at line 1156 of file InstrProf.h.
References llvm::NumValueSites.
| void llvm::InstrProfRecord::scale | ( | uint64_t | N, |
| uint64_t | D, | ||
| function_ref< void(instrprof_error)> | Warn ) |
Scale up profile counts (including value profile data) by a factor of (N / D).
Definition at line 1081 of file InstrProf.cpp.
References assert(), computeBlockUniformity(), llvm::Count, llvm::counter_overflow, Counts, D(), llvm::getInstrMaxCountValue(), N, llvm::SaturatingMultiply(), and UniformCounts.
|
inline |
Definition at line 1043 of file InstrProf.h.
References Counts, HotFunctionVal, PseudoHot, PseudoWarm, and WarmFunctionVal.
Referenced by merge().
|
inline |
Sort value profile data (per site) by count.
Definition at line 996 of file InstrProf.h.
| std::vector<uint8_t> llvm::InstrProfRecord::BitmapBytes |
Definition at line 908 of file InstrProf.h.
Referenced by llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), InstrProfRecord(), InstrProfRecord(), merge(), llvm::NamedInstrProfRecord::NamedInstrProfRecord(), llvm::NamedInstrProfRecord::NamedInstrProfRecord(), and operator=().
| std::vector<uint64_t> llvm::InstrProfRecord::Counts |
Definition at line 907 of file InstrProf.h.
Referenced by accumulateCounts(), Clear(), computeBlockUniformity(), llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), getCountPseudoKind(), InstrProfRecord(), InstrProfRecord(), InstrProfRecord(), merge(), llvm::NamedInstrProfRecord::NamedInstrProfRecord(), llvm::NamedInstrProfRecord::NamedInstrProfRecord(), llvm::NamedInstrProfRecord::NamedInstrProfRecord(), operator=(), overlap(), scale(), and setPseudoCount().
| uint16_t llvm::InstrProfRecord::OffloadDeviceWaveSize = 0 |
Definition at line 916 of file InstrProf.h.
Referenced by Clear(), InstrProfRecord(), merge(), and operator=().
| std::vector<uint64_t> llvm::InstrProfRecord::UniformCounts |
For AMDGPU offload profiling: raw or merged uniform counters.
One uint64_t per instrumented block, tracking entries where all lanes were active.
Definition at line 911 of file InstrProf.h.
Referenced by Clear(), computeBlockUniformity(), InstrProfRecord(), merge(), operator=(), and scale().
| std::vector<uint8_t> llvm::InstrProfRecord::UniformityBits |
For AMDGPU offload profiling: 1 bit per basic block indicating whether the block is usually entered with all lanes active.
Raw uniform counters are reduced to these bits when profiles are written or merged.
Definition at line 915 of file InstrProf.h.
Referenced by Clear(), computeBlockUniformity(), llvm::InstrProfRecordWriterTrait::EmitData(), llvm::InstrProfRecordWriterTrait::EmitKeyDataLength(), InstrProfRecord(), isBlockUniform(), merge(), llvm::NamedInstrProfRecord::NamedInstrProfRecord(), and operator=().