-
Notifications
You must be signed in to change notification settings - Fork 29
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
[WIP] Channels-to-ObjectFifos: join and distribute pattern support in L2 #439
base: main
Are you sure you want to change the base?
Conversation
…ute objectFifos are not ordered according to memref indices, and objectFifos from L1 to L2 in join case don't have correct size.
…nnels that use L2
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
Operation *endOfLink = nullptr; // one end of a LinkOp (i.e., a put or get) | ||
int numLinkEnds = 0; // # ends in this link (i.e., # users of AIE.BufferOp) | ||
|
||
AIE::BDDimLayoutArrayAttr dimensionsToStream = AIE::BDDimLayoutArrayAttr::get(channel->getContext(), {});; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
AIE::BDDimLayoutArrayAttr dimensionsToStream = AIE::BDDimLayoutArrayAttr::get(channel->getContext(), {});; | |
AIE::BDDimLayoutArrayAttr dimensionsToStream = | |
AIE::BDDimLayoutArrayAttr::get(channel->getContext(), {}); | |
; |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
@@ -1198,33 +1206,50 @@ struct LowerAIRChannelsPattern : public OpRewritePattern<air::ChannelOp> { | |||
if (res.failed()) | |||
return res; | |||
|
|||
setChannelBufferResources(rewriter, channel, channelPuts[0].getOperation()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
setChannelBufferResources(rewriter, channel, channelPuts[0].getOperation()); | |
setChannelBufferResources(rewriter, channel, | |
channelPuts[0].getOperation()); |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
? ndcpy.getDstSizes() | ||
: ndcpy.getSrcSizes(); | ||
SmallVector<Value> strides = isTileInbound(ndcpy, (int)air::MemorySpace::L1) | ||
? ndcpy.getDstStrides() | ||
: ndcpy.getSrcStrides(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
? ndcpy.getDstSizes() | |
: ndcpy.getSrcSizes(); | |
SmallVector<Value> strides = isTileInbound(ndcpy, (int)air::MemorySpace::L1) | |
? ndcpy.getDstStrides() | |
: ndcpy.getSrcStrides(); | |
? ndcpy.getDstSizes() | |
: ndcpy.getSrcSizes(); | |
SmallVector<Value> strides = | |
isTileInbound(ndcpy, (int)air::MemorySpace::L1) | |
? ndcpy.getDstStrides() | |
: ndcpy.getSrcStrides(); |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
auto wraps_and_strides = | ||
AIE::BDDimLayoutArrayAttr::get(ndcpy->getContext(), ArrayRef(dims)); | ||
bool useDefaultDataAccessPattern = | ||
isAIE2 ? isDefaultDataAccessPattern(sizes, strides, channelPuts[0].getMemref()) : true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
isAIE2 ? isDefaultDataAccessPattern(sizes, strides, channelPuts[0].getMemref()) : true; | |
isAIE2 ? isDefaultDataAccessPattern(sizes, strides, | |
channelPuts[0].getMemref()) | |
: true; |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
? ndcpy.getDstSizes() | ||
: ndcpy.getSrcSizes(); | ||
SmallVector<Value> strides = isTileInbound(ndcpy, (int)air::MemorySpace::L1) | ||
? ndcpy.getDstStrides() | ||
: ndcpy.getSrcStrides(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
? ndcpy.getDstSizes() | |
: ndcpy.getSrcSizes(); | |
SmallVector<Value> strides = isTileInbound(ndcpy, (int)air::MemorySpace::L1) | |
? ndcpy.getDstStrides() | |
: ndcpy.getSrcStrides(); | |
? ndcpy.getDstSizes() | |
: ndcpy.getSrcSizes(); | |
SmallVector<Value> strides = | |
isTileInbound(ndcpy, (int)air::MemorySpace::L1) | |
? ndcpy.getDstStrides() | |
: ndcpy.getSrcStrides(); |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
LogicalResult findChannelPutGetTile(MyOp op, Value *tile, | ||
AIE::AIEObjectFifoType *datatype) const { | ||
std::pair<int, MemRefType> *datatype) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
LogicalResult findChannelPutGetTile(MyOp op, Value *tile, | |
AIE::AIEObjectFifoType *datatype) const { | |
std::pair<int, MemRefType> *datatype) const { | |
LogicalResult | |
findChannelPutGetTile(MyOp op, Value *tile, | |
std::pair<int, MemRefType> *datatype) const { |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
air::ChannelOp channel, | ||
Operation* op) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
air::ChannelOp channel, | |
Operation* op) const { | |
air::ChannelOp channel, Operation *op) const { |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
AIE::ObjectFifoCreateOp createObjectFifo(PatternRewriter &rewriter, | ||
MemRefType datatype, Value prodTile, | ||
const std::vector<Value> &consTile, | ||
int depth, StringRef name) const { | ||
AIE::ObjectFifoCreateOp fifo = builder.create<AIE::ObjectFifoCreateOp>( | ||
builder.getUnknownLoc(), builder.getStringAttr(name), prodTile, | ||
consTile, builder.getIntegerAttr(builder.getI32Type(), depth), | ||
datatype); | ||
return fifo; | ||
int depth, StringRef name, | ||
AIE::BDDimLayoutArrayAttr dimensionsToStream, | ||
AIE::BDDimLayoutArrayArrayAttr dimensionsFromStreamPerConsumer) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
AIE::ObjectFifoCreateOp createObjectFifo(PatternRewriter &rewriter, | |
MemRefType datatype, Value prodTile, | |
const std::vector<Value> &consTile, | |
int depth, StringRef name) const { | |
AIE::ObjectFifoCreateOp fifo = builder.create<AIE::ObjectFifoCreateOp>( | |
builder.getUnknownLoc(), builder.getStringAttr(name), prodTile, | |
consTile, builder.getIntegerAttr(builder.getI32Type(), depth), | |
datatype); | |
return fifo; | |
int depth, StringRef name, | |
AIE::BDDimLayoutArrayAttr dimensionsToStream, | |
AIE::BDDimLayoutArrayArrayAttr dimensionsFromStreamPerConsumer) const { | |
AIE::ObjectFifoCreateOp createObjectFifo( | |
PatternRewriter &rewriter, MemRefType datatype, Value prodTile, | |
const std::vector<Value> &consTile, int depth, StringRef name, | |
AIE::BDDimLayoutArrayAttr dimensionsToStream, | |
AIE::BDDimLayoutArrayArrayAttr dimensionsFromStreamPerConsumer) const { |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
return rewriter.create<AIE::ObjectFifoCreateOp>( | ||
rewriter.getUnknownLoc(), rewriter.getStringAttr(name), prodTile, | ||
consTile, rewriter.getIntegerAttr(rewriter.getI32Type(), depth), | ||
AIE::AIEObjectFifoType::get(datatype), dimensionsToStream, dimensionsFromStreamPerConsumer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
AIE::AIEObjectFifoType::get(datatype), dimensionsToStream, dimensionsFromStreamPerConsumer); | |
AIE::AIEObjectFifoType::get(datatype), dimensionsToStream, | |
dimensionsFromStreamPerConsumer); |
mlir/lib/Conversion/AIRToAIEPass.cpp
Outdated
{SymbolRefAttr::get(ctx, objFifo.name()), offset}); | ||
} | ||
|
||
static bool sortLinkObjectFifos(std::pair<Attribute, int64_t> op0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
static bool sortLinkObjectFifos(std::pair<Attribute, int64_t> op0, | |
static bool sortLinkObjectFifos(std::pair<Attribute, int64_t> op0, |
// remove mem_space from memref for objFifo datatype | ||
if (datatype->first != (int)air::MemorySpace::L1) { | ||
*datatype = {mem_space, memref}; | ||
//MemRefType::get(memref.getShape(), memref.getElementType())}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
//MemRefType::get(memref.getShape(), memref.getElementType())}; | |
// MemRefType::get(memref.getShape(), memref.getElementType())}; |
//std::sort(input_pairs.begin(), input_pairs.end(), sortLinkObjectFifos); | ||
//std::sort(output_pairs.begin(), output_pairs.end(), sortLinkObjectFifos); | ||
// retrieve only objectFifo symbol ref attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
//std::sort(input_pairs.begin(), input_pairs.end(), sortLinkObjectFifos); | |
//std::sort(output_pairs.begin(), output_pairs.end(), sortLinkObjectFifos); | |
// retrieve only objectFifo symbol ref attributes | |
// std::sort(input_pairs.begin(), input_pairs.end(), sortLinkObjectFifos); | |
// std::sort(output_pairs.begin(), output_pairs.end(), sortLinkObjectFifos); | |
// retrieve only objectFifo symbol ref attributes |
rewriter.getArrayAttr(ArrayRef(output_ofs)), | ||
srcOffsets, dstOffsets); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format] reported by reviewdog 🐶
rewriter.getArrayAttr(ArrayRef(output_ofs)), | |
srcOffsets, dstOffsets); | |
rewriter.getArrayAttr(ArrayRef(output_ofs)), srcOffsets, dstOffsets); |
No description provided.