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

Bump mlir-aie to 1b059e4996656d00499598c8c1ce8da6baa71262 #855

Merged
merged 13 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ include_directories(${AIE_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})

## flags duplicated from mlir-aie
add_flag_if_supported("-Werror=sign-compare" WERROR_SIGN_COMPARE)
# add_flag_if_supported("-Werror=sign-compare" WERROR_SIGN_COMPARE)
add_flag_if_supported("-Werror=unused" WERROR_USED)
# What happens when you have a non-void function with no return?
# No `ret` instruction is generated and so execution of that function just
Expand Down
12 changes: 6 additions & 6 deletions mlir/lib/Conversion/AIRRtToNpuPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,19 +947,19 @@ struct AIRRtToNpuPass : public impl::AIRRtToNpuBase<AIRRtToNpuPass> {
auto ctx = &getContext();
RewritePatternSet canoPatterns_0(ctx);
xilinx::air::populateAIRLoopIndexCanonicalizationPatterns(canoPatterns_0);
(void)applyPatternsAndFoldGreedily(module, std::move(canoPatterns_0));
(void)applyPatternsGreedily(module, std::move(canoPatterns_0));

// Specialize affine for loop nest into wraps and strides
RewritePatternSet loopFoldPattern(ctx);
loopFoldPattern.add<AIRSpecializeAIRRtDmaWrapAndStrideInAffineFor>(ctx);
air::populateAIRLoopIndexCanonicalizationPatterns(loopFoldPattern);
(void)applyPatternsAndFoldGreedily(module, std::move(loopFoldPattern));
(void)applyPatternsGreedily(module, std::move(loopFoldPattern));
unrollAffineFors(module);

// Simplify arith ops (from airrt)
RewritePatternSet canoPatterns_1(ctx);
arith::IndexCastOp::getCanonicalizationPatterns(canoPatterns_1, ctx);
(void)applyPatternsAndFoldGreedily(module, std::move(canoPatterns_1));
(void)applyPatternsGreedily(module, std::move(canoPatterns_1));

// Purge all wait ops again after unroll, in case there were loop carried
// events which couldn't be purged before
Expand All @@ -974,7 +974,7 @@ struct AIRRtToNpuPass : public impl::AIRRtToNpuBase<AIRRtToNpuPass> {
// Simplify arith ops (from airrt)
RewritePatternSet canoPatterns_3(ctx);
arith::IndexCastOp::getCanonicalizationPatterns(canoPatterns_3, ctx);
(void)applyPatternsAndFoldGreedily(module, std::move(canoPatterns_3));
(void)applyPatternsGreedily(module, std::move(canoPatterns_3));

ConversionTarget target(getContext());
target.addIllegalDialect<AIRRtDialect>();
Expand Down Expand Up @@ -1020,7 +1020,7 @@ struct AIRRtToNpuPass : public impl::AIRRtToNpuBase<AIRRtToNpuPass> {
RewritePatternSet canoPatterns_2(ctx);
canoPatterns_2.insert<RelocateAssumeAlignmentOp>(ctx);
arith::IndexCastOp::getCanonicalizationPatterns(canoPatterns_2, ctx);
(void)applyPatternsAndFoldGreedily(module, std::move(canoPatterns_2));
(void)applyPatternsGreedily(module, std::move(canoPatterns_2));

// Unroll any affine for loops
unrollAffineFors(module);
Expand All @@ -1030,7 +1030,7 @@ struct AIRRtToNpuPass : public impl::AIRRtToNpuBase<AIRRtToNpuPass> {
RewritePatternSet castPattern(ctx);
air::populateBufferMemrefToFuncArgsPattern(castPattern);
castPattern.add(CastFunctionArgs);
(void)applyPatternsAndFoldGreedily(module, std::move(castPattern));
(void)applyPatternsGreedily(module, std::move(castPattern));

// Insert sync op after copying data out to host
insertNpuSyncOpForResults(module);
Expand Down
24 changes: 12 additions & 12 deletions mlir/lib/Conversion/AIRToAIEPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ void specializeHerdAffineIf(AIE::DeviceOp m) {
auto ctx = m->getContext();
RewritePatternSet patterns(ctx);
patterns.insert<SpecializeAffineIfPattern>(ctx);
(void)applyPatternsAndFoldGreedily(m, std::move(patterns));
(void)applyPatternsGreedily(m, std::move(patterns));
}

struct LowerAIRExecutePattern : public OpRewritePattern<air::ExecuteOp> {
Expand Down Expand Up @@ -720,7 +720,7 @@ void lowerAirExecute(AIE::DeviceOp d) {
patterns.insert<LowerAIRExecutePattern,
CanonicalizeChannelPutWrapsAndStridesPattern,
CanonicalizeChannelGetWrapsAndStridesPattern>(ctx);
(void)applyPatternsAndFoldGreedily(d, std::move(patterns));
(void)applyPatternsGreedily(d, std::move(patterns));
}

struct LowerScfTokenPattern : public OpRewritePattern<scf::ForOp> {
Expand Down Expand Up @@ -813,7 +813,7 @@ void lowerScfAirTokens(AIE::DeviceOp m) {
auto ctx = m->getContext();
RewritePatternSet patterns(ctx);
patterns.insert<LowerScfTokenPattern>(ctx);
(void)applyPatternsAndFoldGreedily(m, std::move(patterns));
(void)applyPatternsGreedily(m, std::move(patterns));
}

struct AllocL1BuffersPattern : public OpRewritePattern<memref::AllocOp> {
Expand Down Expand Up @@ -935,7 +935,7 @@ void allocL1Buffers(AIE::DeviceOp m,
RewritePatternSet patterns(ctx);
patterns.insert<AllocL1BuffersPattern>(ctx, tileToHerdMap, BufferId);
// AllocL1TensorsPattern
(void)applyPatternsAndFoldGreedily(m, std::move(patterns));
(void)applyPatternsGreedily(m, std::move(patterns));
}

bool areReferencedByTheSameAIRChannel(Value memref_a, Value memref_b) {
Expand Down Expand Up @@ -1027,7 +1027,7 @@ void allocL2Buffers(AIE::DeviceOp m,
L2MemrefToMemTileMap(m, memrefToTileMap);
patterns.insert<AllocL2BuffersPattern>(ctx, memrefToTileMap,
bufferToMemtileMap, BufferId);
(void)applyPatternsAndFoldGreedily(m, std::move(patterns));
(void)applyPatternsGreedily(m, std::move(patterns));
}

// Remove L2 temporary buffer allocs now that
Expand Down Expand Up @@ -1359,7 +1359,7 @@ void lowerAIRChannels(
std::map<Operation *, AIE::ObjectFifoCreateOp> linksToComplete;
patterns.insert<LowerAIRChannelsPattern>(ctx, s, bufferToMemtileMap,
linksToComplete);
(void)applyPatternsAndFoldGreedily(d, std::move(patterns));
(void)applyPatternsGreedily(d, std::move(patterns));
}

struct SpecializeChannelBundlePattern
Expand Down Expand Up @@ -1561,7 +1561,7 @@ void specializeChannelBundle(
auto ctx = d->getContext();
RewritePatternSet patterns(ctx);
patterns.insert<SpecializeChannelBundlePattern>(ctx, chan_to_chan_map);
(void)applyPatternsAndFoldGreedily(d, std::move(patterns));
(void)applyPatternsGreedily(d, std::move(patterns));
}

struct LowerAIRPingPongPattern : public OpRewritePattern<scf::ForOp> {
Expand Down Expand Up @@ -1618,7 +1618,7 @@ void LowerAIRPingPong(AIE::DeviceOp &d) {
auto ctx = d->getContext();
RewritePatternSet patterns(ctx);
patterns.insert<LowerAIRPingPongPattern>(ctx);
(void)applyPatternsAndFoldGreedily(d, std::move(patterns));
(void)applyPatternsGreedily(d, std::move(patterns));
}

template <typename OpT>
Expand Down Expand Up @@ -1879,7 +1879,7 @@ class AIRToAIEPass : public air::impl::AIRToAIEBase<AIRToAIEPass> {
RewritePatternSet patterns(ctx);
xilinx::air::populateAIRunrollAIRChannelPutGetInScfParallelPatterns(
patterns);
(void)applyPatternsAndFoldGreedily(aie_device, std::move(patterns));
(void)applyPatternsGreedily(aie_device, std::move(patterns));

// Substituting index operands, such as strides and offsets, to constant
// zero for convenience. TODO: generalize this
Expand Down Expand Up @@ -3251,7 +3251,7 @@ class AIRToAIEPass : public air::impl::AIRToAIEBase<AIRToAIEPass> {
}

if (patterns.getNativePatterns().size())
(void)applyPatternsAndFoldGreedily(m, std::move(patterns));
(void)applyPatternsGreedily(m, std::move(patterns));
}

void runOnOperation() override {
Expand Down Expand Up @@ -3460,7 +3460,7 @@ class AIRToAIEPass : public air::impl::AIRToAIEBase<AIRToAIEPass> {

RewritePatternSet patterns(ctx);
air::WaitAllOp::getCanonicalizationPatterns(patterns, ctx);
(void)applyPatternsAndFoldGreedily(device, std::move(patterns));
(void)applyPatternsGreedily(device, std::move(patterns));

// Remove ops via rewrite patterns.
RewritePatternSet removepatterns(ctx);
Expand Down Expand Up @@ -3702,7 +3702,7 @@ FailureOr<ModuleOp> convertAIRToAIE(mlir::RewriterBase &rewriter,
patterns.insert<LowerAIRExecutePattern>(ctx);
patterns.insert<AllocL1BuffersPattern>(ctx, tileToHerdMap, BufferId);
air::WaitAllOp::getCanonicalizationPatterns(patterns, ctx);
(void)applyPatternsAndFoldGreedily(aie_module, std::move(patterns));
(void)applyPatternsGreedily(aie_module, std::move(patterns));
}

return aie_module;
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Conversion/ConvertToAIRPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ struct CopyToDmaPass : public air::impl::CopyToDmaBase<CopyToDmaPass> {
linalg::getLinalgTilingCanonicalizationPatterns(context);
memref::AllocOp::getCanonicalizationPatterns(stage1Patterns, context);
memref::populateComposeSubViewPatterns(stage1Patterns, context);
(void)applyPatternsAndFoldGreedily(module, std::move(stage1Patterns));
(void)applyPatternsGreedily(module, std::move(stage1Patterns));

RewritePatternSet stage2Patterns(context);
stage2Patterns
Expand Down Expand Up @@ -1174,7 +1174,7 @@ struct CopyToDmaPass : public air::impl::CopyToDmaBase<CopyToDmaPass> {

RewritePatternSet pattern(context);
air::DmaMemcpyNdOp::getCanonicalizationPatterns(pattern, context);
(void)applyPatternsAndFoldGreedily(module, std::move(pattern));
(void)applyPatternsGreedily(module, std::move(pattern));
}
};

Expand Down Expand Up @@ -1613,7 +1613,7 @@ transform::ParToHerdOp::applyToOne(transform::TransformRewriter &rewriter,
getFirstDim());
patterns.add<ScfForallToHerdConversion>(ctx, filteredOps, herdOps,
getFirstDim());
(void)applyPatternsAndFoldGreedily(
(void)applyPatternsGreedily(
target->getParentWithTrait<OpTrait::IsIsolatedFromAbove>(),
std::move(patterns));
for (auto h : herdOps) {
Expand Down Expand Up @@ -1641,7 +1641,7 @@ transform::ParToLaunchOp::applyToOne(transform::TransformRewriter &rewriter,
getHasAirSegment());
patterns.add<ScfForallToLaunchConversion>(ctx, filteredOps, launchOps,
getHasAirSegment());
(void)applyPatternsAndFoldGreedily(
(void)applyPatternsGreedily(
target->getParentWithTrait<OpTrait::IsIsolatedFromAbove>(),
std::move(patterns));
for (auto l : launchOps)
Expand Down
Loading
Loading