[Mlir-commits] [mlir] ed35b58 - [mlir][openacc] Restrict types for acc.bounds operands to index or integer type
Valentin Clement
llvmlistbot at llvm.org
Thu Apr 20 14:44:25 PDT 2023
Author: Valentin Clement
Date: 2023-04-20T14:44:19-07:00
New Revision: ed35b584daeda352d4ad109edc3bc04de798a1ac
URL: https://github.com/llvm/llvm-project/commit/ed35b584daeda352d4ad109edc3bc04de798a1ac
DIFF: https://github.com/llvm/llvm-project/commit/ed35b584daeda352d4ad109edc3bc04de798a1ac.diff
LOG: [mlir][openacc] Restrict types for acc.bounds operands to index or integer type
Values in bounds are expected to have integer or index types. Enforce
this expectation by restricting the type to be IntOrIndex.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D148839
Added:
Modified:
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
mlir/test/Dialect/OpenACC/invalid.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index ec6b28cc993f1..535e10ee13c02 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -103,12 +103,12 @@ def OpenACC_DataBoundsOp : OpenACC_Op<"bounds",
[AttrSizedOperandSegments, NoMemoryEffect]> {
let summary = "Represents bounds information for acc data clause.";
- let arguments = (ins Optional<AnyType>:$lowerbound,
- Optional<AnyType>:$upperbound,
- Optional<AnyType>:$extent,
- Optional<AnyType>:$stride,
+ let arguments = (ins Optional<IntOrIndex>:$lowerbound,
+ Optional<IntOrIndex>:$upperbound,
+ Optional<IntOrIndex>:$extent,
+ Optional<IntOrIndex>:$stride,
DefaultValuedAttr<BoolAttr, "false">:$strideInBytes,
- Optional<AnyType>:$startIdx);
+ Optional<IntOrIndex>:$startIdx);
let results = (outs OpenACC_DataBoundsType:$result);
let assemblyFormat = [{
diff --git a/mlir/test/Dialect/OpenACC/invalid.mlir b/mlir/test/Dialect/OpenACC/invalid.mlir
index d7dc39c280a2d..178167ff8d82c 100644
--- a/mlir/test/Dialect/OpenACC/invalid.mlir
+++ b/mlir/test/Dialect/OpenACC/invalid.mlir
@@ -198,3 +198,10 @@ acc.enter_data wait(%cst: index) create(%value : memref<10xf32>) attributes {wai
%value = memref.alloc() : memref<10xf32>
// expected-error at +1 {{wait_devnum cannot appear without waitOperands}}
acc.enter_data wait_devnum(%cst: index) create(%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