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

Fix Double Elaboration Backportably #1426

Merged
merged 3 commits into from
May 6, 2020
Merged

Fix Double Elaboration Backportably #1426

merged 3 commits into from
May 6, 2020

Conversation

seldridge
Copy link
Member

This is a replacement for #1412 that also fixes the double elaboration problem in a backwards compatible way. This PR does the following things:

  1. It removes the requirement that Elaborate run in ChiselStage (you don't care that elaboration ran and wasn't invalidated)
  2. It removes the invalidation of Elaborate by the Emitter (the emitter doesn't touch any annotations)
  3. It adds an optionalPrerequisiteOf from Emitter -> Convert to get the correct ordering (this is @davidbiancolin's Have phases.Emitter name phases.Convert as a dependent #1412)

To test this, this adds:

  1. An API expansion where ChiselStage exposes it's phase manager
  2. It adds a test that elaboration runs once by looking at this phase manager

When running ChiselStage, you now get the following phase order:

[info] - should only run elaboration once
[info]   + Phase order is:
[info]     chisel3.stage.ChiselStage$$anon$2
[info]     ├── chisel3.stage.phases.Checks
[info]     ├── chisel3.stage.phases.Elaborate
[info]     ├── chisel3.stage.phases.AddImplicitOutputFile
[info]     ├── chisel3.stage.phases.AddImplicitOutputAnnotationFile
[info]     ├── chisel3.stage.phases.MaybeAspectPhase
[info]     ├── chisel3.stage.phases.Emitter
[info]     ├── chisel3.stage.phases.Convert
[info]     └── chisel3.stage.phases.MaybeFirrtlStage

This cannot fix the bug where Convert should invalidate Elaborate due to the use of PreservesAll. Mixing in PreservesAll or removing it from being mixed in is backwards incompatible and should probably be killed 1.4. 😬

Closes #1412

Related issue: #1412, #1418

Type of change: bug fix

Impact: API addition (no impact on existing code)

Development Phase: implementation

Release Notes

@seldridge seldridge requested a review from a team as a code owner May 4, 2020 22:07
@seldridge seldridge requested a review from davidbiancolin May 4, 2020 22:07
@davidbiancolin
Copy link
Contributor

LGTM. This cleanly subsumes my PR.

seldridge and others added 3 commits May 6, 2020 02:22
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Remove the requirement that FirrtlStage runs elaboration (this should
be implicit) and remove the unneeded invalidation of elaboration by
the Emitter. Due to Convert currently NOT invalidating Elaborate (when
it should), add an optionalPrerequisiteOf to ensure that the Emitter
runs before the Convert phase.

Co-authored-by: David Biancolin <david.biancolin@gmail.com>
Co-authored-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
@seldridge seldridge added this to the 3.3.x milestone May 6, 2020
@seldridge seldridge added the Bugfix Fixes a bug, will be included in release notes label May 6, 2020
@seldridge seldridge merged commit e7b8e6e into master May 6, 2020
@mergify mergify bot added the Backported This PR has been backported label May 6, 2020
@seldridge seldridge deleted the 1412-2 branch May 6, 2020 15:39
mergify bot added a commit that referenced this pull request May 6, 2020
* Test that Elaborate only runs once

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
(cherry picked from commit bfb5b35)

* Expose ChiselStage's PhaseManager, rm extra wraps

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
(cherry picked from commit 23db44a)

* Fix double elaboration

Remove the requirement that FirrtlStage runs elaboration (this should
be implicit) and remove the unneeded invalidation of elaboration by
the Emitter. Due to Convert currently NOT invalidating Elaborate (when
it should), add an optionalPrerequisiteOf to ensure that the Emitter
runs before the Convert phase.

Co-authored-by: David Biancolin <david.biancolin@gmail.com>
Co-authored-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
(cherry picked from commit 5e2ca44)

Co-authored-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported This PR has been backported Bugfix Fixes a bug, will be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants