Skip to content

Commit 2fbd13b

Browse files
authored
Revert "[GPU][Codegen] Expand iteration space based on new expand_dims attribute (#22342) (#22982)
This reverts commit b879ee1. To temporarily fix ONNX models test suite from issues suspected from [[DispatchCreation] Unit dims not properly folded away during GlobalOptimization](#22978) and reported regression. Signed-off-by: Eric Feng <[email protected]>
1 parent b879ee1 commit 2fbd13b

27 files changed

+203
-902
lines changed

compiler/src/iree/compiler/Codegen/Common/BlockDynamicDimensions.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ using TensorDivisibilityInfo =
3636

3737
namespace {
3838

39+
struct RemoveOptimizationBarrier final
40+
: public OpRewritePattern<IREE::Util::OptimizationBarrierOp> {
41+
using Base::Base;
42+
43+
LogicalResult matchAndRewrite(IREE::Util::OptimizationBarrierOp barrierOp,
44+
PatternRewriter &rewriter) const override {
45+
rewriter.replaceOp(barrierOp, barrierOp.getOperands());
46+
return success();
47+
}
48+
};
49+
3950
/// This pass is used to materialize information about dynamic dimensions of
4051
/// `tensor` operands of an operation in the IR. If a dynamic dimension is
4152
/// known to be a multiple of a compile-time constant value, this pass
@@ -99,6 +110,10 @@ getTensorDivisibilityInfo(const TensorDynamicDimAnalysis &dynamicDimAnalysis,
99110
/// inverses of each other. The `util.optimization.barrier` avoid these from
100111
/// getting folded away during reshape propagation. Return the result of the
101112
/// `tensor.collapse_shape generated.
113+
struct ReshapeOps {
114+
tensor::ExpandShapeOp expandShapeOp;
115+
tensor::CollapseShapeOp collapseShapeOp;
116+
};
102117
static std::optional<ReshapeOps>
103118
blockDynamicDimensionsOfValue(RewriterBase &rewriter,
104119
const TensorDivisibilityInfo &divisibilityInfo,
@@ -398,7 +413,7 @@ void BlockDynamicDimensionsPass::runOnOperation() {
398413
// Delete the optimization barrier and run some further cleanup.
399414
{
400415
RewritePatternSet removeBarrierOpsPatterns(context);
401-
populateRemoveOptimizationBarrierPatterns(removeBarrierOpsPatterns);
416+
removeBarrierOpsPatterns.insert<RemoveOptimizationBarrier>(context);
402417
tensor::ExpandShapeOp::getCanonicalizationPatterns(removeBarrierOpsPatterns,
403418
context);
404419
tensor::CollapseShapeOp::getCanonicalizationPatterns(

compiler/src/iree/compiler/Codegen/Common/GPU/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ iree_compiler_cc_library(
7474
"GPUDistributeScfFor.cpp",
7575
"GPUDistributeSharedMemoryCopy.cpp",
7676
"GPUDistributionPatterns.cpp",
77-
"GPUExpandDimensions.cpp",
7877
"GPUFuseAndHoistParallelLoops.cpp",
7978
"GPUGeneralizeNamedOps.cpp",
8079
"GPUGreedilyDistributeToThreads.cpp",
@@ -126,7 +125,6 @@ iree_compiler_cc_library(
126125
"//compiler/src/iree/compiler/Dialect/LinalgExt/Transforms",
127126
"//compiler/src/iree/compiler/Dialect/LinalgExt/Utils",
128127
"//compiler/src/iree/compiler/Dialect/TensorExt/IR",
129-
"//compiler/src/iree/compiler/Dialect/Util/IR",
130128
"//compiler/src/iree/compiler/Utils",
131129
"@llvm-project//llvm:Support",
132130
"@llvm-project//mlir:AMDGPUDialect",

compiler/src/iree/compiler/Codegen/Common/GPU/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ iree_cc_library(
6767
"GPUDistributeScfFor.cpp"
6868
"GPUDistributeSharedMemoryCopy.cpp"
6969
"GPUDistributionPatterns.cpp"
70-
"GPUExpandDimensions.cpp"
7170
"GPUFuseAndHoistParallelLoops.cpp"
7271
"GPUGeneralizeNamedOps.cpp"
7372
"GPUGreedilyDistributeToThreads.cpp"
@@ -160,7 +159,6 @@ iree_cc_library(
160159
iree::compiler::Dialect::LinalgExt::Transforms
161160
iree::compiler::Dialect::LinalgExt::Utils
162161
iree::compiler::Dialect::TensorExt::IR
163-
iree::compiler::Dialect::Util::IR
164162
iree::compiler::Utils
165163
PUBLIC
166164
)

compiler/src/iree/compiler/Codegen/Common/GPU/GPUExpandDimensions.cpp

Lines changed: 0 additions & 290 deletions
This file was deleted.

compiler/src/iree/compiler/Codegen/Common/GPU/Passes.td

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,6 @@ def GPUApplyPaddingLevelPass :
383383
];
384384
}
385385

386-
def GPUExpandDimensionsPass :
387-
InterfacePass<"iree-codegen-gpu-expand-dimensions", "mlir::FunctionOpInterface"> {
388-
let summary = "Pass to expand tensor op dims based on `expand_dims` lowering_config";
389-
let dependentDialects = [
390-
"::mlir::iree_compiler::IREE::Util::UtilDialect"
391-
];
392-
}
393-
394386
def GPUTensorTileToSerialLoopsPass :
395387
InterfacePass<"iree-codegen-gpu-tensor-tile-to-serial-loops", "mlir::FunctionOpInterface"> {
396388
let summary = "Pass to tile reduction dimensions for certain GPU ops";

compiler/src/iree/compiler/Codegen/Common/GPU/test/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ iree_lit_test_suite(
3636
"gpu_distribute_forall.mlir",
3737
"gpu_distribute_scf_for.mlir",
3838
"gpu_distribute_shared_memory.mlir",
39-
"gpu_expand_dimensions.mlir",
4039
"gpu_fuse_and_hoist_forall.mlir",
4140
"gpu_generalize_named_ops.mlir",
4241
"gpu_greedily_distribute_to_threads.mlir",

compiler/src/iree/compiler/Codegen/Common/GPU/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ iree_lit_test_suite(
3232
"gpu_distribute_forall.mlir"
3333
"gpu_distribute_scf_for.mlir"
3434
"gpu_distribute_shared_memory.mlir"
35-
"gpu_expand_dimensions.mlir"
3635
"gpu_fuse_and_hoist_forall.mlir"
3736
"gpu_generalize_named_ops.mlir"
3837
"gpu_greedily_distribute_to_threads.mlir"

0 commit comments

Comments
 (0)