Question regarding linalg generic operation

Hey,
In context of linalg generic operation, is it legal to have a usage/access to a tensor/memerf in the payload of the op. which has not been declared as part of the linalg generic’s inputs/ins ?

It isn’t legal in the sense that none of the transformations expect that and tiling/fusion will likely produce invalid IR. But it is technically possible to construct such an op.

Thanks for the response.
I see, It’s really possible to produce such an op. so this case shouldn’t be verified at the linalg generic op?

It is rather difficult to verify. Disallowing all side-effecting operations feels like too big of a hammer in this case. And memrefs can alias, so there’s no guarantee that reading from an arbitrary memref isn’t actually reading from the argument. If you have ideas, or have tried to modify the verifier and saw what happens, I’d be curious to learn!

Note that the current implementation allows captures and it is the user’s responsibility to guarantee that the iterators semantics (parallel, reduction, future other types) are correct.

If the iterators semantics is indeed correct, tiling is valid.

1 Like