Skip to content

Commit

Permalink
Update mlir-aie (#396)
Browse files Browse the repository at this point in the history
update aie to 48329cab
update llvm to 0f80f5e
  • Loading branch information
fifield authored Jan 24, 2024
1 parent 4290572 commit 02dc885
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
28 changes: 15 additions & 13 deletions mlir/lib/Conversion/AIRToAIEPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ void outlineAIECores(OpBuilder &builder, AIE::DeviceOp aie_device,

if (options.emit_herd_lock)
core_builder.create<AIE::UseLockOp>(core_builder.getUnknownLoc(),
herd_lock, 0,
AIE::LockAction::Acquire);
herd_lock, AIE::LockAction::Acquire,
0);

Region &r = h.getRegion();
r.cloneInto(&core.getBody(), remap);
Expand All @@ -319,8 +319,8 @@ void outlineAIECores(OpBuilder &builder, AIE::DeviceOp aie_device,
core_builder.setInsertionPoint(launch_bb->getTerminator());
if (options.emit_herd_lock)
core_builder.create<AIE::UseLockOp>(core_builder.getUnknownLoc(),
herd_lock, 0,
AIE::LockAction::Release);
herd_lock, AIE::LockAction::Release,
0);

if (options.emit_while)
core_builder.create<cf::BranchOp>(hloc, core_bb);
Expand Down Expand Up @@ -2145,17 +2145,18 @@ class AIRToAIEPass : public air::impl::AIRToAIEBase<AIRToAIEPass> {
else
builder.setInsertionPoint(memcpyOpIf);

builder.create<AIE::UseLockOp>(memcpyOpIf->getLoc(), acqLockOp, lockAqValue,
builder.create<AIE::UseLockOp>(memcpyOpIf->getLoc(), acqLockOp,
isAIE2 ? AIE::LockAction::AcquireGreaterEqual
: AIE::LockAction::Acquire);
: AIE::LockAction::Acquire,
lockAqValue);
// try to find a place to put the unlock. If there are deallocs,
// replace them with unlock. Otherwise, put them at the end.
bool need_unlock = true;
for (auto u : alloc.getUsers()) {
if (auto dealloc = dyn_cast<memref::DeallocOp>(u)) {
builder.setInsertionPoint(dealloc);
builder.create<AIE::UseLockOp>(dealloc->getLoc(), relLockOp,
lockRelValue, AIE::LockAction::Release);
AIE::LockAction::Release, lockRelValue);
// assume that the deallocs will take care of it when
// deallocs are present
need_unlock = false;
Expand All @@ -2164,8 +2165,8 @@ class AIRToAIEPass : public air::impl::AIRToAIEBase<AIRToAIEPass> {
if (need_unlock) {
auto t = memcpyOpIf->getBlock()->getTerminator();
builder.setInsertionPoint(t);
builder.create<AIE::UseLockOp>(t->getLoc(), relLockOp, lockRelValue,
AIE::LockAction::Release);
builder.create<AIE::UseLockOp>(t->getLoc(), relLockOp,
AIE::LockAction::Release, lockRelValue);
}
allocs_to_remap.insert(alloc.getDefiningOp());
}
Expand Down Expand Up @@ -2272,9 +2273,10 @@ class AIRToAIEPass : public air::impl::AIRToAIEBase<AIRToAIEPass> {

Value length =
b.create<arith::ConstantIndexOp>(memcpyOp.getLoc(), len)->getResult(0);
b.create<AIE::UseLockOp>(loc, acqLockOp, lockAqValue,
b.create<AIE::UseLockOp>(loc, acqLockOp,
isAIE2 ? AIE::LockAction::AcquireGreaterEqual
: AIE::LockAction::Acquire);
: AIE::LockAction::Acquire,
lockAqValue);

std::vector<AIE::BDDimLayoutAttr> dims =
getWrapsAndStrides(sizes, strides, ndcpy->getContext());
Expand All @@ -2292,8 +2294,8 @@ class AIRToAIEPass : public air::impl::AIRToAIEBase<AIRToAIEPass> {
loc, bufferOp, offset,
cast<arith::ConstantIndexOp>(length.getDefiningOp()).value(),
wraps_and_strides);
b.create<AIE::UseLockOp>(loc, relLockOp, lockRelValue,
AIE::LockAction::Release);
b.create<AIE::UseLockOp>(loc, relLockOp, AIE::LockAction::Release,
lockRelValue);
}

AIE::ShimDMAOp getShimDMAOp(AIE::TileOp tile) {
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Transform/AIRLinalgCodegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,14 +842,14 @@ struct PromoteLinalgOpPattern : public RewritePattern {
// so if the promotion fails, those need to be cleaned up, which doesnt seem
// to be happening here. So to fail properly, we should be cloning the op
// and deleting the previous op. This needs more investigation.
rewriter.startRootUpdate(op);
rewriter.startOpModification(op);
std::optional<linalg::LinalgOp> promotedOp =
promoteSubViews(rewriter, cast<linalg::LinalgOp>(op), options);
if (!promotedOp) {
rewriter.cancelRootUpdate(op);
rewriter.cancelOpModification(op);
return op->emitError("subview promotion failed");
}
rewriter.finalizeRootUpdate(op);
rewriter.finalizeOpModification(op);
filter.replaceLinalgTransformationFilter(rewriter, op);
return success();
}
Expand Down Expand Up @@ -1922,7 +1922,7 @@ transform::LinalgTileOp::apply(TransformRewriter &rewriter,
if (failed(maybeTilingResult))
return DiagnosedSilenceableFailure::definiteFailure();

if (linalgOp.hasBufferSemantics())
if (linalgOp.hasPureBufferSemantics())
rewriter.eraseOp(linalgOp);
else
rewriter.replaceOp(linalgOp,
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/Dialect/AIR/transform-ops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ transform.with_pdl_patterns {
%0 = pdl_match @match_addi in %arg1 : (!pdl.operation) -> !pdl.operation
// CHECK: = transform.air.get_segment_for
%1 = transform.air.get_segment_for %0
transform.test_print_remark_at_operand %1, "found segment" : !pdl.operation
transform.debug.emit_remark_at %1, "found segment" : !pdl.operation
}
}

Expand Down
2 changes: 1 addition & 1 deletion utils/clone-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
##===----------------------------------------------------------------------===##

export commithash=6e1ecd100d7663a91135b1cf6c4a603681b7385b
export commithash=0f80f5e362fb43a9335bd154c5f7976a96e32cfc
branch=air

git clone --depth 1 https://github.com/llvm/llvm-project.git llvm
Expand Down
2 changes: 1 addition & 1 deletion utils/clone-mlir-aie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
##===----------------------------------------------------------------------===##

export HASH=71477e556ee75d22e7575e1bf29aeeb1d8c7e41a
export HASH=48329cab738a35d6fd8e8b9f86ddcf68b459a176

git clone --depth 1 https://github.com/Xilinx/mlir-aie.git mlir-aie
pushd mlir-aie
Expand Down

0 comments on commit 02dc885

Please sign in to comment.