[Mlir-commits] [mlir] [mlir][gpu] Add gpu.rotate operation (PR #142796)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jun 18 08:41:28 PDT 2025
================
@@ -1331,6 +1331,50 @@ void ShuffleOp::build(OpBuilder &builder, OperationState &result, Value value,
mode);
}
+//===----------------------------------------------------------------------===//
+// RotateOp
+//===----------------------------------------------------------------------===//
+
+void RotateOp::build(OpBuilder &builder, OperationState &result, Value value,
+ int32_t offset, int32_t width) {
+ build(builder, result, value,
+ builder.create<arith::ConstantOp>(result.location,
+ builder.getI32IntegerAttr(offset)),
+ builder.create<arith::ConstantOp>(result.location,
+ builder.getI32IntegerAttr(width)));
+}
+
+LogicalResult RotateOp::verify() {
+ auto offsetConstOp = getOffset().getDefiningOp<arith::ConstantOp>();
+ if (!offsetConstOp)
+ return emitOpError() << "offset is not a constant value";
+
+ auto offsetIntAttr =
+ llvm::dyn_cast<mlir::IntegerAttr>(offsetConstOp.getValue());
+ if (!offsetIntAttr)
+ return emitOpError() << "offset is not an integer value";
+
+ auto widthConstOp = getWidth().getDefiningOp<arith::ConstantOp>();
+ if (!widthConstOp)
+ return emitOpError() << "width is not a constant value";
+
+ auto widthIntAttr =
+ llvm::dyn_cast<mlir::IntegerAttr>(widthConstOp.getValue());
+ if (!widthIntAttr)
+ return emitOpError() << "width is not an integer value";
----------------
Muzammiluddin-Syed-ECE wrote:
This should already be checked by Tablegen definition of this argument as type I32.
https://github.com/llvm/llvm-project/pull/142796
More information about the Mlir-commits
mailing list