[Mlir-commits] [mlir] [TOSA] Change PadOp padding to tosa.shape (PR #123133)

Luke Hutton llvmlistbot at llvm.org
Tue Jan 21 06:00:34 PST 2025


================
@@ -306,7 +306,16 @@ class PadConverter : public OpConversionPattern<tosa::PadOp> {
                   ConversionPatternRewriter &rewriter) const final {
     auto loc = padOp.getLoc();
     auto input = padOp.getInput1();
-    auto padding = padOp.getPadding();
+
+    ElementsAttr paddingElems;
+    if (!matchPattern(padOp.getPadding(), m_Constant(&paddingElems))) {
----------------
lhutton1 wrote:

A bit surprised this works, maybe I'm missing something. Should we extract padding in a similar way as below?
```
if (!tosa::ExtractConstShapeValue(adaptor.getPadding().getDefiningOp(),
                                    paddingValues))
```
From: https://github.com/llvm/llvm-project/pull/123133/files#diff-90956ba24a2a97cc56a9a3659c7e46e56f1bd791a869246c6a758f9c93f1434fR841


https://github.com/llvm/llvm-project/pull/123133


More information about the Mlir-commits mailing list