|
inlineconstexpr |
Defined in Header
wide<tuple>
yet.Compression in simd is moving selected elements to the front of the simd_value. Unfortunately, not for all simd_value
, not for all plaftorms that can be done efficiently. So the operation splits the input into chunks for which it's possible.
The function perfoms the following steps: 1) splits the simd_value and mask into chunks, that can be processed in one go. This depends on what instructions are availiable. 2) Each chunk, gets shuffled in a way that moves selected elements (mask == true) to the front. The tail of the resulting value is unspecified. [a, b, c, d], (false, true, false, true) -> [b, d, _, _] 3) For each chunk we also compute how many elements are selected. (in the example - 2). 4) Both shuffled chunk and a number are put in a kumi::tuple<simd_value, std::ptrdiff_t>
TODO: there is a bug where sometimes it's an int
and not std::ptrdiff_t
. 5) Those chunks are combined together in another tuple.
List of people who's work was instrumental for building this:
@aqrit
user on Stack OverflowThroughout the code of compress there are references to what was taken from where as well as explanations.
Parameters
[]
. Ignored elements are treated as not selected.Return value
kumi::tuple<kumi::tuple<simd_value, std::ptrdiff_t>, ...>
- tuple of compressed chunks, constructed as described earlier.