summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms
diff options
context:
space:
mode:
authorUday Bondhugula <uday@polymagelabs.com>2019-12-18 09:59:37 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-18 10:00:04 -0800
commit47034c4bc509f727051ff172c2bf3367a60e2c01 (patch)
tree80c36f8028f7d82b5768e3c46ecc2860e22902f6 /mlir/lib/Transforms
parent4562e389a43caa2e30ebf277c12743edafe6a0ac (diff)
downloadbcm5719-llvm-47034c4bc509f727051ff172c2bf3367a60e2c01.tar.gz
bcm5719-llvm-47034c4bc509f727051ff172c2bf3367a60e2c01.zip
Introduce prefetch op: affine -> std -> llvm intrinsic
Introduce affine.prefetch: op to prefetch using a multi-dimensional subscript on a memref; similar to affine.load but has no effect on semantics, but only on performance. Provide lowering through std.prefetch, llvm.prefetch and map to llvm's prefetch instrinsic. All attributes reflected through the lowering - locality hint, rw, and instr/data cache. affine.prefetch %0[%i, %j + 5], false, 3, true : memref<400x400xi32> Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#225 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/225 from bondhugula:prefetch 4c3b4e93bc64d9a5719504e6d6e1657818a2ead0 PiperOrigin-RevId: 286212997
Diffstat (limited to 'mlir/lib/Transforms')
-rw-r--r--mlir/lib/Transforms/Utils/Utils.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/mlir/lib/Transforms/Utils/Utils.cpp b/mlir/lib/Transforms/Utils/Utils.cpp
index 79a6d7a6902..57a92531163 100644
--- a/mlir/lib/Transforms/Utils/Utils.cpp
+++ b/mlir/lib/Transforms/Utils/Utils.cpp
@@ -49,7 +49,8 @@ static bool isMemRefDereferencingOp(Operation &op) {
/// Return the AffineMapAttr associated with memory 'op' on 'memref'.
static NamedAttribute getAffineMapAttrForMemRef(Operation *op, Value *memref) {
return TypeSwitch<Operation *, NamedAttribute>(op)
- .Case<AffineDmaStartOp, AffineLoadOp, AffineStoreOp, AffineDmaWaitOp>(
+ .Case<AffineDmaStartOp, AffineLoadOp, AffinePrefetchOp, AffineStoreOp,
+ AffineDmaWaitOp>(
[=](auto op) { return op.getAffineMapAttrForMemRef(memref); });
}
OpenPOWER on IntegriCloud