-
Notifications
You must be signed in to change notification settings - Fork 603
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
For HasId.setRef, have first set win (with force override) #1655
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
azidar
approved these changes
Nov 5, 2020
jackkoenig
added
Please Merge
Accepted PRs that are ready to be merged. Useful when waiting on CI.
and removed
Please Merge
Accepted PRs that are ready to be merged. Useful when waiting on CI.
labels
Nov 5, 2020
#1654 didn't backport apparently so need to get that in first before backporting this |
jackkoenig
force-pushed
the
set-ref-first-wins
branch
from
November 5, 2020 23:23
30db1c7
to
ef18c60
Compare
jackkoenig
added
the
Please Merge
Accepted PRs that are ready to be merged. Useful when waiting on CI.
label
Nov 5, 2020
mergify bot
added a commit
that referenced
this pull request
Nov 6, 2020
…1657) This is a refinement of the assertion added in #1616 then removed in #1654. Because Records now set the refs of children upon binding, later, unbound Records could incorrectly override the refs. The first set should win. (cherry picked from commit 8187318) Co-authored-by: Jack Koenig <koenig@sifive.com>
jackkoenig
pushed a commit
that referenced
this pull request
Feb 28, 2023
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.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
Please Merge
Accepted PRs that are ready to be merged. Useful when waiting on CI.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a refinement of the assertion added in #1616 then removed in
#1654. Because Records now set the refs of children upon binding,
later, unbound Records could incorrectly override the refs. The first
set should win.
This relates to firesim/firesim#653.
This issue was found from the following declaration (relevant code pasted below):
https://github.com/firesim/firesim/blob/c2d8e3a46e59222e115a1fdaa7267592e1d3c503/sim/firesim-lib/src/main/scala/bridges/SerialBridge.scala#L39
Basically, we have a
Record
that intentionally does not clone its argument (not even upon callingcloneType
on itself). This means that all clones of thisRecord
have the same exact Data object as a field.This is totally an API-hole that should be closed, but it is the existing API and is used intentionally in FireSim.
The problem is that there are 2 instances of
HostPortIO
, the first one which is unbound (call it "A") and the second which is bound as the IO with namehPort
(call it "B"). Note that they each have the sameSerialBridgeTargetIO
object as their element namedhBits
.In Chisel v3.4.0 and before, during
onModuleClose
, "A" sets the ref of theSerialBridgeTargetIO
to point to itself, then "B" overrides that and sets the ref to point to itself (which is the correct result). This is due to the order in which they were constructed (thus being "correct by coincidence").In #1616, we changed the behavior so that
Records
set the refs of their children upon binding, and only if never bound do they set it duringonModuleClose
. This means that now "B" sets the ref first, then "A" overrides it. This PR fixes this issue by ensuring the first set wins (unless overridden which is forBlackBox
only and is described in #1616).If this sounds sketchy, it is, but fixing this API hole should occur on a major release. This fix is intended only to preserve existing behavior on the
3.4.x
release line.Contributor Checklist
docs/src
?No release notes because bug is not-yet released
Type of Improvement
API Impact
No impact
Backend Code Generation Impact
No impact
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
Please Merge
?