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: (llvm) added the 'exact' keyword to the corresponding operations #3390

Merged
merged 8 commits into from
Nov 4, 2024

Conversation

lfrenot
Copy link
Collaborator

@lfrenot lfrenot commented Nov 4, 2024

No description provided.

@lfrenot lfrenot added the dialects Changes on the dialects label Nov 4, 2024
@lfrenot lfrenot self-assigned this Nov 4, 2024
@tobiasgrosser tobiasgrosser changed the title dialects: (llvm) added the 'exact' keyword to the corrsponding operations dialects: (llvm) added the 'exact' keyword to the corresponding operations Nov 4, 2024
@tobiasgrosser
Copy link
Contributor

@lfrenot, can you rebase to ensure this PR has a clean history?

lfrenot and others added 4 commits November 4, 2024 13:18
`mlir-opt` attempts to print floats as 6dp scientific notation, but
round-trips to ensure there is no precision loss and the printed number
will bitwise reproduce exactly. If this fails, it will choose a
different printing method to ensure bit-reproducible printing for a
given precision of fp types.

This PR takes the approach of mlir-opt: attempt to print to scientific
6dp notation iff the resulting string is losslessly reproducible, or
else print to full precision using repr. This has the advantage of not
affecting a vast number of filechecks, mirroring upstream, and not
having a flag for either full or reduced precision.

---------

Co-authored-by: n-io <n-io@users.noreply.github.com>
This prints `FloatAttr` special values `nan`, `inf`, `-inf` as a
hexadecimal binary representation to align with mlir-opt as described in

Also see the [FloatAttr
docs](https://mlir.llvm.org/docs/Dialects/Builtin/#floatattr) or give it
a try on [godbolt](https://godbolt.org/z/89TfsvaKT).

---------

Co-authored-by: n-io <n-io@users.noreply.github.com>
@lfrenot lfrenot force-pushed the leon/llvm-exact-flag branch from fba3661 to 442650a Compare November 4, 2024 13:21
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.15%. Comparing base (87e1a46) to head (30b89e2).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3390      +/-   ##
==========================================
+ Coverage   90.13%   90.15%   +0.02%     
==========================================
  Files         452      452              
  Lines       57157    57195      +38     
  Branches     5498     5500       +2     
==========================================
+ Hits        51519    51565      +46     
+ Misses       4180     4175       -5     
+ Partials     1458     1455       -3     

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

@tobiasgrosser
Copy link
Contributor

You still seem to have unrelated changes in the commits, no?

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

LGTM modulo prop_name. @tobiasgrosser, which are the extra files you mean?

Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
lhs = operand_def(T)
rhs = operand_def(T)
res = result_def(T)
is_exact = opt_prop_def(BoolAttr, prop_name="isExact")
Copy link
Member

Choose a reason for hiding this comment

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

Oh, one more thing, is that I don't think it makes sense for this property to be optional, isn't it the same as default 0?

Suggested change
is_exact = opt_prop_def(BoolAttr, prop_name="isExact")
is_exact = prop_def(BoolAttr, prop_name="isExact")

Copy link
Member

Choose a reason for hiding this comment

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

also, default_value might be useful here

@tobiasgrosser
Copy link
Contributor

LGTM modulo prop_name. @tobiasgrosser, which are the extra files you mean?

No extra files, but 6460b2d is included in the list of commits here. We should avoid this in the future and start with clean PR histories. Given that this PR is almost closed, we are fine, I guess.

@superlopuh
Copy link
Member

When we merge in xDSL, the history is deleted, as the merges are rebase+squash, so rebasing is not a pattern I've seen very much.

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

One final thought is that it would probably be worth adding the interop tests with MLIR

@lfrenot
Copy link
Collaborator Author

lfrenot commented Nov 4, 2024

These wouldn't work right now, since exact flags are not in MLIR yet
I've started looking into it

@tobiasgrosser
Copy link
Contributor

When we merge in xDSL, the history is deleted, as the merges are rebase+squash, so rebasing is not a pattern I've seen very much.

Sure, but PR start typically with a clean history and not with some random other PRs being part of it.

@lfrenot
Copy link
Collaborator Author

lfrenot commented Nov 4, 2024

@tobiasgrosser are we good to merge?

@tobiasgrosser
Copy link
Contributor

Yes, good to merge if @superlopuh is happy.

@lfrenot lfrenot merged commit 447d643 into main Nov 4, 2024
15 checks passed
@lfrenot lfrenot deleted the leon/llvm-exact-flag branch November 4, 2024 16:16
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
…tions (xdslproject#3390)

Co-authored-by: Nicolai Stawinoga <36768051+n-io@users.noreply.github.com>
Co-authored-by: n-io <n-io@users.noreply.github.com>
Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
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.

4 participants