[mlir] [MLIR][Linalg] Add aggregate ops decomposition pass and softmax decom… (PR #97582)

Andrzej Warzyński llvmlistbot at llvm.org
Mon Jul 8 02:36:42 PDT 2024


banach-space wrote:

Thanks!

Does this PR change what Ops `linalg.sotfmax` is decomposed into? As in, do the semantics of `linalg.softmax` change? Looking at [mlir/test/Dialect/Linalg/transform-op-decompose.mlir](https://github.com/llvm/llvm-project/pull/97582/files#diff-4ae355ef381291c83e76cefbeb8de9aea58d99b19969dff635e1ec2c87f2c278), I feel that the main difference was:

> linalg.fills become a genteric, but that's a minor thing and I think it's the right thing to have.

Also, what's the difference between "transform-op-decompose.mlir" and "decompose-named-ops.mlir"? Is it just "how" the decomposition is "driven"? (TD vs Pass) Couldn't that be one test instead?

> Implementation for softmax follows the lowering semantics of popular frameworks like https://github.com/intel/graph-compiler/issues/10#issuecomment-2161145033, https://github.com/intel/graph-compiler/issues/10#issuecomment-2162722181, and https://github.com/intel/graph-compiler/issues/10#issuecomment-2161153179.

Thanks for checking and for the extra context. I am just wondering:
* If this claims alignment with e.g. PyTorch (or, more specifically, torch-mlir), shouldn't there be a link to `torch-mlir` docs/issues/code/test instead?
* Are you saying that this PR is changing the semantics of softmax in Linalg?

> now aggregate ops are decomposed first and then generalized

I am a bit confused, there's `-linalg-decompose-named-ops` and  `-linalg-generalize-named-ops` - which one are you referring to? The first one would only decompose and the latter would only generalise, right? 

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


More information about the Mlir-commits mailing list