-
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
[LowerClasses] Ensure classes are instantiated by an object. #7072
Conversation
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 makes sense to me.
bool needsClone = false; | ||
if (auto instance = dyn_cast<InstanceOp>(op)) | ||
needsClone = shouldCreateClass(instance.getReferencedModuleNameAttr()); |
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.
I think you can lookup FModuleLike through InstanceGraph and probably we don't have to change the type
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 can avoid avoid an unnecessary instance graph lookup, as the module op is not required here. Querying just using the name seems better here.
0db1203
to
e68f7e0
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.
I think this is good to go.
LowerClass
creates an object for a corresponding instance only if the instantiated module has property ports.But a class can be created for a corresponding module based on other conditions like, if the module is public, or instantiates other classes.
This results in un-instantiated classes that donot correspond to the module hierarchy.
This change ensures that if a class is created for a module, the object is also created from the corresponding instance.
Thus the module hierarchy is also preserved in the
om
IR.Downstream tools parsing the IR can assume a single top level class which is required for object model evaluation.