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

[Primitives] Add default=None for list_lookup #1154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

leonardt
Copy link
Collaborator

Rather than use an explicit default value as the standard pattern, it makes more sense to use the final element of the list since we're buildling a mux tree anyways. The existing explicit "default" value pattern might still be useful to emulate a certain "else" pattern that's different than the last element.

In adding this, I noticed the mux tree was being built forwards, which made the generated code a bit convoluted for this default case, so I reversed the tree instead to make it look more natural in the generated code.

Rather than use an explicit default value as the standard pattern, it
makes more sense to use the final element of the list since we're
buildling a mux tree anyways.  The existing explicit "default" value
pattern might still be useful to emulate a certain "else" pattern that's
different than the last element.

In adding this, I noticed the mux tree was being built forwards, which
made the generated code a bit convoluted for this default case, so I
reversed the tree instead to make it look more natural in the generated
code.
@rsetaluri rsetaluri changed the title [Primitives] Adds default=None for list_lookup [Primitives] Add default=None for list_lookup Oct 12, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #1154 (7320ea4) into master (0807db6) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1154      +/-   ##
==========================================
+ Coverage   85.07%   85.10%   +0.03%     
==========================================
  Files         157      157              
  Lines       16532    16567      +35     
==========================================
+ Hits        14065    14100      +35     
  Misses       2467     2467              
Impacted Files Coverage Δ
magma/primitives/mux.py 96.55% <100.00%> (+0.09%) ⬆️
magma/wire_container.py 92.48% <0.00%> (+0.22%) ⬆️
magma/backend/mlir/hardware_module.py 97.20% <0.00%> (+0.23%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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