[HW][OM] Propose to add functions to query the top OM class
SpriteOvO opened this issue · 2 comments
In T1 project, we have multiple configurations, e.g. with or without subsystem, each having different OM hierarchy (the top OM class will be T1Subsystem_Class
or T1_Class
respectively).
@sequencer suggests we adding 2 C-API functions for querying:
- all HW public modules; (so we can append "_Class" and then use the next function)
- checking if a given OM class name exists.
@mikeurbach What do you think about this idea?
Both of these C APIs seem generally useful on their own, so I think it would make sense to add them.
Just to give you a sense of how we've handled a similar need in other downstream projects that work with OM--we don't bake in any assumption about the _Class
suffix that CIRCT currently adds. The way we've found the top OM class is to use the C API functions (via Python in our case) to find all the om.class ops in the IR, and for each, walk their body to see what om.object ops they instantiate. So, we basically build an instance graph, but for class/object instantiations rather than module/instance. From that class/object instance graph, we assert that there is one top, and instantiate that class. That might be possible for your use case as well.
@mikeurbach Thanks for the pointer, that is very helpful!