Uh oh!
There was an error while loading. Please reload this page.
Including FastFloat in parsing process - #62301
Conversation
ghost
commented
Dec 2, 2021
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsThis PR is a contribution to runtime regarding issue ##48646 to insert Lemire's Fast-float algorithm to doube/single/half parsing process. Steps in the draft will be :
|
EgorBo
commented
Dec 3, 2021
Awesome! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
CarlVerret
commented
Dec 3, 2021
yes, it looks like something' trying to read above 19 digits... |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…oFloatingPointBits.cs Co-authored-by: Günther Foidl <gue@korporal.at>
…oFloatingPointBits.cs Co-authored-by: Günther Foidl <gue@korporal.at>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lemire
commented
Dec 6, 2021
A lot of the original code has been transformed to look like heap allocations ( https://github.com/CarlVerret/csFastFloat/blob/master/csFastFloat/Constants/Constants.cs I am no C# expert but representing constant arrays as heap-allocated content seems likely to trigger heap allocations during the execution of the code which will surely harm the performance. Of course, maybe this gets optimized away. But are we sure it is the case? |
tannergooding
commented
Dec 6, 2021
@lemire is correct and these should stay as |
lemire
commented
Dec 6, 2021
Reading the comments, I understand that @EgorBo suggested writing the code for the upcoming language support. Of course, this might imply that the current draft PR should be expected to have suboptimal performance with the current language support. |
…Verret/runtime into 48646-FastFloat-integration
This reverts commit 1b5fd51.
I ran existing benchmarks on both double and float : comparing main branch with this PR |
stephentoub
commented
Dec 7, 2021
I agree with @tannergooding and @lemire that we should stick with static readonly array fields until compiler support is actually in place. At that point, there are many other places we'll be updating, and we can just update these as part of that. |
Uh oh!
There was an error while loading. Please reload this page.
CarlVerret
commented
Feb 3, 2022
Thank you Tanner. It has been a nice learning occasion for me. |
tannergooding
commented
Feb 4, 2022
Thank you as well, excited to get this in once CI is passing (the OSX failure was unrelated; I've not looked at the other 2 yet). |
CarlVerret
commented
Feb 7, 2022
is there something I can do to help with failing checks ? |
tannergooding
commented
Feb 7, 2022
We need to ensure they aren't related and ideally get CI passing. It looks like there is an arm32 timeout that should have been resolved in #63357 If you push a merge commit integrating the current I'm decently confident that the remaining failures are not related to your changes here and are instead CI issues on our side, so I can also take care of pushing the relevant merge commit if you would prefer |
danmoseley
commented
Feb 7, 2022
Simply clicking close then reopen will restart validation on rebased code of course. Assuming no conflicts. |
danmoseley
commented
Feb 7, 2022
@tannergooding historically you ran I think an extra JavaScript test corpus - is that necessary too? |
tannergooding
commented
Feb 7, 2022
@danmoseley, those run implicitly now: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Runtime/tests/System/DoubleTests.cs#L378-L419 There are always more test suites we could run on top, but I wouldn't expect they would catch anything additional here.
I've seen issues with that in the past and have found pushing a merge commit to be much more reliable. |
CarlVerret
commented
Feb 7, 2022
just to make sure I'm doing the right thing here : you mean pulling the main into my branch then push back my branch to update this PR? |
tannergooding
commented
Feb 7, 2022
Right, something roughly equivalent to: Where |
tannergooding
commented
Feb 8, 2022
OSX failures are #65000. Going to merge this, thanks a lot for the contribution @CarlVerret (and @lemire for the original algorithm/base implementation)! |
CarlVerret
commented
Feb 8, 2022
@tannergooding maybe just a little question regarding this PR. Will this contribution be available only for a future version (7.x) of the .net core framework or it will be also included for previous versions ? (5.x, 6.x, etc...) Is there an ETA for a public release of the runtime including this PR ? |
tannergooding
commented
Feb 8, 2022
Only on future versions of .NET (7.x and later), we don't tend to backport perf improvements to past releases (even LTS) due to the risk. This should be available in nightly runtime builds as soon as later today (https://github.com/dotnet/runtime/blob/main/docs/project/dogfooding.md has some more info on how to try out nightly builds) and in the nightly SDK likely in a few days (same link has info on this as well). It should ship publicly in .NET 7 Preview 2 |
CarlVerret
commented
Feb 8, 2022
Fine, thanks! I was asking because csFastFloat was built upon .net core 5 and I'd like to run my benchmarks again to compare with 7.x. The goal is to evaluate the impact of another contribution we might suggest for the parsing process. |
danmoseley
commented
Feb 8, 2022
I probably missed it, but do the inputs to our existing benchmarks in dotnet/performance suffice here? Or should we extend with some of the inputs that proved this change? (your point taken about functional tests) |
tannergooding
commented
Feb 8, 2022
There are lots of improvements we could potentially make to the perf tests, but the current should be at least somewhat representative. I'd be more interested in what things like ML.NET show with this change. |
Nice improvements: dotnet/perf-autofiling-issues#3531 and dotnet/perf-autofiling-issues#3543 cc @CarlVerret |
tannergooding
commented
Feb 15, 2022
Noting that the improvement is for long strings and is going from 300ns to 100ns while the regression is for a short string and is going from 35ns to 37ns. This regression is acceptable, but we should do some minimal investigation to see what is slower here (its probably just a branch or some other minor thing and if its trivially "fixable", then we should do so; but its not worth spending a lot of time on it). |
CarlVerret
commented
Feb 15, 2022
While programming the PR, i've tried to identify what could cause this little regression without any luck. I am really interested if you can provide some insight on how to fix that kind of variation. |
tannergooding
commented
Feb 15, 2022
I'll run this through AMD uProf (https://developer.amd.com/amd-uprof/) and see if I can see anything interesting. |
This PR adds a new fast path to the processing of the floating-point numbers. It is used when the existing fast path (Clinger's) fails to apply, but before the existing 'slow path' is used. There's a corresponding issue ##48646.
To assess the performance effect, we have three realistic data sets (canada.txt, mesh.txt and synthetic.txt).
The mesh.txt data set is a scenario where we rely on Clinger's fast path so we would not expect this PR to improve performance in that case. And indeed, we see no significant difference.
For canada.txt and synthetic.txt, this PR brings substantial gains: about 2x. Further gains are possible as demonstrated by the csFastFloat library, but they would be maybe more invasive and are maybe best done by distinct pull requests.
links :
csFastFloat repo : https://github.com/CarlVerret/csFastFloat
Test data can be found here : https://github.com/CarlVerret/csFastFloat/tree/master/Benchmark/data
Benchmarks had been executed on my personnal computer
Intel Core i5-5900 2.90GHz / 12 GB Ram
under Windows 11
@EgorBo@tannergooding@lemire