[Mlir-commits] [mlir] [SCF] add debug label for MergeNestedParallelLoops pattern (PR #135980)

Scott Manley llvmlistbot at llvm.org
Wed Apr 16 09:02:31 PDT 2025


https://github.com/rscottmanley created https://github.com/llvm/llvm-project/pull/135980

Adding debug labels to rewrite patterns gives the canonicalizer the ability to disable specific patterns if undesired.

The motivation here is that since there is currently no way to handle attributes on ops that are changed when these patterns are applied, this at least provides a workaround.

>From d0974e17c5588c7f58e7a5828bc14eafe8fa07af Mon Sep 17 00:00:00 2001
From: Scott Manley <scmanley at nvidia.com>
Date: Wed, 16 Apr 2025 08:56:09 -0700
Subject: [PATCH] [SCF] add debug label for MergeNestedParallelLoops pattern

Adding debug labels to rewrite patterns gives the canonicalizer the
ability to disable specific patterns if undesired.

The motivation here is that since there is currently no way to handle
attributes on ops that are changed when these patterns are applied, this
at least provides a workaround.
---
 mlir/lib/Dialect/SCF/IR/SCF.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index c454f342b4204..04e89105c056a 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -3202,9 +3202,9 @@ struct MergeNestedParallelLoops : public OpRewritePattern<ParallelOp> {
 
 void ParallelOp::getCanonicalizationPatterns(RewritePatternSet &results,
                                              MLIRContext *context) {
-  results
-      .add<ParallelOpSingleOrZeroIterationDimsFolder, MergeNestedParallelLoops>(
-          context);
+  results.add<ParallelOpSingleOrZeroIterationDimsFolder>(context);
+  results.addWithLabel<MergeNestedParallelLoops>({"MergeNestedParallelLoops"},
+                                                 context);
 }
 
 /// Given the region at `index`, or the parent operation if `index` is None,



More information about the Mlir-commits mailing list