hardware pext/pdep can in some cases be slower than a software fallback. so the fact that bmi2 instruction set is supported does not always mean that using pext/pdep is profitable. it might be reasonable to add separate check which excludes amd cpus before zen3 to use this instruction
this is how it is currently done, it always selects _pext_u64, even though there is already a fallback implementation nearby:
https://github.com/vortex-data/vortex/blob/develop/vortex-array/src/arrays/bool/compute/filter.rs#L93-L100
https://github.com/vortex-data/vortex/blob/develop/vortex-array/src/arrays/bool/compute/filter.rs#L103-L119
there is similar dispatch in the fastlanes bit transpose code and in several places using pdep:
https://github.com/vortex-data/vortex/blob/develop/encodings/fastlanes/src/bit_transpose/x86.rs#L25-L30
https://github.com/vortex-data/vortex/blob/develop/vortex-mask/src/intersect_by_rank.rs#L393-L431
note: i didn't do any benchmarks yet, but this is source of truth about the performance of these instructions i checked before opening this issue:
https://uops.info/html-instr/PEXT_R32_R32_M32.html
https://uops.info/html-instr/PEXT_R64_R64_R64.html
https://docs.rs/succinctly/latest/src/succinctly/json/simd/bmi2.rs.html#1-16
hardware
pext/pdepcan in some cases be slower than a software fallback. so the fact thatbmi2instruction set is supported does not always mean that usingpext/pdepis profitable. it might be reasonable to add separate check which excludes amd cpus before zen3 to use this instructionthis is how it is currently done, it always selects
_pext_u64, even though there is already a fallback implementation nearby:https://github.com/vortex-data/vortex/blob/develop/vortex-array/src/arrays/bool/compute/filter.rs#L93-L100
https://github.com/vortex-data/vortex/blob/develop/vortex-array/src/arrays/bool/compute/filter.rs#L103-L119
there is similar dispatch in the
fastlanesbit transpose code and in several places usingpdep:https://github.com/vortex-data/vortex/blob/develop/encodings/fastlanes/src/bit_transpose/x86.rs#L25-L30
https://github.com/vortex-data/vortex/blob/develop/vortex-mask/src/intersect_by_rank.rs#L393-L431
note: i didn't do any benchmarks yet, but this is source of truth about the performance of these instructions i checked before opening this issue:
https://uops.info/html-instr/PEXT_R32_R32_M32.html
https://uops.info/html-instr/PEXT_R64_R64_R64.html
https://docs.rs/succinctly/latest/src/succinctly/json/simd/bmi2.rs.html#1-16