[clang] [compiler-rt] [llvm] [PGO][AMDGPU] Add offload profiling with uniformity-aware optimization (PR #177665)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 26 06:36:48 PST 2026
================
@@ -240,12 +251,49 @@ void SpillPlacement::run(MachineFunction &mf, EdgeBundles *Bundles,
TodoList.clear();
TodoList.setUniverse(bundles->getNumBundles());
+ // Check if we should flatten frequencies for AMDGPU to avoid PGO-related
+ // performance issues with divergent branches.
+ bool IsAMDGPU = mf.getSubtarget().getTargetTriple().isAMDGPU();
+ bool FlattenAllFreqs = AMDGPUFlattenSpillFrequency && IsAMDGPU;
+
+ // Get per-block uniformity info if available (set by PGO-use for AMDGPU).
+ StringRef UniformityAttr;
+ if (IsAMDGPU && !FlattenAllFreqs) {
+ const Function &F = mf.getFunction();
+ if (F.hasFnAttribute("amdgpu-block-uniformity")) {
----------------
arsenm wrote:
Don't see why this attribute is necessary. The profiling data is the annotation
https://github.com/llvm/llvm-project/pull/177665
More information about the cfe-commits
mailing list