[Mlir-commits] [mlir] [mlir][tensor] Fix PadOp::getConstantPaddingValue (PR #121205)

Han-Chung Wang llvmlistbot at llvm.org
Sun Jan 5 22:53:01 PST 2025


hanhanW wrote:

> > Actually, the constant value inside the PadOp can canonicalize to the outside
> 
> That's what I expected. It makes me think - wouldn't it be better to just bail out in this case (as opposed to creating `tensor.generate`)?

I'm not sure how the conversion works. However, shouldn't the generated `tensor.generate` op be replaced with a constant? It can happen either in the conversion or the tensor::GenerateOp's folder.

```mlir
// CHECK:           %[[VAL_1:.*]] = tensor.generate  {
// CHECK:           ^bb0(%[[VAL_2:.*]]: index, %[[VAL_3:.*]]: index, %[[VAL_4:.*]]: index, %[[VAL_5:.*]]: index):
// CHECK:             %[[VAL_6:.*]] = arith.constant 0.000000e+00 : f32
// CHECK:             tensor.yield %[[VAL_6]] : f32
// CHECK:           } : tensor<1x32x32x1xf32>
```

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


More information about the Mlir-commits mailing list