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

[FIRRTL] Don't enforce owning module for local ref in LowerClasses. #6811

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

mikeurbach
Copy link
Contributor

We have an existing check that paths are in the same owning module as the entity they target. This is absolutely required for hierarchical references to compose with basepaths. However, we have legacy flows that extract entities out of their owning module, and we want to be able to target those things. This works around these conflicting requirements by skipping the owning module check for local targets only. This is safe because we still check such local targets are only instantiated once, so there is no ambiguity even though they are not instantiated within the owning module.

Copy link
Contributor

@prithayan prithayan left a comment

Choose a reason for hiding this comment

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

Seems like a reasonable solution to handle local targets that are outside the current hierarchy.

We have an existing check that paths are in the same owning module as
the entity they target. This is absolutely required for hierarchical
references to compose with basepaths. However, we have legacy flows
that extract entities out of their owning module, and we want to be
able to target those things. This works around these conflicting
requirements by skipping the owning module check for local targets
only. This is safe because we still check such local targets are only
instantiated once, so there is no ambiguity even though they are not
instantiated within the owning module.
@mikeurbach mikeurbach force-pushed the mikeurbach/lower-classes-local-target branch from 080c0f1 to acc9109 Compare March 11, 2024 23:56
Copy link
Contributor

@dtzSiFive dtzSiFive left a comment

Choose a reason for hiding this comment

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

Let's try to not let this live too long, but LGTM.

If filing an issue would help not forget then great but up to you.

Random thought: can the symbol become a hierpath due to dedup or something? If so, is that okay? Maybe it's fine anyway and not likely but just bouncing it off ya re: legality/safety.

@mikeurbach
Copy link
Contributor Author

If filing an issue would help not forget then great but up to you.

Yeah I will file an issue to revert this once we stop using ExtractInstances

can the symbol become a hierpath due to dedup or something?

This can happen, and if it does the target will be subject to the existing "owning module" constraint. This only skips the constraint for targets that are still fully local by the time they reach LowerClasses.

@mikeurbach mikeurbach merged commit c12c68d into main Mar 12, 2024
4 checks passed
@mikeurbach mikeurbach deleted the mikeurbach/lower-classes-local-target branch March 12, 2024 01:25
mikeurbach added a commit that referenced this pull request Mar 13, 2024
…asses. (#6811)"

This reverts commit c12c68d.

This was a quick workaround, but a better solution is being developed.
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.

3 participants