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

compiler: Generate fminf/fmaxf where necessary #2501

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

FabioLuporini
Copy link
Contributor

No description provided.

@FabioLuporini FabioLuporini added the bug-C-minor bug in the generated code not affecting correctness label Dec 18, 2024
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.29%. Comparing base (4b2b94c) to head (3da0080).
Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
devito/symbolics/printer.py 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2501      +/-   ##
==========================================
- Coverage   87.29%   87.29%   -0.01%     
==========================================
  Files         238      238              
  Lines       45382    45395      +13     
  Branches     4031     4032       +1     
==========================================
+ Hits        39616    39627      +11     
- Misses       5083     5084       +1     
- Partials      683      684       +1     

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


# Check generated code -- ensure it's using the fp64 versions of min/max,
# that is fminf/fmaxf
assert all(i in str(op) for i in expected)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be good (belt and braces) to also check:
assert all(i not in str(op) for i in not_expected)
to ensure that the correct versions are used throughout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

overkill I'd say...

f = Function(name="f", grid=grid)
g = Function(name="g", grid=grid)

eqn = Eq(f, Min(g, 4.0) + Max(g, 2.0))
Copy link
Contributor

Choose a reason for hiding this comment

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

Would use numpy numbers to check dtype is correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wdym exactly? I can think of at least two ways...

I landed on the above because that's the natural way people write the equations and it doesn't matter whether it's 4, 4.0, or 4.0F, because in the end, g will drive the fmin/fmax generation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mloubout I'm gonna merge this because I don't like broken CI, but as soon as you elaborate on how you want this test improved, I'll mkae the change and push it together with one of the upcoming branches (at least one more to go in before christmas)

@FabioLuporini FabioLuporini merged commit 5a15896 into master Dec 19, 2024
31 checks passed
@FabioLuporini FabioLuporini deleted the tweak-minmax-fp64-codegen branch December 19, 2024 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-C-minor bug in the generated code not affecting correctness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants