Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LLVM to llvm/llvm-project@ac8bb735 #19566

Merged
merged 4 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2182,8 +2182,7 @@ struct LegalizeChlo final : impl::LegalizeChloBase<LegalizeChlo> {
mlir::shape::CstrBroadcastableOp::getCanonicalizationPatterns(patterns,
ctx);
mlir::tensor::CastOp::getCanonicalizationPatterns(patterns, ctx);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct LegalizeShapeComputations final

auto func = this->getOperation();
populateLegalizeShapeComputationPatterns(&ctx, &patterns);
if (failed(applyPatternsAndFoldGreedily(func, std::move(patterns)))) {
if (failed(applyPatternsGreedily(func, std::move(patterns)))) {
this->signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1156,8 +1156,7 @@ struct StableHLOCanonicalize final
MLIRContext *ctx = &getContext();
RewritePatternSet patterns(ctx);
populateCanonicalizationPatterns(ctx, &patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,7 @@ struct DotGeneralToDot final : impl::DotGeneralToDotBase<DotGeneralToDot> {
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
populatePreprocessingDotGeneralToDotPatterns(&getContext(), &patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ struct EinsumToDotGeneral final
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
populatePreprocessingEinsumToDotGeneralPatterns(&getContext(), &patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,7 @@ struct FlattenTuplesInCFG final
patterns.insert<DetupleCallOp, DetupleIndirectCallOp, DetupleConditionOp,
DetupleReturnOp, DetupleBranchOp>(ctx);
populateCanonicalizationPatterns(ctx, &patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ struct FlattenTuplesInSCF final
patterns
.add<DetupleYieldOp, DetupleConditionOp, DetupleIfOp, DetupleWhileOp>(
ctx);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ struct GatherToTorchIndexSelect final
MLIRContext *ctx = &getContext();
RewritePatternSet patterns(ctx);
populatePreprocessingGatherToTorchIndexSelectPatterns(ctx, &patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ struct LowerComplex final : impl::LowerComplexBase<LowerComplex> {
RewritePatternSet patterns(ctx);
populatePreprocessingComplexPatterns(ctx, &patterns);
populateCanonicalizationPatterns(ctx, &patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1968,8 +1968,7 @@ struct StableHLOToStableHLOPreprocessing final
patterns.insert<ReorderConvOpKernelDimensions>(context);
patterns.insert<ReorderConvOpOutputDimensions>(context);
}
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ struct UnfuseBatchNorm final : impl::UnfuseBatchNormBase<UnfuseBatchNorm> {
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
populatePreprocessingUnfuseBatchNormPatterns(&getContext(), &patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ struct LegalizeStableHLOCustomCalls final

RewritePatternSet patterns(ctx);
patterns.add<HouseholderReflectorRewriter, ShapeAssertionDrop>(ctx);
if (failed(applyPatternsAndFoldGreedily(f, std::move(patterns)))) {
if (failed(applyPatternsGreedily(f, std::move(patterns)))) {
signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ struct ConvertStableHloToIreeInputDialects final
std::unique_ptr<TypeConverter> typeConverter =
createStableHloToLinalgTypeConverter();
typeConverter->addArgumentMaterialization(scalarToTensor);
typeConverter->addSourceMaterialization(scalarToTensor);
typeConverter->addTargetMaterialization(scalarToTensor);

// Run stablehlo canonicalization patterns with a high benefit to avoid some
// expensive expansions.
Expand Down Expand Up @@ -610,7 +612,7 @@ struct ConvertStableHloToIreeInputDialects final
RewritePatternSet removeUnusedOperandsResultsPatterns(context);
linalg::populateEraseUnusedOperandsAndResultsPatterns(
removeUnusedOperandsResultsPatterns);
if (failed(applyPatternsAndFoldGreedily(
if (failed(applyPatternsGreedily(
getOperation(),
std::move(removeUnusedOperandsResultsPatterns)))) {
return signalPassFailure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ RemoveSignTypeConverter::RemoveSignTypeConverter() {

LinalgTypeConverter::LinalgTypeConverter() : RemoveSignTypeConverter() {
addArgumentMaterialization(scalarToTensor);
addSourceMaterialization(scalarToTensor);
addTargetMaterialization(scalarToTensor);
}

} // namespace mlir::iree_compiler::stablehlo
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ class BitCastQuantTensorPass final
MLIRContext *context = &getContext();
RewritePatternSet patterns(context);
patterns.add<BitCastQuantizedMatmul, BitCastViewDtype>(context);
if (failed(
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
signalPassFailure();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ class ConvertTMTensorToLinalgExtPass final
patterns.add<ScatterOpConversion>(context);
patterns.add<AttentionOpConversion>(context);

if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ void BlockDynamicDimensionsPass::runOnOperation() {
memref::populateResolveRankedShapedTypeResultDimsPatterns(
bubbleExpandShapePatterns);
populateRemoveDeadMemAllocPatterns(bubbleExpandShapePatterns);
if (failed(applyPatternsAndFoldGreedily(
operation, std::move(bubbleExpandShapePatterns)))) {
if (failed(applyPatternsGreedily(operation,
std::move(bubbleExpandShapePatterns)))) {
operation->emitOpError(
"failed in application of bubble up expand shape patterns");
return signalPassFailure();
Expand All @@ -380,8 +380,8 @@ void BlockDynamicDimensionsPass::runOnOperation() {
context);
memref::populateResolveRankedShapedTypeResultDimsPatterns(
removeBarrierOpsPatterns);
if (failed(applyPatternsAndFoldGreedily(
operation, std::move(removeBarrierOpsPatterns)))) {
if (failed(applyPatternsGreedily(operation,
std::move(removeBarrierOpsPatterns)))) {
operation->emitOpError("failed in cleanup patterns");
return signalPassFailure();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ void BubbleUpOrdinalOpsPass::runOnOperation() {
MLIRContext *context = &getContext();
RewritePatternSet patterns(context);
patterns.insert<BubbleUpAcrossCastOp<arith::IndexCastUIOp>>(context);
if (failed(
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,7 @@ void CPULowerToUKernelsPass::runOnOperation() {
// These patterns are inherently specific to the VMVX backend.
patterns.insert<LowerToUKernelPattern<IREE::Codegen::QueryTileSizesOp>>(
context, isVMVXBackend);
if (failed(
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ void CPUPrepareUkernelsPass::runOnOperation() {
tensor::UnPackOp::getCanonicalizationPatterns(patterns, ctx);
tensor::CastOp::getCanonicalizationPatterns(patterns, ctx);
tensor::populateFoldTensorEmptyPatterns(patterns);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ struct CleanupBufferAllocViewPass final
RewritePatternSet patterns(&getContext());
populateReshapeToInterfaceTensorPatterns(patterns);
populateRemoveDeadMemAllocPatterns(patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ class ConcretizePadResultShapePass final
{
RewritePatternSet patterns(context);
populateConcretizePadResultShapePatterns(patterns);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns),
config))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns), config))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct ConfigTrackingCanonicalizerPass final
{
config.listener = &listener;
LogicalResult didConverge =
applyPatternsAndFoldGreedily(getOperation(), *patterns, config);
applyPatternsGreedily(getOperation(), *patterns, config);
config.listener = nullptr;
if (this->testConvergence && failed(didConverge)) {
getOperation()->emitError("Canonicalizer failed to converge");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ struct ConvertBf16ArithToF32Pass final
cleanupPatterns
.insert<PropagateCastF<arith::TruncFOp>, PropagateCastF<arith::ExtFOp>>(
context);
if (applyPatternsAndFoldGreedily(this->getOperation(),
std::move(cleanupPatterns))
if (applyPatternsGreedily(this->getOperation(), std::move(cleanupPatterns))
.failed()) {
return this->signalPassFailure();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void ConvertToDestinationPassingStylePass::runOnOperation() {
{
RewritePatternSet patterns(context);
patterns.insert<RemoveCstOutsDependency>(context);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
return signalPassFailure();
}
}
Expand All @@ -632,15 +632,15 @@ void ConvertToDestinationPassingStylePass::runOnOperation() {
{
RewritePatternSet patterns(context);
linalg::populateEraseUnusedOperandsAndResultsPatterns(patterns);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
return signalPassFailure();
}
}

{
RewritePatternSet patterns(context);
patterns.insert<SwitchStoreOfIfResultValue>(context);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ convertToIGEMMAndSetConfig(FunctionOpInterface funcOp,
if (configFn.has_value()) {
patterns.add<SetIGEMMConfiguration>(context, configFn.value());
}
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
return failure();
}
}
Expand Down Expand Up @@ -150,8 +150,8 @@ convertToIGEMMAndSetConfig(FunctionOpInterface funcOp,
tensor::ExpandShapeOp::getCanonicalizationPatterns(
bubbleCollapseShapePatterns, context);
populateReshapeToInterfaceTensorPatterns(bubbleCollapseShapePatterns);
if (failed(applyPatternsAndFoldGreedily(
funcOp, std::move(bubbleCollapseShapePatterns)))) {
if (failed(applyPatternsGreedily(funcOp,
std::move(bubbleCollapseShapePatterns)))) {
return failure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ class DecomposeConvolutionToLowerDimOpsPass final
// 2. Run the patterns. This is the key part of this pass.
RewritePatternSet patterns(context);
linalg::populateDecomposeConvolutionPatterns(patterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class DecomposeLinalgGenericPass final
RewritePatternSet patterns(context);
linalg::populateDecomposeLinalgOpsPattern(patterns);
linalg::GenericOp::getCanonicalizationPatterns(patterns, context);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static LogicalResult commonRunOnOperation(
RewritePatternSet patterns(ctx);
patterns.add<linalg::DecomposeOuterUnitDimsPackOpPattern,
linalg::DecomposeOuterUnitDimsUnPackOpPattern>(ctx);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
funcOp.emitError(
"failed to apply generalization patterns on pack/unpack ops for "
"outer unit dims cases");
Expand All @@ -123,7 +123,7 @@ static LogicalResult commonRunOnOperation(
if (!tileOuterToOne) {
RewritePatternSet patterns(ctx);
patterns.add<LowerPackPattern, LowerUnPackPattern>(ctx, controlFn);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
funcOp.emitError(
"failed to apply generalization patterns on pack/unpack ops for "
"general cases.");
Expand Down Expand Up @@ -223,7 +223,7 @@ static LogicalResult commonRunOnOperation(
memref::populateResolveRankedShapedTypeResultDimsPatterns(patterns);
ctx->getOrLoadDialect<tensor::TensorDialect>()->getCanonicalizationPatterns(
patterns);
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
return failure();
}
}
Expand All @@ -242,7 +242,7 @@ static LogicalResult commonRunOnOperation(
patterns.add<linalg::DecomposeOuterUnitDimsPackOpPattern,
linalg::DecomposeOuterUnitDimsUnPackOpPattern>(ctx);
}
if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) {
if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) {
return failure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void DropVectorUnitDimsPass::runOnOperation() {
vector::populateDropUnitDimWithShapeCastPatterns(patterns);
vector::InsertOp::getCanonicalizationPatterns(patterns, ctx);
vector::ExtractOp::getCanonicalizationPatterns(patterns, ctx);
(void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns));
(void)applyPatternsGreedily(funcOp, std::move(patterns));
}
} // namespace
} // namespace mlir::iree_compiler
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ struct EmulateNarrowTypePass final

RewritePatternSet sinkBroadcast(ctx);
vector::populateSinkVectorOpsPatterns(sinkBroadcast);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(sinkBroadcast)))) {
if (failed(
applyPatternsGreedily(getOperation(), std::move(sinkBroadcast)))) {
getOperation()->emitOpError("failed in sinking of broadcasts");
return signalPassFailure();
}

// Also do the `bitcast -> extui/extsi` rewrite.
RewritePatternSet foldExtPatterns(ctx);
vector::populateVectorNarrowTypeRewritePatterns(foldExtPatterns);
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(foldExtPatterns)))) {
if (failed(applyPatternsGreedily(getOperation(),
std::move(foldExtPatterns)))) {
return signalPassFailure();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ struct ExtractAddressComputationPass final
void ExtractAddressComputationPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
populateExtractAddressComputationPatterns(patterns);
if (failed(
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) {
return signalPassFailure();
}
}
Expand Down
Loading
Loading