[Mlir-commits] [mlir] [mlir][gpu] Make offset and width in gpu.rotate as attributes (PR #150901)
Igor Wodiany
llvmlistbot at llvm.org
Mon Jul 28 02:24:39 PDT 2025
================
@@ -1395,40 +1395,15 @@ void ShuffleOp::build(OpBuilder &builder, OperationState &result, Value value,
// RotateOp
//===----------------------------------------------------------------------===//
-void RotateOp::build(OpBuilder &builder, OperationState &result, Value value,
- int32_t offset, int32_t width) {
- build(builder, result, value,
- arith::ConstantOp::create(builder, result.location,
- builder.getI32IntegerAttr(offset)),
- arith::ConstantOp::create(builder, 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());
-
- 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());
-
- llvm::APInt offsetValue = offsetIntAttr.getValue();
- llvm::APInt widthValue = widthIntAttr.getValue();
+ uint32_t offset = getOffset();
+ uint32_t width = getWidth();
- if (!widthValue.isPowerOf2())
+ if (!llvm::isPowerOf2_32(width))
----------------
IgWod-IMG wrote:
It seems that `ConfinedAttr` would work here as there is `IntPowerOf2` constraint.
https://github.com/llvm/llvm-project/pull/150901
More information about the Mlir-commits
mailing list