[Mlir-commits] [mlir] 7cb9629 - [mlir][openacc] Update acc.enter_data verifier for dataOperands
Valentin Clement
llvmlistbot at llvm.org
Mon May 8 09:28:36 PDT 2023
Author: Valentin Clement
Date: 2023-05-08T09:28:31-07:00
New Revision: 7cb9629920462135be55b1a2ff2012a04a824bdd
URL: https://github.com/llvm/llvm-project/commit/7cb9629920462135be55b1a2ff2012a04a824bdd
DIFF: https://github.com/llvm/llvm-project/commit/7cb9629920462135be55b1a2ff2012a04a824bdd.diff
LOG: [mlir][openacc] Update acc.enter_data verifier for dataOperands
Data operands associated with acc.enter_data should comes
from acc data entry operations.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D149991
Added:
Modified:
mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
mlir/test/Dialect/OpenACC/invalid.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
index cb9ed7e0ea44..9c7b56a80a9d 100644
--- a/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
+++ b/mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
@@ -581,6 +581,11 @@ LogicalResult acc::EnterDataOp::verify() {
if (getWaitDevnum() && getWaitOperands().empty())
return emitError("wait_devnum cannot appear without waitOperands");
+ for (mlir::Value operand : getDataClauseOperands())
+ if (!mlir::isa<acc::AttachOp, acc::CreateOp, acc::CopyinOp>(
+ operand.getDefiningOp()))
+ return emitError("expect data entry operation as defining op");
+
return success();
}
diff --git a/mlir/test/Dialect/OpenACC/invalid.mlir b/mlir/test/Dialect/OpenACC/invalid.mlir
index 465e0de46fd5..b8b9c30f0312 100644
--- a/mlir/test/Dialect/OpenACC/invalid.mlir
+++ b/mlir/test/Dialect/OpenACC/invalid.mlir
@@ -209,6 +209,12 @@ acc.enter_data wait_devnum(%cst: index) create(%value : memref<10xf32>)
// -----
+%value = memref.alloc() : memref<10xf32>
+// expected-error at +1 {{expect data entry operation as defining op}}
+acc.enter_data dataOperands(%value : memref<10xf32>)
+
+// -----
+
%0 = arith.constant 1.0 : f32
// expected-error at +1 {{operand #0 must be integer or index, but got 'f32'}}
%1 = acc.bounds lowerbound(%0 : f32)
More information about the Mlir-commits
mailing list