‹ BackHN Continuity

Thread

Vectorized and performance-portable Quicksort (2022)

174 points · 31 comments · mococa

  1. minitech · · focus · HN ↗
    Actual title: “Vectorized and performance-portable Quicksort” (2022).

    Actual sense in which it’s first:

    > Happily, modern instruction sets (Arm SVE, RISC-V V, x86 AVX-512) include a special instruction suitable for partitioning. Given a separate input of yes/no values (whether an element is less than the pivot), this "compress-store" instruction stores to consecutive memory only the elements whose corresponding input is "yes". We can then logically negate the yes/no values and apply the instruction again to write the elements to the other partition. This strategy has been used in an AVX-512-specific Quicksort. But what about other instruction sets such as AVX2 that don't have compress-store? Previous work has shown how to emulate this instruction using permute instructions.

    > We build on these techniques to achieve the first vectorized Quicksort that is portable to six instruction sets across three architectures, and in fact outperforms prior architecture-specific sorts.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.