From 49335b7ee56d3d3b58b0850a3dbba3e179524739 Mon Sep 17 00:00:00 2001 From: Han-Chung Wang Date: Fri, 14 Jul 2023 14:48:59 -0700 Subject: [PATCH] [CodeGen] Remove IREE folding patterns from ConcretizePadResultShape. (#14408) The patterns are expected to be used right after distribution. User should call them explicitly, not including them in the pass. Fixes https://github.com/openxla/iree/issues/14406 --- .../iree/compiler/Codegen/Common/ConcretizePadResultShape.cpp | 3 --- compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTile.cpp | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/src/iree/compiler/Codegen/Common/ConcretizePadResultShape.cpp b/compiler/src/iree/compiler/Codegen/Common/ConcretizePadResultShape.cpp index 98556fd6929b..321e29bb278c 100644 --- a/compiler/src/iree/compiler/Codegen/Common/ConcretizePadResultShape.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/ConcretizePadResultShape.cpp @@ -168,9 +168,6 @@ void populateConcretizePadResultShapePatterns(RewritePatternSet &patterns, // Pulling in upstream scf.for and affine.min canonicalization patterns. // They work on tiled (but not distributed) loops. scf::populateSCFForLoopCanonicalizationPatterns(patterns); - // Pulling in IREE scf.for and affine.min canonicalization patterns. - // They work on tiled and distributed loops. - populateFoldAffineMinInDistributedLoopsPatterns(patterns, numWorkgroups); // Pulling in flow.dispatch.tensor.load op canonicalization patterns. // Tiling can generate dim ops taking them as operands. IREE::Flow::DispatchTensorLoadOp::getCanonicalizationPatterns(patterns, diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTile.cpp b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTile.cpp index 5ed0a8a09f99..97eac04df9db 100644 --- a/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTile.cpp +++ b/compiler/src/iree/compiler/Codegen/SPIRV/SPIRVTile.cpp @@ -227,6 +227,7 @@ static void concretizePadShape(func::FuncOp funcOp) { RewritePatternSet patterns(context); SmallVector numWorkgroups = getStaticNumWorkgroups(funcOp); populateConcretizePadResultShapePatterns(patterns, numWorkgroups); + populateFoldAffineMinInDistributedLoopsPatterns(patterns, numWorkgroups); (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); LLVM_DEBUG({