Optimize visibilitymap_count() with AVX-512 instructions.
Nathan Bossart <nathan@postgresql.org>
Optimize visibilitymap_count() with AVX-512 instructions. Commit 792752af4e added infrastructure for using AVX-512 intrinsic functions, and this commit uses that infrastructure to optimize visibilitymap_count(). Specificially, a new pg_popcount_masked() function is introduced that applies a bitmask to every byte in the buffer prior to calculating the population count, which is used to filter out the all-visible or all-frozen bits as needed. Platforms without AVX-512 support should also see a nice speedup due to the reduced number of calls to a function pointer. Co-authored-by: Ants Aasma Discussion: https://postgr.es/m/BL1PR11MB5304097DF7EA81D04C33F3D1DCA6A%40BL1PR11MB5304.namprd11.prod.outlook.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/heap/visibilitymap.c | modified | +5 −20 |
| src/include/port/pg_bitutils.h | modified | +34 −0 |
| src/port/pg_bitutils.c | modified | +126 −0 |
| src/port/pg_popcount_avx512.c | modified | +60 −0 |
Discussion
- Popcount optimization using AVX512 173 messages · 2023-11-02 → 2024-11-07