Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions mlir/include/air/Dialect/AIR/AIRDialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ constexpr StringLiteral PreserveShimDmaOrder = "air.preserve_shim_dma_order";
// before starting the next group), reproducing the drain schedule of the
// un-coalesced feed.
constexpr StringLiteral CoalescedShimFeed = "air.coalesced_shim_feed";
// Per-op opt-out (unit attr) on an air.channel.put/get inside a
// preserve_shim_dma_order launch: this feed is NOT lockstep-coupled to its
// siblings (no shared broadcast/multicast consumer), so it must NOT inherit the
// launch's preserve marker and its bounded double-buffered pacing. Keeping it
// out of the pacing lets it lower to a fire-and-free MM2S feed (start, free BD,
// no per-task completion await), so a few large independent BDs (e.g. separate
// K/V readback streams) run concurrently and are backpressured only by their
// downstream ring locks -- the pacing's await-on-drain would otherwise serialize
// them and deadlock when a single BD exceeds the ring depth.
constexpr StringLiteral ShimFeedNoPace = "air.shim_feed_no_pace";
constexpr StringLiteral TileDmaChannel = "air.tile_dma_channel";
constexpr StringLiteral MemtileDmaChannelMin = "air.memtile_dma_channel_min";
constexpr StringLiteral DedicatedDmaChannel = "air.dedicated_dma_channel";
Expand Down
4 changes: 4 additions & 0 deletions mlir/lib/Dialect/AIR/IR/AIRDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@
dst->setAttr(attrs::AwaitAppends, aa);
if (auto ab = src->getAttr(attrs::AppendBarrier))
dst->setAttr(attrs::AppendBarrier, ab);
// Per-op preserve-pacing opt-out (fire-and-free shim feed), consumed by
// AIROptimizeShimDMABDs's preserve-marker propagation.
if (auto np = src->getAttr(attrs::ShimFeedNoPace))
dst->setAttr(attrs::ShimFeedNoPace, np);
// Producer-side re-feed count (single-buffer count-free re-broadcast), read
// by AIRToAIE's lock allocators.
if (auto rc = src->getAttrOfType<IntegerAttr>(attrs::RefeedCount))
Expand Down Expand Up @@ -3203,7 +3207,7 @@
// (they are discardable attrs, otherwise lost on rebuild and the AIRToAIE /
// AIRRtToNpu consumers never fire), then replace -- so `op` is not read after
// it is erased.
auto newOp = rewriter.create<OpT>(

Check warning on line 3210 in mlir/lib/Dialect/AIR/IR/AIRDialect.cpp

View workflow job for this annotation

GitHub Actions / Build and Test (Windows)

'mlir::OpBuilder::create': Use OpTy::create instead
op.getLoc(), op->getResultTypes(), op.getAsyncDependencies(),
op.getChanName(), op.getIndices(), input_memref, offsets, sizes, strides,
/*pad_before=*/padBefore, /*pad_after=*/padAfter);
Expand Down
15 changes: 12 additions & 3 deletions mlir/lib/Transform/AIRDependencyScheduleOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7292,9 +7292,18 @@ class AIROptimizeShimDMABDs
// double-buffered awaits (backpressure) for these lockstep-coupled
// shim feeds.
launch.walk([&](Operation *op) {
if (isa<air::ChannelPutOp, air::ChannelGetOp>(op))
op->setAttr(air::attrs::PreserveShimDmaOrder,
mlir::UnitAttr::get(op->getContext()));
if (!isa<air::ChannelPutOp, air::ChannelGetOp>(op))
return;
// Per-op opt-out: a feed explicitly marked air.shim_feed_no_pace is
// NOT lockstep-coupled to its siblings, so it must stay out of the
// preserve marker's bounded double-buffered pacing (it lowers to a
// fire-and-free MM2S feed instead). It still benefits from the
// launch's no-fold guarantee (the early return below skips
// per-channel BD folding for the whole launch region).
if (op->hasAttr(air::attrs::ShimFeedNoPace))
return;
op->setAttr(air::attrs::PreserveShimDmaOrder,
mlir::UnitAttr::get(op->getContext()));
Comment thread
erwei-xilinx marked this conversation as resolved.
});
return;
}
Expand Down
Loading