Re: Auto-vectorization speeds up multiplication of large-precision numerics
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Amit Khandekar <amitdkhan.pg@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-06-09T22:50:26Z
Lists: pgsql-hackers
On 2020-06-09 13:50, Amit Khandekar wrote:
> Also, the regress/sql/numeric_big test itself speeds up by 80%
That's nice. I can confirm the speedup:
-O3 without the patch:
numeric ... ok 737 ms
test numeric_big ... ok 1014 ms
-O3 with the patch:
numeric ... ok 680 ms
test numeric_big ... ok 580 ms
Also:
-O2 without the patch:
numeric ... ok 693 ms
test numeric_big ... ok 1160 ms
-O2 with the patch:
numeric ... ok 677 ms
test numeric_big ... ok 917 ms
So the patch helps either way. But it also seems that without the
patch, -O3 might be a bit slower in some cases. This might need more
testing.
> For the for loop to be auto-vectorized, I had to simplify it to
> something like this :
Well, how do we make sure we keep it that way? How do we prevent some
random rearranging of the code or some random compiler change to break
this again?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Use plain memset() in numeric.c, not MemSet and friends.
- 3438c988fd75 14.0 landed
-
Frob numeric.c loop so that clang will auto-vectorize it too.
- 9c79e646c6f0 14.0 landed
-
Apply auto-vectorization to the inner loop of numeric multiplication.
- 88709176236c 14.0 landed
-
Split Makefile symbol CFLAGS_VECTOR into two symbols.
- 695de5d1eda6 14.0 landed