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

Feed HW alignment requirements from system desc into allocator #310

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

nsmithtt
Copy link
Contributor

@nsmithtt nsmithtt commented Aug 7, 2024

  • Enforce the Noc/DRAM/PCIE alignment requirements taken from the system
    descriptor on the allocator.
  • Annotate function arguments with new attribute "argument_allocations"
    with info about where inputs are allocated.

- Enforce the Noc/DRAM/PCIE alignment requirements taken from the system
  descriptor on the allocator.
- Annotate function arguments with new attribute "argument_allocations"
  with info about where inputs are allocated.
@@ -479,6 +502,17 @@ uint64_t TileType::getSizeBytes() const {
}
}

SystemDescAttr mlir::tt::getCurrentScopeSystemDesc(mlir::Operation *op) {
while (op) {
if (auto systemDesc =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each OP can now have system desc attr? Or only module and funcops? Can system desc be different between different func ops?

Copy link
Contributor Author

@nsmithtt nsmithtt Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only ModuleOps can have a system desc, this is just a convenience method that gets the system desc of the current scope. This routine just walks up parent ops until it hits the top level module op.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It allows you to get at the system desc from anywhere. If you're in some rewrite pattern you don't necessarily have a direct handle to the enclosing module.

Copy link
Contributor

@nobradovictt nobradovictt Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isa<ModuleOp> check might be better then? You clearly state what type has the attr and you will throw if not found where expected instead of returning nullptr, or there is a valid case for nullptr to be returned?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I copy pasted this from getCurrentScopeDevice and I think in the future the device attribute could appear on specialized ops (like ttir.with_device op which reinterprets the device grid), but it makes more sense to be more strict here. I'll fix this with your suggestion.

@nsmithtt nsmithtt merged commit 9fe2003 into main Aug 7, 2024
6 checks passed
@nsmithtt nsmithtt deleted the nsmith/alignment branch August 7, 2024 19:47
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