Skip to content

Reimplement the generic fmod #880

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

Merged
merged 1 commit into from
Apr 22, 2025
Merged

Conversation

quaternic
Copy link
Contributor

Redo of rust-lang/libm#536 since the repository was moved.

Full reimplementation for fmod, that should be somewhat cleaner. This was showing a decent perf gain locally, but the major improvement will come later by implementing the reduction helper with something smarter, which does involve some tradeoffs and alternatives to consider.

While applying the feedback from the original PR, I used the opportunity to go over the code again.

@tgross35
Copy link
Contributor

Sorry about CI, looks like I have a few things to fix there still

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

One question but looks great to me.

@tgross35 tgross35 enabled auto-merge (rebase) April 22, 2025 03:49
@tgross35
Copy link
Contributor

Pretty great improvements!

icount::icount_bench_fmod_group::icount_bench_fmod logspace:setup_fmod()
  Baselines:                      softfloat|softfloat
  Instructions:                     1019076|1102967              (-7.60594%) [-1.08232x]
  L1 Hits:                          1021275|1105168              (-7.59097%) [-1.08215x]
  L2 Hits:                                2|1                    (+100.000%) [+2.00000x]
  RAM Hits:                              11|10                   (+10.0000%) [+1.10000x]
  Total read+write:                 1021288|1105179              (-7.59072%) [-1.08214x]
  Estimated Cycles:                 1021670|1105523              (-7.58492%) [-1.08207x]
icount::icount_bench_fmodf128_group::icount_bench_fmodf128 logspace:setup_fmodf128()
  Baselines:                      softfloat|softfloat
  Instructions:                    30701786|31329198             (-2.00264%) [-1.02044x]
  L1 Hits:                         30717679|31363321             (-2.05859%) [-1.02102x]
  L2 Hits:                                4|4                    (No change)
  RAM Hits:                              38|38                   (No change)
  Total read+write:                30717721|31363363             (-2.05859%) [-1.02102x]
  Estimated Cycles:                30719029|31364671             (-2.05850%) [-1.02102x]
icount::icount_bench_fmodf16_group::icount_bench_fmodf16 logspace:setup_fmodf16()
  Baselines:                      softfloat|softfloat
  Instructions:                       50124|84006                (-40.3328%) [-1.67596x]
  L1 Hits:                            56766|100646               (-43.5984%) [-1.77300x]
  L2 Hits:                                4|1                    (+300.000%) [+4.00000x]
  RAM Hits:                              15|17                   (-11.7647%) [-1.13333x]
  Total read+write:                   56785|100664               (-43.5896%) [-1.77272x]
  Estimated Cycles:                   57311|101246               (-43.3943%) [-1.76661x]
icount::icount_bench_fmodf_group::icount_bench_fmodf logspace:setup_fmodf()
  Baselines:                      softfloat|softfloat
  Instructions:                      151547|186691               (-18.8247%) [-1.23190x]
  L1 Hits:                           153748|188893               (-18.6058%) [-1.22859x]
  L2 Hits:                                1|1                    (No change)
  RAM Hits:                              10|9                    (+11.1111%) [+1.11111x]
  Total read+write:                  153759|188903               (-18.6043%) [-1.22857x]
  Estimated Cycles:                  154103|189213               (-18.5558%) [-1.22783x]

@tgross35 tgross35 merged commit 2dc292b into rust-lang:master Apr 22, 2025
35 checks passed
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.

2 participants