Control-Flow Sink moves operations whose only uses are in conditionally-executed regions into those regions so that paths in which their results are not needed do not perform unnecessary computation.
Depends on D115087
Differential D115088
[mlir] Add a ControlFlowSink pass. Mogball on Dec 3 2021, 5:24 PM. Authored by
Details
Control-Flow Sink moves operations whose only uses are in conditionally-executed regions into those regions so that paths in which their results are not needed do not perform unnecessary computation. Depends on D115087
Diff Detail
Event Timeline
Comment Actions I'm not sure about the interest of such a pass, without some profitability aspects. I guess this could be a test pass, where the core of the transformation is exposed as a utility. The utility could have some filtering / callback to support the decision process and users could then implement the pass for their own needs. Comment Actions I'm not against this approach, as I have a specific use-case in mind (TF) that will probably require the API to be modified, but I have to yet decide what exactly the callbacks will be. However, the pass as-is should be a uniform gain, because it only considers non-memory-effecting ops. Comment Actions I guess the "single conditionally-executed region" may be enough of a criteria here to be conservative and get started. I suspect we'll still need to evolve this to be more configurable, so I'd rather have the split between the utility and the pass up-front (even if the utility doesn't expose options immediately)
Comment Actions I still see several comments that haven't been marked "Done".
Comment Actions thanks!
Comment Actions Did a scan and looks good from my point of view as something that we can land and iterate on.
Comment Actions LGTM. Nit: "work queue" -> "work list" at many places.
Comment Actions Nice, thanks for refactoring!
|
is always known and at least 0 ?
Or is this trying to say it may be unknown but in that case 0 could be returned so there'll always be a lower bound even if not exact? (I think the latter)