diff --git a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td index 6098eb34d04d5..f620431ca92ac 100644 --- a/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td +++ b/mlir/include/mlir/Dialect/GPU/IR/GPUOps.td @@ -74,7 +74,20 @@ class GPU_IndexOp traits = []> : }]>, OpBuilder<(ins "::mlir::Type":$resultType, "::mlir::gpu::Dimension":$dimension), [{ build($_builder, $_state, resultType, dimension, /*upperBound=*/nullptr); + }]>, + OpBuilder<(ins "::mlir::gpu::Dimension":$dimension, "std::optional":$upperBound), [{ + ::mlir::IntegerAttr upperBoundAttr = nullptr; + if (upperBound.has_value()) + upperBoundAttr = $_builder.getIndexAttr(*upperBound); + build($_builder, $_state, dimension, upperBoundAttr); + }]>, + OpBuilder<(ins "::mlir::Type":$resultType, "::mlir::gpu::Dimension":$dimension, "std::optional":$upperBound), [{ + ::mlir::IntegerAttr upperBoundAttr = nullptr; + if (upperBound.has_value()) + upperBoundAttr = $_builder.getIndexAttr(*upperBound); + build($_builder, $_state, resultType, dimension, upperBoundAttr); }]> + ]; }