From 45e9ff45e718418be8688de4919b22dd8dd3ad97 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 2 Aug 2023 10:03:42 -0700 Subject: [PATCH] Running cleanup prior to iree-stream-outline-constants. This ensures that any constant folding/hoisting/etc has completed prior to outlining constants. --- .../src/iree/compiler/Dialect/Stream/Transforms/Passes.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/src/iree/compiler/Dialect/Stream/Transforms/Passes.cpp b/compiler/src/iree/compiler/Dialect/Stream/Transforms/Passes.cpp index b3233e685d0e..83a57a3d4de1 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/Transforms/Passes.cpp +++ b/compiler/src/iree/compiler/Dialect/Stream/Transforms/Passes.cpp @@ -61,12 +61,16 @@ void buildStreamTensorPassPipeline(OpPassManager &passManager, // Verify we support the program. passManager.addPass(IREE::Stream::createVerifyInputPass()); + // Cleanup the program prior to outlining constants in case there is + // propagation or fusion that needs to happen first. + addCleanupPatterns(passManager); + // Turn all constant ops into global variables and fix up the IR. // As many locations change and constants are deduplicated we'll end up with // a lot of extraneous IR (mostly global loads) and clean those up here. passManager.addPass(IREE::Stream::createOutlineConstantsPass()); - // Perform cleanup after constnat simplification as more canonicalizers may be + // Perform cleanup after constant simplification as more canonicalizers may be // able to kick in. addCleanupPatterns(passManager);