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

inline_single_instance pass should maintain instance name #967

Open
rsetaluri opened this issue Oct 7, 2020 · 1 comment
Open

inline_single_instance pass should maintain instance name #967

rsetaluri opened this issue Oct 7, 2020 · 1 comment
Assignees

Comments

@rsetaluri
Copy link
Collaborator

See StanfordAHA/gemstone#43.

The inline_single_instances pass takes a module definition which contains only a single instance and instantiates that instance at the parent level. So if we have a hierarchy like:

- ModuleDef Top
  - Inst Son "son_inst"
  - Inst Daughter "daughter_inst"

- ModuleDef Son
  - Inst Grandchild "grandchild_inst"

We would want to transform that into

- ModuleDef Top
  - Inst Grandchild "son_inst"
  - Inst Daughter "daughter_inst"

since moduledef Grandchild only contains a single instance. Right now we name the lifted instance of Grandchild as son_inst$grandchild_inst since this is the naming logic generically used by inlining (infact it has to be so unless there is only a single instance inside).

At a high-level there are two ways to do this: one is to do the default naming and then rename the inlined instance. The other way to do this is to pass in a custom "namer" functor, which takes in the child and grandchild instances and returns a new name. The default value for this functor could be [](Instance* const child, Instance* const grandchild) { return child->name() + "$" + grandchild->name(); }. When inline single instances calls inlineInstance() the functor would be [](Instance* const child, Instance* const grandchild) { return child->name(); }.

@rdaly525
Copy link
Owner

rdaly525 commented Oct 7, 2020

Relevant files to modify:
inline.cpp: Add ability to pass in naming functor
inline_single_instance.cpp: Use the new inline API

Relevant tests:
tests/binary/test_clock_gate.py
tests/binary/test_inline_single_instances_metadata.py
tests/gtest/test_if_reconstruction.cpp

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

No branches or pull requests

2 participants