perf: Don't do fused-multiply-add on scalars#27479
Merged
ritchie46 merged 3 commits intopola-rs:mainfrom May 4, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27479 +/- ##
==========================================
+ Coverage 81.34% 81.63% +0.29%
==========================================
Files 1838 1840 +2
Lines 254455 254672 +217
Branches 3180 3180
==========================================
+ Hits 206978 207894 +916
+ Misses 46653 45954 -699
Partials 824 824 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
Could this bug be triggered? I would expect this to be hit. Can we add a test. |
JakubValtar
reviewed
May 2, 2026
This reverts commit 6155961.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If both the inputs to the multiply are scalars it doesn't make much sense to do the optimization. I also refactored the optimization code a bit to be cleaner, and made the FMA code work on scalar columns directly rather than materializing to series.
I also spotted a pretty bad bug where FMA wasn't
a * b + cbut rathera + b * c, but elsewhere in the code we assumed it wasa * b + c: https://github.com/orlp/polars/blob/no-scalar-fma/crates/polars-plan/src/plans/conversion/ir_to_dsl.rs#L1021. So I've made it consistent with the typicala * b + c.