Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Integrate support for stream port connections on objectfifos#2693

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
jackl-xilinx wants to merge18 commits intomain
base:main
Choose a base branch
Loading
fromhalf-objfifo
Draft
Show file tree
Hide file tree
Changes from9 commits
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
d0068d2
Initial integratoin from aie4 code base
jackl-xilinxNov 10, 2025
cee862e
format fix
jackl-xilinxNov 10, 2025
185c8b4
Merge branch 'main' into half-objfifo
jackl-xilinxNov 10, 2025
2192c95
format fix
jackl-xilinxNov 10, 2025
8b7f95d
Updated comment and additional edits
jackl-xilinxNov 10, 2025
2c13b1f
Merge branch 'main' into half-objfifo
jackl-xilinxNov 10, 2025
fd68653
Fixed type-o
jackl-xilinxNov 10, 2025
99ec739
Merge branch 'half-objfifo' of https://github.com/Xilinx/mlir-aie int…
jackl-xilinxNov 10, 2025
f499367
Fixed reference errors
jackl-xilinxNov 10, 2025
b8747ac
Merge branch 'main' of https://github.com/Xilinx/mlir-aie into half-o…
abiscaNov 17, 2025
bc84e72
Add python wrapper for objfifo register_external_buffers op
abiscaNov 24, 2025
b7a6ef9
Merge branch 'half-objfifo' of https://github.com/Xilinx/mlir-aie int…
abiscaNov 24, 2025
2c20f65
Fix compilation error related to SubviewAccessOp
abiscaNov 24, 2025
d702db2
Format
abiscaNov 24, 2025
28f7625
Add MLIR tests
abiscaNov 24, 2025
71a339f
Fix python test
abiscaNov 24, 2025
4a05980
Update test/python/objFifo.py
AndraBiscaNov 24, 2025
4522bc4
Merge branch 'main' into half-objfifo
AndraBiscaNov 25, 2025
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
22 changes: 8 additions & 14 deletionslib/Dialect/AIE/IR/AIEDialect.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -382,32 +382,26 @@ LogicalResult ObjectFifoCreateOp::verify() {
return emitError("`repeat_count` unavailable for shim tiles");
}


if (getAieStreamPort().has_value()) {
if (!getAieStream().has_value())
return emitError(
"`aie_stream` must be defined");
return emitError("`aie_stream` must be defined");
}

if (getAieStream().has_value()) {
if (getConsumerTiles().size() > 1)
return emitError(
"`aie_stream` can only be used in 1-to-1 object FIFOs");
return emitError("`aie_stream` can only be used in 1-to-1 object FIFOs");

if (!getAieStreamPort().has_value())
return emitError(
"`aie_stream_port` must be defined");
return emitError("`aie_stream_port` must be defined");

if (getAieStream().value() == 0 || getAieStream().value() == 2)
if (getProducerTileOp().isShimTile() || getProducerTileOp().isMemTile())
return emitError(
"`aie_stream` is not available for shim tiles");
if (getProducerTileOp().isShimTile() || getProducerTileOp().isMemTile())
return emitError("`aie_stream` is not available for shim tiles");

if (getAieStream().value() == 1 || getAieStream().value() == 2)
if (getConsumerTiles()[0].getDefiningOp<TileOp>().isShimTile()
|| getConsumerTiles()[0].getDefiningOp<TileOp>().isMemTile())
return emitError(
"`aie_stream` is not available for shim tiles");
if (getConsumerTiles()[0].getDefiningOp<TileOp>().isShimTile() ||
getConsumerTiles()[0].getDefiningOp<TileOp>().isMemTile())
return emitError("`aie_stream` is not available for shim tiles");
}

