gh-153740: Optimize PyFloat_Pack/Unpack2 using native _Float16 - #154796
Conversation
|
Not sure how to fix this error: CC @StanFromIreland (fuzzers) |
|
The configure probe only tests a compile-time |
46fe384 to
8bda53a
Compare
Good idea, that works. |
|
🤖 New build scheduled with the buildbot fleet by @skirpichev for commit ac38cb8 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F154796%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Co-authored-by: hpkfft.com <paul@hpkfft.com>
|
@skirpichev: Did you close your PR on purpose? |
Yes, this lacks benchmarks. I hope someone will continue this. |
|
@hpkfft, maybe you can check performance for a simple pyperf-based benchmark? import pyperf
from struct import pack, unpack
x = 3.140625
bx = struct.pack('e', x)
runner = pyperf.Runner()
runner.bench_func('pack("e", 3.140625)', pack, "e", x)
runner.bench_func('unpack("e", b"HB")', unpack, "e", bx) |
|
Using gcc 14.2.0 and Using Interesting. Does the training input for PGO have NaNs in it? If so, maybe it shouldn't.... |
Yes, PGO set of tests lacks test_capi, but test_struct.py is selected (see Lib/test/libregrtest/pgo.py). That one has various tests, including half-float NaNs. You can filter out some tests for PGO by Apparently, CPython runtime overhead dominated in the above benchmark. For C code I got ~2x speedup, like you above. I'll try to repeat that with some benchmarking framework. Anyway, lets reopen this. |
vstinner
left a comment
There was a problem hiding this comment.
Ah good, the new code (since my previous review) is way shorter. Its size is now more acceptable to me.
Co-authored-by: Victor Stinner <vstinner@python.org>
|
Merged, thanks. |
|
I didn't close #153740 since it seems like more changes are planned. |
|
Benchmarks: