summaryrefslogtreecommitdiff
path: root/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
diff options
context:
space:
mode:
authorharsh-nod <harsh@nod-labs.com>2023-12-07 15:01:55 -0800
committerGitHub <noreply@github.com>2023-12-07 15:01:55 -0800
commit42bba97fc24f045f593fc26f998bac9b08633255 (patch)
tree60f7e8d79159156bebffe4c510704726a6af53d1 /mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
parentbfd41c3f8cc70bd65461a6d767f55c14d72150d9 (diff)
[mlir] Extend CombineTransferReadOpTranspose pattern to handle extf ops. (#74754)
This patch modifies the CombineTransferReadOpTranspose pattern to handle extf ops. Also adds a test which shows the transpose getting folded into the transfer_read.
Diffstat (limited to 'mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp')
-rw-r--r--mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
index 429d1137b6f3..f151011ee48a 100644
--- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
+++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
@@ -455,7 +455,8 @@ struct CombineTransferReadOpTranspose final
Type resultType = op.getType();
Operation *extOp;
if ((extOp = source.getDefiningOp<arith::ExtSIOp>()) ||
- (extOp = source.getDefiningOp<arith::ExtUIOp>())) {
+ (extOp = source.getDefiningOp<arith::ExtUIOp>()) ||
+ (extOp = source.getDefiningOp<arith::ExtFOp>())) {
source = extOp->getOperand(0);
resultType =
VectorType::get(cast<VectorType>(resultType).getShape(),
@@ -493,9 +494,12 @@ struct CombineTransferReadOpTranspose final
if (isa<arith::ExtSIOp>(extOp))
result = rewriter.create<arith::ExtSIOp>(loc, op.getType(), result)
.getResult();
- else
+ else if (isa<arith::ExtUIOp>(extOp))
result = rewriter.create<arith::ExtUIOp>(loc, op.getType(), result)
.getResult();
+ else
+ result = rewriter.create<arith::ExtFOp>(loc, op.getType(), result)
+ .getResult();
}
rewriter.replaceOp(op, result);