pgsql: Optimize pg_popcount() with AVX-512 instructions.

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема pgsql: Optimize pg_popcount() with AVX-512 instructions.
Дата
Msg-id E1rtIkp-000uA4-Dd@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Optimize pg_popcount() with AVX-512 instructions.

Presently, pg_popcount() processes data in 32-bit or 64-bit chunks
when possible.  Newer hardware that supports AVX-512 instructions
can use 512-bit chunks, which provides a nice speedup, especially
for larger buffers.  This commit introduces the infrastructure
required to detect compiler and CPU support for the required
AVX-512 intrinsic functions, and it adds a new pg_popcount()
implementation that uses these functions.  If CPU support for this
optimized implementation is detected at runtime, a function pointer
is updated so that it is used by subsequent calls to pg_popcount().

Most of the existing in-tree calls to pg_popcount() should benefit
from these instructions, and calls with smaller buffers should at
least not regress compared to v16.  The new infrastructure
introduced by this commit can also be used to optimize
visibilitymap_count(), but that is left for a follow-up commit.

Co-authored-by: Paul Amonson, Ants Aasma
Reviewed-by: Matthias van de Meent, Tom Lane, Noah Misch, Akash Shankaran, Alvaro Herrera, Andres Freund, David Rowley
Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/792752af4eb5cf7b5b8b0470dbf22901c5178fe5

Modified Files
--------------
config/c-compiler.m4                 |  58 ++++++++
configure                            | 252 +++++++++++++++++++++++++++++++++++
configure.ac                         |  51 +++++++
meson.build                          |  87 ++++++++++++
src/Makefile.global.in               |   5 +
src/include/pg_config.h.in           |  12 ++
src/include/port/pg_bitutils.h       |  11 ++
src/makefiles/meson.build            |   4 +-
src/port/Makefile                    |  11 ++
src/port/meson.build                 |   6 +-
src/port/pg_bitutils.c               |   5 +
src/port/pg_popcount_avx512.c        |  81 +++++++++++
src/port/pg_popcount_avx512_choose.c |  88 ++++++++++++
src/test/regress/expected/bit.out    |  24 ++++
src/test/regress/sql/bit.sql         |   4 +
15 files changed, 696 insertions(+), 3 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: pgsql: Fix if/while thinko in read_stream.c edge case.
Следующее
От: Nathan Bossart
Дата:
Сообщение: pgsql: Optimize visibilitymap_count() with AVX-512 instructions.