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

dialects: (builtin) DenseIntOrFPElementsAttr: make data private and use getters instead #3535

Merged
merged 7 commits into from
Nov 29, 2024

Conversation

jorendumoulin
Copy link
Collaborator

To prepare for the change of internal data representation, this PR makes the actual data of the attribute a private attribute. Everthing is accessed with the getters get_attrs (IntegerAttr, ...) and get_values (int, float).

The check whether the dense is set by a scalar is pretty common, so i included an additional helper function for that as well

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.36%. Comparing base (dff62c6) to head (696b038).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3535   +/-   ##
=======================================
  Coverage   90.35%   90.36%           
=======================================
  Files         466      466           
  Lines       58481    58515   +34     
  Branches     5582     5583    +1     
=======================================
+ Hits        52841    52877   +36     
+ Misses       4210     4208    -2     
  Partials     1430     1430           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jorendumoulin jorendumoulin self-assigned this Nov 28, 2024
Copy link
Collaborator

@math-fehr math-fehr left a comment

Choose a reason for hiding this comment

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

Seems sensible to me, I would just rename is_scalar to is_splat though

xdsl/dialects/builtin.py Outdated Show resolved Hide resolved
@jorendumoulin jorendumoulin added the dialects Changes on the dialects label Nov 28, 2024
Comment on lines +48 to +50
and val.is_splat()
):
return val.data.data[0]
return val.get_attrs()[0]
Copy link
Member

Choose a reason for hiding this comment

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

very nice

@jorendumoulin jorendumoulin merged commit 130b204 into main Nov 29, 2024
15 checks passed
@jorendumoulin jorendumoulin deleted the joren/dense-attr-private-data branch November 29, 2024 09:25
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
…se getters instead (xdslproject#3535)

To prepare for the change of internal data representation, this PR makes
the actual data of the attribute a private attribute. Everthing is
accessed with the getters `get_attrs` (IntegerAttr, ...) and
`get_values` (int, float).

The check whether the dense is set by a scalar is pretty common, so i
included an additional helper function for that as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants