-
Notifications
You must be signed in to change notification settings - Fork 14
Arch-aware Mapping (successfully built, read spec path from ENV) #101
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
base: main
Are you sure you want to change the base?
Changes from all commits
30187d6
db8d764
db24510
38abb68
7333452
2609389
deef1c0
124f8cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,7 +17,7 @@ Tile::Tile(int id, int x, int y) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TODO: Add function units based on architecture specs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // @Jackcuii, https://github.com/coredac/dataflow/issues/82. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| addFunctionUnit(std::make_unique<FixedPointAdder>(0)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // addFunctionUnit(std::make_unique<FixedPointAdder>(0)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| int Tile::getId() const { return id; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -275,6 +275,44 @@ Architecture::Architecture(int width, int height) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Architecture::Architecture(const YAML::Node& config) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Extract width and height from config | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| int width = 4; // default | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| int height = 4; // default | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (config["architecture"] && config["architecture"]["width"] && config["architecture"]["height"]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
tancheng marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| width = config["architecture"]["width"].as<int>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| height = config["architecture"]["height"].as<int>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Call the constructor with width and height. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| *this = Architecture(width, height); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Add function units based on the architecture specs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| int num_tiles = width * height; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+278
to
+292
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Architecture::Architecture(const YAML::Node& config) { | |
| // Extract width and height from config | |
| int width = 4; // default | |
| int height = 4; // default | |
| if (config["architecture"] && config["architecture"]["width"] && config["architecture"]["height"]) { | |
| width = config["architecture"]["width"].as<int>(); | |
| height = config["architecture"]["height"].as<int>(); | |
| } | |
| // Call the constructor with width and height. | |
| *this = Architecture(width, height); | |
| // Add function units based on the architecture specs. | |
| int num_tiles = width * height; | |
| Architecture::Architecture(const YAML::Node& config) | |
| : Architecture( | |
| config["architecture"] && config["architecture"]["width"] && config["architecture"]["height"] | |
| ? config["architecture"]["width"].as<int>() | |
| : 4, | |
| config["architecture"] && config["architecture"]["height"] | |
| ? config["architecture"]["height"].as<int>() | |
| : 4) { | |
| // Add function units based on the architecture specs. | |
| int num_tiles = getNumTiles(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,17 +16,40 @@ using namespace mlir::neura; | |
| namespace { | ||
|
|
||
| inline OperationKind getOperationKindFromMlirOp(Operation *op) { | ||
| if (isa<neura::AddOp>(op)) | ||
| return IAdd; | ||
| if (isa<neura::MulOp>(op)) | ||
| return IMul; | ||
| if (isa<neura::FAddOp>(op)) | ||
| return FAdd; | ||
| if (isa<neura::FMulOp>(op)) | ||
| return FMul; | ||
| // TODO: Complete the list here. | ||
| // @Jackcuii, https://github.com/coredac/dataflow/issues/82. | ||
| return IAdd; | ||
| if (isa<neura::AddOp>(op)) return OpIAdd; | ||
| if (isa<neura::MulOp>(op)) return OpIMul; | ||
| if (isa<neura::FAddOp>(op)) return OpFAdd; | ||
| if (isa<neura::FMulOp>(op)) return OpFMul; | ||
| if (isa<neura::SubOp>(op)) return OpISub; | ||
| if (isa<neura::FSubOp>(op)) return OpFSub; | ||
| if (isa<neura::DivOp>(op)) return OpIDiv; | ||
| if (isa<neura::FDivOp>(op)) return OpFDiv; | ||
| if (isa<neura::FAddFAddOp>(op)) return OpFAddFAdd; | ||
| if (isa<neura::FMulFAddOp>(op)) return OpFMulFAdd; | ||
| if (isa<neura::VFMulOp>(op)) return OpVFMul; | ||
| if (isa<neura::ICmpOp>(op)) return OpICmp; | ||
| if (isa<neura::NotOp>(op)) return OpNot; | ||
| if (isa<neura::OrOp>(op)) return OpOr; | ||
| if (isa<neura::SelOp>(op)) return OpSel; | ||
| if (isa<neura::CastOp>(op)) return OpCast; | ||
| if (isa<neura::LoadOp>(op)) return OpLoad; | ||
| if (isa<neura::LoadIndexedOp>(op)) return OpLoadIndexed; | ||
| if (isa<neura::StoreOp>(op)) return OpStore; | ||
| if (isa<neura::StoreIndexedOp>(op)) return OpStoreIndexed; | ||
| if (isa<neura::Br>(op)) return OpBr; | ||
| if (isa<neura::CondBr>(op)) return OpCondBr; | ||
| if (isa<neura::ReturnOp>(op)) return OpReturn; | ||
| if (isa<neura::LoopControllerOp>(op)) return OpLoopController; | ||
| if (isa<neura::GrantAlwaysOp>(op)) return OpGrantAlways; | ||
| if (isa<neura::GrantOnceOp>(op)) return OpGrantOnce; | ||
| if (isa<neura::GrantPredicateOp>(op)) return OpGrantPredicate; | ||
| if (isa<neura::GEP>(op)) return OpGEP_; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this line use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh. My mistake. should use OpGEP |
||
| if (isa<neura::ConstantOp>(op)) return OpConstant; | ||
| if (isa<neura::PhiOp>(op)) return OpPhi; | ||
| if (isa<neura::DataMovOp>(op)) return OpDataMov; | ||
| if (isa<neura::CtrlMovOp>(op)) return OpCtrlMov; | ||
| // Default fallback | ||
| return OpIAdd; | ||
| } | ||
|
|
||
| // Returns true if the operation does not need CGRA tile placement. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.