Skip to content
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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

AndraBisca
Copy link
Collaborator

No description provided.

@@ -591,6 +610,46 @@ void printObjectFifoConsumerTiles(OpAsmPrinter &printer, Operation *op,
}
}

static void printObjectFifoInitValues(OpAsmPrinter &p, ObjectFifoCreateOp op,
Attribute numElem, TypeAttr type, Attribute initValues) {
Copy link
Contributor

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 🐶

Suggested change
Attribute numElem, TypeAttr type, Attribute initValues) {
Attribute numElem, TypeAttr type,
Attribute initValues) {

Comment on lines +621 to +622
static ParseResult parseObjectFifoInitValues(OpAsmParser &parser, Attribute numElem,
TypeAttr type, Attribute &initValues) {
Copy link
Contributor

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 🐶

Suggested change
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();
Copy link
Contributor

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 🐶

Suggested change
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());
Copy link
Contributor

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 🐶

Suggested change
auto memrefType = MemRefType::get(ArrayRef(newShape), memrefTypeNoDepth.getElementType());
auto memrefType =
MemRefType::get(ArrayRef(newShape), memrefTypeNoDepth.getElementType());

Comment on lines 330 to +331
auto prodLock = builder.create<LockOp>(
builder.getUnknownLoc(), creation_tile, prodLockID, numElem);
builder.getUnknownLoc(), creation_tile, prodLockID, numElem - initValues.size());
Copy link
Contributor

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 🐶

Suggested change
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());

Comment on lines 339 to +340
auto consLock = builder.create<LockOp>(builder.getUnknownLoc(),
creation_tile, consLockID, 0);
creation_tile, consLockID, initValues.size());
Copy link
Contributor

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 🐶

Suggested change
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]));
Copy link
Contributor

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 🐶

Suggested change
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));
Copy link
Contributor

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 🐶

Suggested change
createOp.setElemNumberAttr(builder.getI32IntegerAttr(prodMaxAcquire));
createOp.setElemNumberAttr(
builder.getI32IntegerAttr(prodMaxAcquire));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants