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

add transforms to lint module name conflicts and override module names #2452

Merged
merged 50 commits into from
Jun 11, 2020

Conversation

albertchen-sifive
Copy link
Contributor

@albertchen-sifive albertchen-sifive commented May 6, 2020

This PR adds the LintConflictingModuleNames lint rule that will check for module name collisions and the RenameDesiredNames transform to override module names.

LintConflictingModuleNames works by looking at DesiredNameAnnotations and checking that all desired names target exactly one module. e.g. if two different modules are annotated with Queue desired name this will result in a lint violation.

RenameModuleNames works by looking for OverrideDesiredNameAnnotations and renaming modules and their associated DesiredNameAnnotations to the name override. If the same module name override targets more than one module then the name override is ignored and the targeted modules are not renamed.

also adds RenameModulesAspect that can be used to emit name overrides and a LintConflictingModuleNamesAspect to collect DesiredNameAnnotations to be checked by the lint pass.

Related issue: chipsalliance/firrtl#1274

Type of change: feature request

Impact: API addition (no impact on existing code)

Development Phase: implementation

Release Notes

add StabilizeModuleNames transform

@mwachs5
Copy link
Contributor

mwachs5 commented May 6, 2020 via email

@albertchen-sifive
Copy link
Contributor Author

An immediate reaction... could the hash be prepended with some sort of code that shows which algorithm it is using Maybe something like “hDEADBEEF” for heirqrchical, or “pDEADBEEF” for ports-only, or something?

good idea. pushed an update

@mwachs5
Copy link
Contributor

mwachs5 commented May 6, 2020

I am not sure I understand the outputs you presented. It says
"===== comparing freechips.rocketchip.system.DefaultSmallConfig.stabilized.v =====
shared names (147):
AXI4Buffer_p5AA54DAA
AXI4Buffer_pD0BF562D
...
"

What are you comparing it to? When it says
names only in original: 129
names only in freechips.rocketchip.system.TinyConfig.stabilized.v: 98

What is original?

@albertchen-sifive
Copy link
Contributor Author

What is original?

freechips.rocketchip.system.DefaultConfig

@albertchen-sifive
Copy link
Contributor Author

anyone know how to fix The command "travis_wait 80 make emulator-ndebug -C regression SUITE=Miscellaneous JVM_MEMORY=3G" exited with 137. https://travis-ci.org/github/chipsalliance/rocket-chip/jobs/684537271#L5385? I've already restarted once. googling it looks like its because it takes too many resources?

@mwachs5
Copy link
Contributor

mwachs5 commented May 8, 2020 via email

@albertchen-sifive
Copy link
Contributor Author

maybe split up the Miscellaneous test suite to to smaller ones?

Copy link
Contributor

@mwachs5 mwachs5 left a comment

Choose a reason for hiding this comment

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

Sorry, didn't realize this review was still sitting in "pending" state

src/main/scala/aspects/RenameModulesAspect.scala Outdated Show resolved Hide resolved
src/main/scala/linting/rule/RenameDesiredNames.scala Outdated Show resolved Hide resolved
src/main/scala/linting/rule/RenameDesiredNames.scala Outdated Show resolved Hide resolved
src/test/scala/linting/rule/RenameDesiredNamesSpec.scala Outdated Show resolved Hide resolved
@mwachs5
Copy link
Contributor

mwachs5 commented Jun 4, 2020

Also, can you update the PR Title/description at the top to reflect the new scope of this?

Co-authored-by: Megan Wachs <megan@sifive.com>
@albertchen-sifive albertchen-sifive changed the title add transform to stabilize module names add transforms to lint module name conflicts and override module names Jun 5, 2020
Copy link
Contributor

@azidar azidar left a comment

Choose a reason for hiding this comment

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

Looking better :) I think we should get rid of the "strategy" concept entirely as its just distracting now.

@azidar
Copy link
Contributor

azidar commented Jun 8, 2020

Great! I think removing the strategy stuff made the PR a lot cleaner. I'm happy to approve except for two minor nits (update recommendedFix and add a comment to the optionalPrereqs). I think Megan has a few unresolved comments about the tests, so once those are addressed happy to merge!

@mwachs5
Copy link
Contributor

mwachs5 commented Jun 9, 2020

@azidar do you need to re-review given your comments? Merging is blocked on your "request changes". I am reviewing again now.

Copy link
Contributor

@mwachs5 mwachs5 left a comment

Choose a reason for hiding this comment

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

LGTM!

@albertchen-sifive
Copy link
Contributor Author

force-pushed because rerun workflow button doesn't seem to work for me

@albertchen-sifive albertchen-sifive requested a review from azidar June 10, 2020 20:37
@albertchen-sifive albertchen-sifive merged commit 5e80594 into master Jun 11, 2020
@albertchen-sifive albertchen-sifive deleted the stabilize-names branch June 11, 2020 21:51
terpstra added a commit that referenced this pull request Jun 12, 2020
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.

4 participants