[Mlir-commits] [mlir] f32b340 - [mlir][sparse] convert function pass to module pass

Aart Bik llvmlistbot at llvm.org
Fri Feb 19 20:04:19 PST 2021


Author: Aart Bik
Date: 2021-02-19T20:04:02-08:00
New Revision: f32b3401e17767ae861943ebb3da814e4a969a4b

URL: https://github.com/llvm/llvm-project/commit/f32b3401e17767ae861943ebb3da814e4a969a4b
DIFF: https://github.com/llvm/llvm-project/commit/f32b3401e17767ae861943ebb3da814e4a969a4b.diff

LOG: [mlir][sparse] convert function pass to module pass

Rationale:
Touching function level information can only be done within a module pass.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D97102

Added: 
    

Modified: 
    mlir/test/lib/Transforms/TestSparsification.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/Transforms/TestSparsification.cpp b/mlir/test/lib/Transforms/TestSparsification.cpp
index bbaf1f856cd8..72c8f7b7e826 100644
--- a/mlir/test/lib/Transforms/TestSparsification.cpp
+++ b/mlir/test/lib/Transforms/TestSparsification.cpp
@@ -17,7 +17,7 @@ using namespace mlir;
 namespace {
 
 struct TestSparsification
-    : public PassWrapper<TestSparsification, FunctionPass> {
+    : public PassWrapper<TestSparsification, OperationPass<ModuleOp>> {
 
   TestSparsification() = default;
   TestSparsification(const TestSparsification &pass) {}
@@ -99,7 +99,7 @@ struct TestSparsification
   }
 
   /// Runs the test on a function.
-  void runOnFunction() override {
+  void runOnOperation() override {
     auto *ctx = &getContext();
     OwningRewritePatternList patterns;
     // Translate strategy flags to strategy options.
@@ -109,7 +109,7 @@ struct TestSparsification
     // Apply rewriting.
     linalg::populateSparsificationPatterns(ctx, patterns, options);
     vector::populateVectorToVectorCanonicalizationPatterns(patterns, ctx);
-    (void)applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
+    (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
     // Lower sparse primitives to calls into runtime support library.
     if (lower) {
       OwningRewritePatternList conversionPatterns;


        


More information about the Mlir-commits mailing list