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

Adam Siemieniuk llvmlistbot at llvm.org
Mon Aug 25 10:00:34 PDT 2025


adam-smnk wrote:

> > > to meet the rank = 0 operand requirements / test cases.
> > 
> > 
> > Could you also add a negative test for this?
> 
> Sorry, would you mind expanding a bit more?

Of course, I take that this check `anyRankedTensor` guards against scalar-only eltwise op as linalg requires a shaped type for its types. It'd be great to have a one test case that covers this scenario and ensures that the pattern doesn't match (and nothing blows up 😉).

You could add sth like this:
```mlir
@func negative_scalar_only_eltwise(...) {
// CHECK-NOT: linalg
arith.addf ... : f32
```

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


More information about the Mlir-commits mailing list