[Mlir-commits] [mlir] [mlir] Add helper to check elementwise-mappable ops with tensors and scalars (PR #154872)

Adam Siemieniuk llvmlistbot at llvm.org
Fri Aug 22 09:32:36 PDT 2025


================
@@ -19,6 +19,53 @@ func.func @addf_rank0(%arg0: tensor<f32>, %arg1: tensor<f32>) -> tensor<f32> {
   return %0 : tensor<f32>
 }
 
+// Test a binary elementwise op with a tensor and a scalar operand.
+// CHECK-LABEL: func @addf_tensor_plus_scalar_rank1
+//  CHECK-SAME:   %[[T:[0-9a-zA-Z]*]]: tensor<?xf32>, %[[S:[0-9a-zA-Z]*]]: f32
+func.func @addf_tensor_plus_scalar_rank1(%t: tensor<?xf32>, %s: f32) -> tensor<?xf32> {
----------------
adam-smnk wrote:

These tests still don't exercise the new logic. The rewrite occurs on `arith` ops that have tensor only operands.
I'm not sure if there are any upstream ops which are both `ElementwiseMappable` and accept mixed scalar/shape type operands.

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


More information about the Mlir-commits mailing list