summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
diff options
context:
space:
mode:
authorMark Heffernan <meheff@google.com>2015-07-13 18:33:21 +0000
committerMark Heffernan <meheff@google.com>2015-07-13 18:33:21 +0000
commit4c8ca53f7e1285c2bfe6bc72bb78579b200dc88f (patch)
tree4d365ceafa282c29b2b59b21510494d151fe2329 /llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
parent7ccb5e231681b1c560469911db0e31b06a562dab (diff)
downloadbcm5719-llvm-4c8ca53f7e1285c2bfe6bc72bb78579b200dc88f.tar.gz
bcm5719-llvm-4c8ca53f7e1285c2bfe6bc72bb78579b200dc88f.zip
Enable partial and runtime loop unrolling for NVPTX.
Enable partial and runtime loop unrolling for NVPTX backend via TTI::UnrollingPreferences with a small threshold. This partially unrolls small loops which are often unrolled by the PTX to SASS compiler and unrolling earlier can be beneficial. llvm-svn: 242049
Diffstat (limited to 'llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp')
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
index 241b145f719..e7250cdba5a 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
@@ -117,3 +117,15 @@ unsigned NVPTXTTIImpl::getArithmeticInstrCost(
Opd1PropInfo, Opd2PropInfo);
}
}
+
+void NVPTXTTIImpl::getUnrollingPreferences(Loop *L,
+ TTI::UnrollingPreferences &UP) {
+ BaseT::getUnrollingPreferences(L, UP);
+
+ // Enable partial unrolling and runtime unrolling, but reduce the
+ // threshold. This partially unrolls small loops which are often
+ // unrolled by the PTX to SASS compiler and unrolling earlier can be
+ // beneficial.
+ UP.Partial = UP.Runtime = true;
+ UP.PartialThreshold = UP.Threshold / 4;
+}
OpenPOWER on IntegriCloud