-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
Description
Op verifiers are not supposed to check non-local properties in ::verify()
: https://mlir.llvm.org/getting_started/DeveloperGuide/#ir-verifier
We should remove this code from the verifier for gpu.rotate
:
llvm-project/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
Lines 1360 to 1384 in 0f48baf
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(); | |
if (!widthValue.isPowerOf2()) | |
return emitOpError() << "width must be a power of two"; | |
if (offsetValue.sge(widthValue) || offsetValue.slt(0)) { | |
int64_t widthValueInt = widthValue.getSExtValue(); | |
return emitOpError() << "offset must be in the range [0, " << widthValueInt | |
<< ")"; | |
} |
An alternative would be to take width
as an attribute, if we want to have it verified.