[Mlir-commits] [mlir] Check linalg.generic arguments to prevent crashing when they are deleted (PR #119110)
Renat Idrisov
llvmlistbot at llvm.org
Sat Dec 14 07:10:55 PST 2024
parsifal-47 wrote:
Hi @banach-space,
thank you for helping
> > other operations are unlike linalg.generic they provide "safe" isMemoryEffectFree function which does not break when args are null.
>
> Do you have links? I'm curious where the discrepancy is coming from.
I browsed the source code and I haven't found any operation which checks its arguments upon isMemoryEffectFree. They are safe because of semantics is different and complex operations like structured control flow is handled separately.
> > What would you recommend, precompute this function for all nodes in IR and then use it when walking?
>
> IIUC, the suggestion is to pre-compute things to delete, then remove the operation and then the arguments. Perhaps the latter won't be needed if the only consumer is deleted.
Two walks within the pass, one to compute and one to delete? Does not look natural, maybe there is an analysis like Liveness which could be relied on.
> > Another approach to propose is to remove simple operation if at least one of its arguments is already removed
>
> Is this valid though: "if one argument of Op has been deleted --> Op can be deleted"?
That is the assumption, simple operation cannot survive the removal of positional arguments. If one argument is removed and operation is not, it is a crash.
I am fine with any of these paths and I want to do it right, but it is a bit unclear if I need an attention of code owners and how to get it.
Thank you!
https://github.com/llvm/llvm-project/pull/119110
More information about the Mlir-commits
mailing list