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 hash #355

Merged
merged 9 commits into from Feb 21, 2019
Merged

Fix hash #355

merged 9 commits into from Feb 21, 2019

Conversation

rsetaluri
Copy link
Collaborator

This commit fixes a bug where we would potentially call __call__ (where
the actual uniquification logic occurs) multiple times for each
definition.
Previously, we were keeping track of which definitions we had already
touched in the InstanceGraphPass by using definition.__name__ as a dict
key. Instead, we should now use id(definition) as multiple definitions
with the same name can exist (but they have different id's).
We previously handled how we rename duplicated circuits incorrectly.
This commit fixes that.


def test_key_error():
import mantle
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For some reason I'm not able to reproduce the error this test targets without these mantle elements -- I don't think the issue (and therefore this test) really has anything to do with mantle, but it is sufficiently nuanced that I couldn't reproduce in a hand-crafted way w/o mantle.

@leonardt thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The circuit combinational tests also depend on a Mux (for testing the generated muxes from if statements). What I did was stub out the DefineMux logic without a definition. Would that be sufficient for this test? Or does it need the actual implementation? Either way, I think it might be okay to copy the Mux definition from mantle and keep it the magma test suite as a common circuit. It's not essential to keep this up to date with mantle, it's more to serve as an example of a non-trivial circuit definition.

Copy link
Collaborator

@leonardt leonardt Feb 14, 2019

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the pointers @lenny. It would be good to be able to mock mantle in general.

For this test I just pretty much copied from: https://github.com/phanrahan/mantle/blob/29ec32d76b2faf189525fcb5b5a845d817dcd9b2/mantle/coreir/MUX.py#L46-L119.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I verified that the test is "valid" in that it causes the proper failure without this change.

Essentially c/p the code from mantle for creating Mux2x6. This should be
ok since it is a relatively stable component.
@coveralls
Copy link

coveralls commented Feb 15, 2019

Pull Request Test Coverage Report for Build 1485

  • 17 of 18 (94.44%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.4%) to 73.464%

Changes Missing Coverage Covered Lines Changed/Added Lines %
magma/uniquification.py 14 15 93.33%
Files with Coverage Reduction New Missed Lines %
magma/circuit.py 1 86.67%
Totals Coverage Status
Change from base Build 1464: 0.4%
Covered Lines: 3718
Relevant Lines: 5061

💛 - Coveralls

1 similar comment
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1485

  • 17 of 18 (94.44%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.4%) to 73.464%

Changes Missing Coverage Covered Lines Changed/Added Lines %
magma/uniquification.py 14 15 93.33%
Files with Coverage Reduction New Missed Lines %
magma/circuit.py 1 86.67%
Totals Coverage Status
Change from base Build 1464: 0.4%
Covered Lines: 3718
Relevant Lines: 5061

💛 - Coveralls

Copy link
Collaborator

@leonardt leonardt left a comment

Choose a reason for hiding this comment

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

LGTM!

@leonardt leonardt merged commit 5067d72 into master Feb 21, 2019
@leonardt leonardt deleted the fix-hash branch February 21, 2019 22:01
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.

None yet

3 participants