Skip to content

Commit f27feff

Browse files
authored
Update LLVM to llvm/llvm-project@ac8bb735. C++ changes are related to change in behavior of TypeConverter changed in iree-org/llvm-project@3cc311a. It used to generate UnrealizedConversionCastOp, during applySignatureConversion in GenericOpTypePropagation of TypePropagationPass.cpp, however now it's not. This causes unrealized_conversion_cast to be generated later and hence survive the pass. To repro above behavior, try undo the C++ change in this PR and then: ``` wget https://gist.githubusercontent.com/raikonenfnu/dfb3b274007df8c4be87daf9ee67a5f4/raw/e48cc07e5fa558cd2c450b0e3ae46568136e1be6/type_propagate_repro.mlir iree-opt --pass-pipeline='builtin.module(func.func(iree-codegen-type-propagation))' propagate_test.mlir -o /dev/null error: failed to legalize unresolved materialization from ('i8') to ('i1') that remained live after conversion ^bb0(%in: i1, %in_0: f32, %in_1: f32, %out: f32): ^ propagate_test.mlir:5:8: note: see current operation: %10 = "builtin.unrealized_conversion_cast"(%arg0) : (i8) -> i1 propagate_test.mlir:6:11: note: see existing live user here: %10 = arith.select %9, %in_0, %in_1 : f32 ``` Additionally, we made API changes in 6ed8924 from: 1. `applyPatternsAndFoldGreedily` -> `applyPatternsGreedily` 2. `applyOpPatternsAndFold` -> `applyOpPatternsGreedily` To resolve depracated API error in bazel This PR also carries the following reverts: llvm/llvm-project#119461 The main issue with PR 119461 is it breaks e2e riscv test by making it get stuck on infinite loop. ``` /path/to/iree-build/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=llvm-cpu --iree-input-type=stablehlo --iree-input-demote-f64-to-f32 --iree-llvmcpu-target-cpu=generic /path/to/iree/tests/e2e/stablehlo_ops/three_fry.mlir -o three_fly_exec_target.mlir --iree-llvmcpu-target-triple=riscv64 --iree-llvmcpu-target-abi=lp64d --iree-llvmcpu-target-cpu-features=+m,+a,+d,+zvl512b,+v --mlir-disable-threading > infinite loop ``` --------- Signed-off-by: Stanley Winata <[email protected]>
1 parent a43d893 commit f27feff

File tree

176 files changed

+318
-405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+318
-405
lines changed

compiler/plugins/input/StableHLO/Conversion/LegalizeCHLO.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,8 +2182,7 @@ struct LegalizeChlo final : impl::LegalizeChloBase<LegalizeChlo> {
21822182
mlir::shape::CstrBroadcastableOp::getCanonicalizationPatterns(patterns,
21832183
ctx);
21842184
mlir::tensor::CastOp::getCanonicalizationPatterns(patterns, ctx);
2185-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
2186-
std::move(patterns)))) {
2185+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
21872186
return signalPassFailure();
21882187
}
21892188
}

compiler/plugins/input/StableHLO/Conversion/LegalizeShapeComputations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ struct LegalizeShapeComputations final
170170

171171
auto func = this->getOperation();
172172
populateLegalizeShapeComputationPatterns(&ctx, &patterns);
173-
if (failed(applyPatternsAndFoldGreedily(func, std::move(patterns)))) {
173+
if (failed(applyPatternsGreedily(func, std::move(patterns)))) {
174174
this->signalPassFailure();
175175
}
176176
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/Canonicalization.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,7 @@ struct StableHLOCanonicalize final
11561156
MLIRContext *ctx = &getContext();
11571157
RewritePatternSet patterns(ctx);
11581158
populateCanonicalizationPatterns(ctx, &patterns);
1159-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
1160-
std::move(patterns)))) {
1159+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
11611160
signalPassFailure();
11621161
}
11631162
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/DotGeneralToDot.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ struct DotGeneralToDot final : impl::DotGeneralToDotBase<DotGeneralToDot> {
419419
void runOnOperation() override {
420420
RewritePatternSet patterns(&getContext());
421421
populatePreprocessingDotGeneralToDotPatterns(&getContext(), &patterns);
422-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
423-
std::move(patterns)))) {
422+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
424423
return signalPassFailure();
425424
}
426425
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/EinsumToDotGeneral.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ struct EinsumToDotGeneral final
160160
void runOnOperation() override {
161161
RewritePatternSet patterns(&getContext());
162162
populatePreprocessingEinsumToDotGeneralPatterns(&getContext(), &patterns);
163-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
164-
std::move(patterns)))) {
163+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
165164
return signalPassFailure();
166165
}
167166
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/FlattenTuplesInCFG.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,7 @@ struct FlattenTuplesInCFG final
359359
patterns.insert<DetupleCallOp, DetupleIndirectCallOp, DetupleConditionOp,
360360
DetupleReturnOp, DetupleBranchOp>(ctx);
361361
populateCanonicalizationPatterns(ctx, &patterns);
362-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
363-
std::move(patterns)))) {
362+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
364363
return signalPassFailure();
365364
}
366365
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/FlattenTuplesInSCF.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ struct FlattenTuplesInSCF final
255255
patterns
256256
.add<DetupleYieldOp, DetupleConditionOp, DetupleIfOp, DetupleWhileOp>(
257257
ctx);
258-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
259-
std::move(patterns)))) {
258+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
260259
return signalPassFailure();
261260
}
262261
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/GatherToTorchIndexSelect.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ struct GatherToTorchIndexSelect final
127127
MLIRContext *ctx = &getContext();
128128
RewritePatternSet patterns(ctx);
129129
populatePreprocessingGatherToTorchIndexSelectPatterns(ctx, &patterns);
130-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
131-
std::move(patterns)))) {
130+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
132131
return signalPassFailure();
133132
}
134133
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/LowerComplex.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ struct LowerComplex final : impl::LowerComplexBase<LowerComplex> {
7474
RewritePatternSet patterns(ctx);
7575
populatePreprocessingComplexPatterns(ctx, &patterns);
7676
populateCanonicalizationPatterns(ctx, &patterns);
77-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
78-
std::move(patterns)))) {
77+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
7978
signalPassFailure();
8079
}
8180
}

compiler/plugins/input/StableHLO/Conversion/Preprocessing/StableHLOToStableHLO.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,8 +1968,7 @@ struct StableHLOToStableHLOPreprocessing final
19681968
patterns.insert<ReorderConvOpKernelDimensions>(context);
19691969
patterns.insert<ReorderConvOpOutputDimensions>(context);
19701970
}
1971-
if (failed(applyPatternsAndFoldGreedily(getOperation(),
1972-
std::move(patterns)))) {
1971+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
19731972
return signalPassFailure();
19741973
}
19751974
}

0 commit comments

Comments
 (0)