[Mlir-commits] [mlir] [mlir] Enable decoupling two kinds of greedy behavior. (PR #104649)
Jacques Pienaar
llvmlistbot at llvm.org
Mon Sep 2 16:27:42 PDT 2024
================
@@ -840,6 +840,11 @@ LogicalResult RegionPatternRewriteDriver::simplify(bool *changed) && {
// regions to enable more aggressive CSE'ing).
OperationFolder folder(ctx, this);
auto insertKnownConstant = [&](Operation *op) {
+ // This hoisting is to enable more folding, so skip checking if known
+ // constant, updating dense map etc if not doing folding.
+ if (!config.fold)
----------------
jpienaar wrote:
What problem do you think is being worked around?
For me I see this as I'm a user that wants a worklist driven driver, I have a curated pipeline where I know there isn't any folding here (e.g., the ops being created have no folding, its part of pipeline where folding is ~0% likely, so the ROI on checking if it can be folded is none), but they have no way of communicating that intent. The problem is expert users not being able to express intent without crafting own/local forking.
Now, constant CSE'ing as Matthias correctly points out is different. It is documented here as enabling more folding, so disabled too (this is cheaper here too as all constant hoisting would have happened earlier and there may be no additional chance here to produce additional constants that would need CSE'ing). But it is different so I could see controlling separately is good. And don't mind doing that. I think this is a framework for high performance, so reasonably defaults that can be tuned seems reasonable to me. I considered the maintenance cost but specialized drivers that share most of the same code seemed higher maintenance cost to me.
https://github.com/llvm/llvm-project/pull/104649
More information about the Mlir-commits
mailing list