[Mlir-commits] [mlir] [mlir][linalg] Add producer and consumer info to ControlPropagationFn. (PR #96697)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 26 16:44:58 PDT 2024


MaheshRavishankar wrote:

> > I have found it convenient to just use `OpOperand*` . That way the caller doesn't have to pass producer, consumer explicitly
> 
> I don't follow how it works with a single `OpOperand*`. Can you elaborate a little more? In the data layout propagation case, there could be `(pack, reshape)`, `(reshape, pack)`, `(generic, pack)`, `(pack, generic)`, etc. I don't follow how to distinguish `(pack, reshape)` and `(reshape, pack)` cases in the approach.

>From the `OpOperand *` you can do this
```
Operation *producer = opOperand->get().getDefiningOp();
Operation *consumer = opOperand->getOwner();
```

For the `(pack, reshape)` case, the producer is a `pack` and consumer is a `reshape`. For the `(reshape, pack)` case the producer is a `reshape` and consumer is `pack`.

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


More information about the Mlir-commits mailing list