forked from OSchip/llvm-project
[mlir][linalg] Add padding helper functions to PadTensorOp
Add helper functions to quickly check for zero low/high padding. Differential Revision: https://reviews.llvm.org/D103781
This commit is contained in:
parent
8344e215ec
commit
fe0befb123
|
@ -263,6 +263,18 @@ def Linalg_PadTensorOp : Linalg_Op<"pad_tensor",
|
|||
SmallVector<OpFoldResult> getMixedHighPad() {
|
||||
return getMixedPadImpl(static_high(), high());
|
||||
}
|
||||
// Return true if low padding is guaranteed to be 0.
|
||||
bool hasZeroLowPad() {
|
||||
return llvm::all_of(getMixedLowPad(), [](OpFoldResult ofr) {
|
||||
return mlir::isEqualConstantInt(ofr, 0);
|
||||
});
|
||||
}
|
||||
// Return true if high padding is guaranteed to be 0.
|
||||
bool hasZeroHighPad() {
|
||||
return llvm::all_of(getMixedHighPad(), [](OpFoldResult ofr) {
|
||||
return mlir::isEqualConstantInt(ofr, 0);
|
||||
});
|
||||
}
|
||||
}];
|
||||
|
||||
let builders = [
|
||||
|
|
Loading…
Reference in New Issue