You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Count the bits set in each element of an integer batch. The common
kernel is the SWAR fold; x86 uses the PSHUFB nibble lookup from SSSE3
up, NEON uses CNT with pairwise widening adds, SVE uses svcnt_x, and
WASM uses i8x16.popcnt with pairwise widening extends, folding 32-bit
counts with a shift-and-add pair for 64-bit elements. VSX and VXE use
vec_popcnt, which the compiler maps to a single VPOPCNTB/H/W/D or
VPOPCT.
For 64-bit elements the two x86 nibble tables carry a +4 and a -4 bias,
after libpopcnt, so PSADBW yields the byte count and the 8-byte sum in
one instruction. This drops the VPADDB, and measures 1.09x on SSE and
AVX2 and 1.05x on AVX-512.
avx512vnni gains a 32-bit kernel: VPDPBUSD does in one uop what the
VPMADDUBSW and VPMADDWD pair does in two, and the zero accumulator is
free because the register copy is eliminated at rename. This measures
1.14x. The same substitution on 256-bit vectors is neutral, since three
ports serve them, so avxvnni gets no kernel.
The CI job labelled avx512vnni built for knm, which enables
avx5124vnniw rather than avx512vnni and selected the avx512pf arch, so
it covered neither kernel. It now builds for cascadelake.
Assisted-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments