Comment

Comment by dragontamer

Avx512 probably needs bpermute for parity with GPU shared memory.

Arbitrary swizzles both in the forward permute (currently in AVX512) and backwards direction (GPU only) is as necessary and proper as gather + scatter. Any program that uses one is highly likely to use the other.

--------

Butterfly permutes should be especially accelerated, as that pattern continues to show up. It seems like arbitrary permutes / bpermutes are expensive to implement in hardware, but butterfly permutes are the fundamental building block.

Butterfly permutes are needed from FFT to scan/prefix sum operations. It's also fundamental (and simpler at the hardware level than arbitrary bpermute/permute)

AMD implements the butterfly permute in DPP instructions. NVidia provides a simple shfl.bfly PTX instruction.

Butterfly networks (and inverse butterfly) are how pdep and pext are implemented under the hood. http://palms.ee.princeton.edu/PALMSopen/hilewitz06FastBitCom...

-----------

IIRC,the butterfly / inverse butterfly network can implement any arbitrary permute in just log2(n) steps.

parent dragontamer 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton