Get the latest tech news

SIMD Binary Heap Operations


heap is a binary tree data structure having some interesting properties. One of them is an array-friendly memory layout, achieved by building (almost) complete binary tree.

Vector mask is converted into a bitmask ( 0b0011_1110) and the number of leading zeroes uniquely identifies the shuffle pattern. In the worst case a scalar code execute log 2 n memory loads, comparisons and swaps. My experiments on quite decent Ice Lake machine showed 10x slowdowns, which makes this approach unpractical (although it is nice).

Get the Android app

Or read this on Hacker News