if (getInitValues().has_value()) {
Expand Down
216 changes: 148 additions & 68 deletionslib/Dialect/AIE/Transforms/AIEObjectFifoStatefulTransform.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,10 +108,10 @@ class DMAChannelAnalysis {
for (auto flowOp : device.getOps<FlowOp>()) {
if (flowOp.getSourceBundle() == WireBundle::Core)
aiestreamsPerTile[{flowOp.getSource(), DMAChannelDir::MM2S,
flowOp.getSourceChannel()}] = 1;
flowOp.getSourceChannel()}] = 1;
if (flowOp.getDestBundle() == WireBundle::Core)
aiestreamsPerTile[{flowOp.getDest(), DMAChannelDir::S2MM,
flowOp.getDestChannel()}] = 1;
flowOp.getDestChannel()}] = 1;
}
}

Expand DownExpand Up@@ -146,21 +146,19 @@ class DMAChannelAnalysis {
return -1;
}

/// Given a tile and DMAChannel, adds entry to aie4StreamsPerTile or
/// Given a tile and DMAChannel, adds entry to aie4StreamsPerTile or
/// throws an error if the stream is already used.
void checkAIEStreamIndex(TileOp tileOp, DMAChannel chan) {
if (aiestreamsPerTile.find(
{tileOp.getResult(), chan.direction, chan.channel})
== aiestreamsPerTile.end()) {
aiestreamsPerTile[{tileOp.getResult(), chan.direction,
chan.channel}] = 1;
if (aiestreamsPerTile.find({tileOp.getResult(), chan.direction,
chan.channel}) == aiestreamsPerTile.end()) {
aiestreamsPerTile[{tileOp.getResult(), chan.direction, chan.channel}] = 1;
} else {
if (chan.direction == DMAChannelDir::MM2S)
tileOp.emitOpError("number of output Core channels exceeded!");
else
tileOp.emitOpError("number of input Core channels exceeded!");
}
}
}
};

//===----------------------------------------------------------------------===//
Expand DownExpand Up@@ -1841,6 +1839,20 @@ struct AIEObjectFifoStatefulTransformPass
if (createOp.getDisableSynchronization())
consumerFifo.setDisableSynchronization(true);
replaceSplitFifo(createOp, consumerFifo, consumerTileOp);
if (createOp.getAieStream()) {
int streamEnd = createOp.getAieStream().value();
if (streamEnd > 0) {
consumerFifo->setAttr("aie_stream",
builder.getI32IntegerAttr(streamEnd));
consumerFifo->setAttr(
"aie_stream_port",
builder.getI32IntegerAttr(createOp.getAieStreamPort().value()));
}
if (streamEnd == 1) {
createOp->removeAttr("aie_stream");
createOp->removeAttr("aie_stream_port");
}
}

// identify external buffers that were registered to the consumer fifo
if (consumerTile.getDefiningOp<TileOp>().isShimTile())
Expand DownExpand Up@@ -1934,53 +1946,107 @@ struct AIEObjectFifoStatefulTransformPass

