Re: Auto-vectorization speeds up multiplication of large-precision numerics

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Khandekar <amitdkhan.pg@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-07T01:44:15Z
Lists: pgsql-hackers
Amit Khandekar <amitdkhan.pg@gmail.com> writes:
> I did as above. Attached is the v2 patch.

I made some cosmetic changes to this and committed it.  AFAICT,
there's no measurable performance change to the "numeric" regression
test, but I got a solid 45% speedup on "numeric_big", so it's
clearly a win for wider arithmetic cases.

It seemed to me to be useful to actually rename CFLAGS_VECTOR
if we're changing its meaning, so I made it CFLAGS_VECTORIZE.

			regards, tom lane



Commits

  1. Use plain memset() in numeric.c, not MemSet and friends.

  2. Frob numeric.c loop so that clang will auto-vectorize it too.

  3. Apply auto-vectorization to the inner loop of numeric multiplication.

  4. Split Makefile symbol CFLAGS_VECTOR into two symbols.