-
Notifications
You must be signed in to change notification settings - Fork 299
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
[Emit] Organize output files using the emit
dialect
#6727
Conversation
f2cc4f5
to
cd2130e
Compare
2c30daf
to
ec530d0
Compare
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.
The rationale and usual dialect boilerplate look good to me. A couple minor questions on the implementation, but looks like a great start.
lib/Dialect/Emit/EmitOps.cpp
Outdated
auto *parent = getOperation()->getParentOp(); | ||
for (auto sym : getFiles()) { | ||
Operation *op = | ||
symbolTable.lookupSymbolIn(parent, sym.cast<FlatSymbolRefAttr>()); |
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.
It looks like FileOp and FileListOp are expected to be siblings that exist within the same level of SymbolTable. Should we write that down in the ODS description? Could we go farther and maybe use HasParent with the same kind of op for both? Or do we not care, as long as their siblings?
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.
HasParent is tricky since at the FIRRTL level these should live inside of a CircuitOp, but at the HW level they live inside a ModuleOp.
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.
Makes sense. I guess we should just document in FileListOp that it expects the FileOps it references to be in the same symbol table as the FileListOp itself.
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.
It should fail if it's not. The lookup should be structure to ensure that, which might mean not poking at random op parents to do lookup but following the symbol lookup rules.
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.
This looks good to me now using lookupNearestSymbolFrom(getOperation(), ...)
ec530d0
to
11f5499
Compare
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.
Looks good. Given the issues we've had, should be checking symbol nesting validity with explicit tests.
I'm not sold on emit.verbatim making sv.verbatim redundant. A generic emit.verbatim does make sense, but I worry about dialect-specific substitution semantics.
lib/Dialect/Emit/EmitOps.cpp
Outdated
auto *parent = getOperation()->getParentOp(); | ||
for (auto sym : getFiles()) { | ||
Operation *op = | ||
symbolTable.lookupSymbolIn(parent, sym.cast<FlatSymbolRefAttr>()); |
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.
It should fail if it's not. The lookup should be structure to ensure that, which might mean not poking at random op parents to do lookup but following the symbol lookup rules.
11f5499
to
3086362
Compare
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.
My previous concerns are addressed, just some questions about the optional symbols.
3086362
to
6e72558
Compare
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.
Generally, I'm good with this. This will do wonders to help wrangle all the various files that come out of a build.
There are some design point considerations around if a filelist op is actually needed. I don't have a super strong opinion here.
6e72558
to
c13394f
Compare
No description provided.