E.V.E
v2023.02.15
Loading...
Searching...
No Matches
Core functions

Detailed Description

Core functions.

This module provides implementation for various fundamental functions

Contents

 Accuracy helpers
 Arithmetic operations
 Bitwise functions
 Compress functions
 Constants
 Builds a floating-point constant from the exact representation it must take in each precision.
 Conversions
 Decorators
 Fused multiply add family
 IEEE operations
 Logical operations
 Named Shuffles
 Predicates
 Reductions
 SIMD Specific Operations

Variables

constexpr callable_deinterleave_groups_ eve::deinterleave_groups = {}
 Callabe object that deinterleaves values in n wides.
constexpr callable_rotate_ eve::rotate = {}
 rotates two halves of the register by a chosen number of elements.
constexpr callable_try_each_group_position_ eve::try_each_group_position = {}
 For a given simd_value and a group size returns a tuple of (x::size() / group_size) permuatitions for this register such that each group will be in each position exactly once.

Variable Documentation

◆ deinterleave_groups

callable_deinterleave_groups_ eve::deinterleave_groups = {}
inlineconstexpr

Callabe object that deinterleaves values in n wides.

This is a generalization of deinterleave_groups_shuffle for n wides.

The different name comes from for 2 wides - this returns a tuple of 2 wides and a shuffle returns an aggregate

First parameter is fixed<N> group_size - how many elements we consider one element After that you pass n simd values. Together those n simd values have interleaved values. We return a tuple of wides, where all values are separated between individual wides.

NOTE: you can think of this function as AoS to SoA, where all fields have the same size. group is the size of the field in wide elements.

Examples (one letter is a group - first parameter, group order is preserved): ABAB'ABAB ABAB'ABAB => [AAAA'AAAA BBBB'BBBB] ABCA BCAB CABC => [AAAA BBBB CCCC] ABCD'EABC DEAB'CDEA BCDE'ABCD EABC'DEA BCDE'ABCD => [Ax8 Bx8 Cx8 Dx8 Ex8]

Required header: #include <eve/module/core.hpp>

◆ rotate

callable_rotate_ eve::rotate = {}
inlineconstexpr

rotates two halves of the register by a chosen number of elements.

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<simd_value T, std::ptrdiff_t M>
T rotate(T x, index<N> const &) noexcept;
constexpr callable_rotate_ rotate
rotates two halves of the register by a chosen number of elements.
Definition rotate.hpp:59
EVE Main Namespace.
Definition abi.hpp:19

Parameters

  • x : simd value to rotate
  • M : position of the middle. In std::rotate(f, m, l) -> this is std::distance(f, m);

Return value

Return T which is a permutation of x such that elements x[M: T::size()) come first followed by x[0:M) and the relative order in those halves is preserved.

Example

#include <iostream>
#include <eve/module/core.hpp>
int main()
{
wide_it x = {1, 2, 3, 4};
std::cout << "---- simd" << '\n'
<< "<- x = " << x << '\n'
<< "-> rotate(x, eve::index<0>) = " << eve::rotate(x, eve::index<0>) << '\n'
<< "-> rotate(x, eve::index<1>) = " << eve::rotate(x, eve::index<1>) << '\n'
<< "-> rotate(x, eve::index<2>) = " << eve::rotate(x, eve::index<2>) << '\n'
<< "-> rotate(x, eve::index<3>) = " << eve::rotate(x, eve::index<3>) << '\n'
<< "-> rotate(x, eve::index<4>) = " << eve::rotate(x, eve::index<4>) << '\n';
}
Wrapper for SIMD registers.
Definition wide.hpp:94

◆ try_each_group_position

callable_try_each_group_position_ eve::try_each_group_position = {}
inlineconstexpr

For a given simd_value and a group size returns a tuple of (x::size() / group_size) permuatitions for this register such that each group will be in each position exactly once.

This is useful when one needs to try each element against something. Motivational example could be intersection: try each element from one register against another. Groups allow you to treat N elements as one.

We took the idea for the operation from: "Faster-Than-Native Alternatives for x86 VP2INTERSECT Instructions" by Guillermo Diez-Canas. Link: https://arxiv.org/abs/2112.06342

Parameters

Return value

kumi::tuple of all results

Example

#include <iostream>
#include <eve/module/core.hpp>
int main()
{
wide_it x = {1, 2, 3, 4};
std::cout << "---- simd" << '\n'
<< "<- x = " << x << '\n'
<< "-> try_each_group_position(x, eve::lane<1>) = " << eve::try_each_group_position(x, eve::lane<1>) << '\n'
<< "-> try_each_group_position(x, eve::lane<2>) = " << eve::try_each_group_position(x, eve::lane<2>) << '\n';
}
constexpr callable_try_each_group_position_ try_each_group_position
For a given simd_value and a group size returns a tuple of (x::size() / group_size) permuatitions for...
Definition try_each_group_position.hpp:51