int packetID = getStartPacketID(device);
for (auto &[producer, consumers] : splitFifos) {
int producerChanIndex = fifo_dma_channel_index[producer];
if (producerChanIndex == -1)
producer.getProducerTileOp().emitOpError(
"number of output DMA channel exceeded!");
DMAChannel producerChan = {DMAChannelDir::MM2S, producerChanIndex};
std::optional<PacketInfoAttr> bdPacket = {};
if (clPacketSwObjectFifos) {
if (packetID > 31)
device.emitOpError("max number of packet IDs reached");
bdPacket = {
AIE::PacketInfoAttr::get(ctx, /*pkt_type*/ 0, /*pkt_id*/ packetID)};
packetID++;
}
createDMA(device, builder, producer, producerChan.direction,
producerChan.channel, 0, producer.getDimensionsToStreamAttr(),
producer.getPadDimensionsAttr(), bdPacket);
// generate objectFifo allocation info
builder.setInsertionPoint(device.getBody()->getTerminator());
int producerChanIndex = -1;
DMAChannel producerChan;
PacketFlowOp packetflow;
if (producer.getAieStream()) {
int prodStreamEnd = producer.getAieStream().value();
if (prodStreamEnd == 0 || prodStreamEnd == 2) {
producerChanIndex = producer.getAieStreamPort().value();
producerChan = {DMAChannelDir::MM2S, producerChanIndex};
dmaAnalysis.checkAIEStreamIndex(producer.getProducerTileOp(),
producerChan);
}
} else {
producerChanIndex = fifo_dma_channel_index[producer];
if (producerChanIndex == -1)
producer.getProducerTileOp().emitOpError(
"number of output DMA channel exceeded!");
producerChan = {DMAChannelDir::MM2S, producerChanIndex};
std::optional<PacketInfoAttr> bdPacket = {};
if (clPacketSwObjectFifos) {
if (packetID > 31)
device.emitOpError("max number of packet IDs reached");
bdPacket = {AIE::PacketInfoAttr::get(ctx, /*pkt_type*/ 0,
/*pkt_id*/ packetID)};
packetID++;
}
createDMA(device, builder, producer, producerChan.direction,
producerChan.channel, 0, producer.getDimensionsToStreamAttr(),
producer.getPadDimensionsAttr(), bdPacket);

if (producer.getProducerTileOp().isShimTile())
createObjectFifoAllocationInfo(
builder, ctx, producer, producer.getProducerTileOp().colIndex(),
producerChan.direction, producerChan.channel, producer.getPlio(),
bdPacket);
// generate objectFifo allocation info
builder.setInsertionPoint(device.getBody()->getTerminator());
if (producer.getProducerTileOp().isShimTile())
createObjectFifoAllocationInfo(
builder, ctx, producer, producer.getProducerTileOp().colIndex(),
producerChan.direction, producerChan.channel, producer.getPlio(),
bdPacket);

PacketFlowOp packetflow;
if (clPacketSwObjectFifos) {
// create packet flow
builder.setInsertionPointAfter(producer);
packetflow =builder.create<PacketFlowOp>(
builder.getUnknownLoc(),
builder.getIntegerAttr(builder.getI8Type(), bdPacket->getPktId()),
nullptr, nullptr);
{
OpBuilder::InsertionGuard g(builder);
builder.setInsertionPointToStart(
&packetflow.getRegion().emplaceBlock());
builder.create<EndOp>(builder.getUnknownLoc());
if (clPacketSwObjectFifos) {
// create packet flow
builder.setInsertionPointAfter(producer);
packetflow =builder.create<PacketFlowOp>(
builder.getUnknownLoc(),
builder.getIntegerAttr(builder.getI8Type(), bdPacket->getPktId()),
nullptr, nullptr);
{
OpBuilder::InsertionGuard g(builder);
builder.setInsertionPointToStart(
&packetflow.getRegion().emplaceBlock());
builder.create<EndOp>(builder.getUnknownLoc());
}
}
}

for (auto consumer : consumers) {
int consumerChanIndex = fifo_dma_channel_index[consumer];
if (consumerChanIndex == -1)
consumer.getProducerTileOp().emitOpError(
"number of input DMA channel exceeded!");
DMAChannel consumerChan = {DMAChannelDir::S2MM, consumerChanIndex};
// if not aie4 stream, create consumer tile DMA
int consumerChanIndex = -1;
DMAChannel consumerChan;
if (consumer.getAieStream()) {
int consStreamEnd = consumer.getAieStream().value();
if (consStreamEnd == 1 || consStreamEnd == 2) {
consumerChanIndex = consumer.getAieStreamPort().value();
consumerChan = {DMAChannelDir::S2MM, consumerChanIndex};
dmaAnalysis.checkAIEStreamIndex(consumer.getProducerTileOp(),
consumerChan);
}
} else {
consumerChanIndex = fifo_dma_channel_index[consumer];
if (consumerChanIndex == -1)
consumer.getProducerTileOp().emitOpError(
"number of input DMA channel exceeded!");
consumerChan = {DMAChannelDir::S2MM, consumerChanIndex};
BDDimLayoutArrayAttr consumerDims =
consumer.getDimensionsFromStreamPerConsumer()[0];
createDMA(device, builder, consumer, consumerChan.direction,
consumerChan.channel, 1, consumerDims, nullptr, {});

// generate objectFifo allocation info
builder.setInsertionPoint(device.getBody()->getTerminator());
if (!consumer.getAieStream()) {
// generate objectFifo allocation info
builder.setInsertionPoint(device.getBody()->getTerminator());
if (consumer.getProducerTileOp().isShimTile())
// createObjectFifoAllocationInfo(
// builder, ctx, SymbolRefAttr::get(ctx, producer.getName()),
// consumer.getProducerTileOp().colIndex(),
// consumerChan.direction, consumerChan.channel,
// producer.getPlio(), {});
createObjectFifoAllocationInfo(
builder, ctx, producer,
consumer.getProducerTileOp().colIndex(),
consumerChan.direction, consumerChan.channel,
producer.getPlio(), {});
}

if (clPacketSwObjectFifos) {
builder.setInsertionPointToStart(&packetflow.getPorts().front());
builder.create<PacketDestOp>(builder.getUnknownLoc(),
consumer.getProducerTile(),
WireBundle::DMA, consumerChan.channel);
}
}

// If we have PLIO then figure out the direction and make that a PLIO
if (producer.getPlio()) {
Expand All@@ -1993,26 +2059,40 @@ struct AIEObjectFifoStatefulTransformPass
} else {
producerWireType = WireBundle::DMA;
consumerWireType = WireBundle::DMA;
}
if (clPacketSwObjectFifos) {
builder.setInsertionPointToStart(&packetflow.getPorts().front());
builder.create<PacketDestOp>(builder.getUnknownLoc(),
consumer.getProducerTile(),
WireBundle::DMA, consumerChan.channel);
if (producer.getAieStream()) {
int prodStreamEnd = producer.getAieStream().value();
if (prodStreamEnd == 0 || prodStreamEnd == 2)
producerWireType = WireBundle::Core;
}
if (consumer.getAieStream()) {
int consumerStreamEnd = consumer.getAieStream().value();
if (consumerStreamEnd == 1 || consumerStreamEnd == 2)
consumerWireType = WireBundle::Core;
}
}

BDDimLayoutArrayAttr consumerDims =
consumer.getDimensionsFromStreamPerConsumer()[0];
createDMA(device, builder, consumer, consumerChan.direction,
consumerChan.channel, 1, consumerDims, nullptr, {});
// generate objectFifo allocation info
builder.setInsertionPoint(device.getBody()->getTerminator());

if (consumer.getProducerTileOp().isShimTile())
createObjectFifoAllocationInfo(
builder, ctx, producer, consumer.getProducerTileOp().colIndex(),
consumerChan.direction, consumerChan.channel, producer.getPlio(),
{});
// if (clPacketSwObjectFifos) {
// builder.setInsertionPointToStart(&packetflow.getPorts().front());
// builder.create<PacketDestOp>(builder.getUnknownLoc(),
// consumer.getProducerTile(),
// WireBundle::DMA,
// consumerChan.channel);
// }

// BDDimLayoutArrayAttr consumerDims =
// consumer.getDimensionsFromStreamPerConsumer()[0];
// createDMA(device, builder, consumer, consumerChan.direction,
// consumerChan.channel, 1, consumerDims, nullptr, {});
// // generate objectFifo allocation info
// builder.setInsertionPoint(device.getBody()->getTerminator());

// if (consumer.getProducerTileOp().isShimTile())
// createObjectFifoAllocationInfo(
// builder, ctx, producer,
// consumer.getProducerTileOp().colIndex(),
// consumerChan.direction, consumerChan.channel,
// producer.getPlio(),
// {});

if (!clPacketSwObjectFifos) {
// create flow
Expand Down
1 change: 1 addition & 0 deletionspython/dialects/aie.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -484,6 +484,7 @@ def set_aie_stream(self, stream_end, stream_port):
self.attributes["aie_stream"] = int_stream_end
self.attributes["aie_stream_port"] = int_stream_port


# Create an aie objectFifo_link between input and output objectFifos.
class object_fifo_link(ObjectFifoLinkOp):
"""Specialize ObjectFifoLinkOp class constructor to take python variables"""
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp