[PATCH] D29473: [AMDGPU] Unroll preferences improvements

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 14:50:24 PST 2017

arsenm added a comment.

Needs tests in test/Transforms/LoopUnroll/AMDGPU

Comment at: lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp:32-35
+static cl::opt<unsigned> UnrollThreshold(
+  "amdgpu-unroll-threshold",
+  cl::desc("Unroll threshold for AMDGPU"),
+  cl::init(300), cl::Hidden); // Twice the default.
I don't think we need this. The regular option I think overrides the target preference if set

Comment at: lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp:64-65
       if (Alloca) {
+        if (L->hasLoopInvariantOperands(GEP))
+          continue;
+        Type *Ty = Alloca->getAllocatedType();
Won't LICM move this out of the loop before unrolling?

Comment at: lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp:93-96
+  if (ST->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS)
     return 256;
+  else if (ST->getGeneration() >= AMDGPUSubtarget::SOUTHERN_ISLANDS)
+    return 128;
I don't think we should change this away from the hardware sizes. I think this hook is only used by the vectorizers we don't use. We should define a different constant for use for the alloca heuristic



More information about the llvm-commits mailing list