================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to