[PATCH] D68873: [AMDGPU] Amend target loop unroll defaults

Tim Corringham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 09:20:44 PST 2019


timcorringham updated this revision to Diff 229867.
timcorringham added a comment.

Function attribute for loop unroll threshold default

Changed approach for this in response to review comments. The new change is less invasive
and avoids OS/environment specific behavior in the target specific heuristics.
It allows the front-end to provide a minimum value for the loop unroll threshold on a
per-function basis, while still allowing the heuristics to adjust that threshold.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68873/new/

https://reviews.llvm.org/D68873

Files:
  llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
@@ -90,7 +90,8 @@
 
 void AMDGPUTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
                                             TTI::UnrollingPreferences &UP) {
-  UP.Threshold = 300; // Twice the default.
+  const Function &F = *L->getHeader()->getParent();
+  UP.Threshold = AMDGPU::getIntegerAttribute(F, "amdgpu-unroll-threshold", 300);
   UP.MaxCount = std::numeric_limits<unsigned>::max();
   UP.Partial = true;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68873.229867.patch
Type: text/x-patch
Size: 674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191118/c5e0e568/attachment-0001.bin>


More information about the llvm-commits mailing list