[Mlir-commits] [mlir] [mlir][Tensor] Retain discardable attrs in pack(cast) folder (PR #115772)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Nov 13 09:24:24 PST 2024
MaheshRavishankar wrote:
> Discardable attributes are safe to use within a pass, but not across pass boundaries. E.g., I remember we had "filter" attributes in Linalg at some point. (Maybe still have them.) But we had to make sure to drop them again at the end of the pass (if they were still there), so they don't leak across pass boundaries.
Pass boundaries are completely arbitrary. I can do whatever in a pass (including launching new pipelines). So defining the attributes as something that does not leak across passes is completely arbitrary. Even with that definition, if I had two separate pattern application steps and I set an attribute before the first step it would be dropped by the next step.
I think we are missing that it is really useful for a compiler stack to have some way of annotating operations. This is very closely related to LLVM metadata, which from my working experience has a lot of similar issues, but is a tool that is used. It is not necessarily the most principled thing but is a pragmatic way to annotate the IR with some information that can be used by subsequent optimizations. This is literally the use case here. In my book, the real issue here is that this transformation could have been done in-place, in which case there would not be an issue.
We dont need to dictate how the whole world builds compilers. A lot of time you need to make pragmatic choice to connect things, and as long as it isnt disruptive to all downstream users this should be acceptable. Literally no one is affected by this change.
https://github.com/llvm/llvm-project/pull/115772
More information about the Mlir-commits
mailing list