-
Notifications
You must be signed in to change notification settings - Fork 86
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] Enable init values for Object FIFO #1813
base: main
Are you sure you want to change the base?
Conversation
@@ -591,6 +610,46 @@ void printObjectFifoConsumerTiles(OpAsmPrinter &printer, Operation *op, | |||
} | |||
} | |||
|
|||
static void printObjectFifoInitValues(OpAsmPrinter &p, ObjectFifoCreateOp op, | |||
Attribute numElem, TypeAttr type, Attribute initValues) { |
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 🐶
Attribute numElem, TypeAttr type, Attribute initValues) { | |
Attribute numElem, TypeAttr type, | |
Attribute initValues) { |
static ParseResult parseObjectFifoInitValues(OpAsmParser &parser, Attribute numElem, | ||
TypeAttr type, Attribute &initValues) { |
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 ParseResult parseObjectFifoInitValues(OpAsmParser &parser, Attribute numElem, | |
TypeAttr type, Attribute &initValues) { | |
static ParseResult parseObjectFifoInitValues(OpAsmParser &parser, | |
Attribute numElem, TypeAttr type, | |
Attribute &initValues) { |
TypeAttr type, Attribute &initValues) { | ||
int64_t depth; | ||
if (isa<ArrayAttr>(numElem)) { | ||
depth = llvm::dyn_cast<mlir::IntegerAttr>(llvm::dyn_cast<mlir::ArrayAttr>(numElem)[0]).getInt(); |
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 🐶
depth = llvm::dyn_cast<mlir::IntegerAttr>(llvm::dyn_cast<mlir::ArrayAttr>(numElem)[0]).getInt(); | |
depth = llvm::dyn_cast<mlir::IntegerAttr>( | |
llvm::dyn_cast<mlir::ArrayAttr>(numElem)[0]) | |
.getInt(); |
std::vector<int64_t> newShape = {depth}; | ||
for (auto d : shape) | ||
newShape.push_back(d); | ||
auto memrefType = MemRefType::get(ArrayRef(newShape), memrefTypeNoDepth.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 🐶
auto memrefType = MemRefType::get(ArrayRef(newShape), memrefTypeNoDepth.getElementType()); | |
auto memrefType = | |
MemRefType::get(ArrayRef(newShape), memrefTypeNoDepth.getElementType()); |
auto prodLock = builder.create<LockOp>( | ||
builder.getUnknownLoc(), creation_tile, prodLockID, numElem); | ||
builder.getUnknownLoc(), creation_tile, prodLockID, numElem - initValues.size()); |
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 🐶
auto prodLock = builder.create<LockOp>( | |
builder.getUnknownLoc(), creation_tile, prodLockID, numElem); | |
builder.getUnknownLoc(), creation_tile, prodLockID, numElem - initValues.size()); | |
auto prodLock = | |
builder.create<LockOp>(builder.getUnknownLoc(), creation_tile, | |
prodLockID, numElem - initValues.size()); |
auto consLock = builder.create<LockOp>(builder.getUnknownLoc(), | ||
creation_tile, consLockID, 0); | ||
creation_tile, consLockID, initValues.size()); |
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 🐶
auto consLock = builder.create<LockOp>(builder.getUnknownLoc(), | |
creation_tile, consLockID, 0); | |
creation_tile, consLockID, initValues.size()); | |
auto consLock = | |
builder.create<LockOp>(builder.getUnknownLoc(), creation_tile, | |
consLockID, initValues.size()); |
if (!creation_tile.isShimTile()) { | ||
if (op.getInitValues().has_value()) { | ||
initValues = builder.getI32VectorAttr(ArrayRef(op.getInitialValues()[i])); |
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 🐶
initValues = builder.getI32VectorAttr(ArrayRef(op.getInitialValues()[i])); | |
initValues = | |
builder.getI32VectorAttr(ArrayRef(op.getInitialValues()[i])); |
if (!createOp.getInitValues().has_value()) { | ||
int prodMaxAcquire = findObjectFifoSize( | ||
device, createOp.getProducerTileOp(), createOp); | ||
createOp.setElemNumberAttr(builder.getI32IntegerAttr(prodMaxAcquire)); |
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 🐶
createOp.setElemNumberAttr(builder.getI32IntegerAttr(prodMaxAcquire)); | |
createOp.setElemNumberAttr( | |
builder.getI32IntegerAttr(prodMaxAcquire)); |
No description provided.