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

AIE Python Bindings #716

Merged
merged 9 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 10 additions & 2 deletions include/aie/Dialect/AIE/IR/AIEOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ def AIE_CoreOp: AIE_Op<"core", [
]>, Results<(outs Index)> {
let arguments = (
ins Index:$tile,
DefaultValuedAttr<AIEI32Attr, "0x400">:$stackSize
DefaultValuedAttr<AIEI32Attr, "0x400">:$stackSize,
OptionalAttr<StrAttr>:$link_with
);
let summary = "Declare a core module";
let description = [{
Expand Down Expand Up @@ -1159,7 +1160,12 @@ def AIE_BufferOp: AIE_Op<"buffer", [
```
This operation represents a buffer in tile (3, 3) of 256 elements, each a 64-bit integer.
}];
let arguments = (ins Index:$tile);

let arguments = (
ins Index:$tile,
OptionalAttr<StrAttr>:$sym_name
);

let results = (outs AnyMemRef:$buffer);
let assemblyFormat = [{ `(` $tile `)` attr-dict `:` type($buffer) }];
let hasVerifier = 1;
Expand Down Expand Up @@ -1213,6 +1219,8 @@ def AIE_ExternalBufferOp: AIE_Op<"external_buffer", []>, Results<(outs AnyMemRef
This operation represents an external buffer.
}];

let arguments = (ins OptionalAttr<StrAttr>:$sym_name);

let results = (outs AnyMemRef:$buffer);
let assemblyFormat = [{ attr-dict `:` type($buffer) }];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,8 @@ struct AIEObjectFifoStatefulTransformPass
// if shimTile external buffers are collected from input code
// create as many locks as there are external buffers
if (!creation_tile.isShimTile()) {
BufferOp buff = builder.create<BufferOp>(builder.getUnknownLoc(),
elemType, creation_tile);
buff.getOperation()->setAttr(
mlir::SymbolTable::getSymbolAttrName(),
BufferOp buff = builder.create<BufferOp>(
builder.getUnknownLoc(), elemType, creation_tile,
builder.getStringAttr(op.name().str() + "_buff_" +
std::to_string(of_elem_index)));
buffers.push_back(buff);
Expand Down
9 changes: 3 additions & 6 deletions lib/Dialect/AIEX/Transforms/AIECreateCores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@ struct AIECreateCoresPass : public AIECreateCoresBase<AIECreateCoresPass> {

assert(t && "Unsupported type!");
coreBufTypes.push_back({t, i});
BufferOp buf =
builder.create<BufferOp>(builder.getUnknownLoc(), t, tile);
// buf.setAttr("sym_name",
// builder.getStringAttr("test_name"));
BufferOp buf = builder.create<BufferOp>(builder.getUnknownLoc(), t,
tile, nullptr);
buffers[callOperands[i]] = buf;
operand.replaceAllUsesWith(buf.getResult());
}
Expand Down Expand Up @@ -157,8 +155,7 @@ struct AIECreateCoresPass : public AIECreateCoresBase<AIECreateCoresPass> {
Block *currentBlock;

if (!cores[tileOp]) {
core = builder.create<CoreOp>(builder.getUnknownLoc(),
builder.getIndexType(), tile);
core = builder.create<CoreOp>(builder.getUnknownLoc(), tile);
Region &r = core.getBody();
currentBlock = builder.createBlock(&r);
builder.setInsertionPointToStart(currentBlock);
Expand Down
2 changes: 2 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ declare_mlir_dialect_python_bindings(
SOURCES
dialects/aie.py
DIALECT_NAME AIE
GEN_ENUM_BINDINGS_TD_FILE
"dialects/AIEBinding.td"
)

declare_mlir_dialect_python_bindings(
Expand Down
Loading