E.V.E
v2023.02.15
Loading...
Searching...
No Matches
Type traits

Detailed Description

Type traits for SIMD related types and functions.

Computes the expected width of a given type.

Computes the maximum native width of a given type.

Computes the width of a given type.

Computes the fundamental width of a given type.

Using EVE types and functions may require information about some properties of the processed types that are accessible through the following traits.

Convenience header:

#include <eve/traits.hpp>

Required header: #include <eve/traits/iteartor_width.hpp>

Note
For aligned_ptr we return expected_width.

Returns a width for a relaxed iterator/range. If T defines a nested static constexpr function iterator_width() (which should return a eve::width_type)

  • returns the value.
  • returns expected_width_v<value_type_t<T>> otherwise.
Template Parameters
TypeType of value to assess

Required header: #include <eve/traits/width.hpp>

For a given type T, computes it's associated width.

Template Parameters
TType to process

Required header: #include <eve/traits/width.hpp>

Computes the width of the smallest register able to store values of type Type for a given SIMD ABI with no uninitialized lanes.

Template Parameters
TypeType of value to assess
ABISIMD ABI to use as reference. Must models eve::regular_abi.

Required header: #include <eve/traits/width.hpp>

Returns the width of the largest native register able to store values of type Type for a given SIMD ABI.

Template Parameters
TypeType of value to assess
ABISIMD ABI to use as reference. Must models eve::regular_abi.

Required header: #include <eve/traits/width.hpp>

Default register width for a type. Sometimes is smaller than max_native_width.

See also
Frequency Scaling for an explanation.
Template Parameters
TypeType of value to assess
ABISIMD ABI to use as reference. Must models eve::regular_abi.

Classes

struct  eve::as< T >
 Lightweight type-wrapper. More...
struct  eve::as_element< T >
 Lightweight type-wrapper over element type. More...
struct  eve::common_compatible< Ts >
 Computes the type compatible with a list of values. More...
struct  eve::common_type< Ts >
 Computes a type that can represent all values in a list of types. More...
struct  eve::comparisons< T >
 Extension point for ordering and equality computation. More...
struct  eve::element_type< T >
 Extracts the scalar part of a type. More...
struct  eve::underlying_type< Ts >
 Computes the most scalar type associated with a type. More...

Concepts

concept  eve::same_lanes_or_scalar
 Checks that all types Ts are either scalar or share a common number of lanes.
concept  eve::same_lanes_or_scalar_tuple
 Checks that all types within a product type are either scalar or share a common number of lanes.
concept  eve::same_lanes
 Checks that all SIMD types Ts share a common number of lanes.
concept  eve::same_types
 Checks that all types Ts are scalars of a single type U or simd_values sharing the same lane count and of element type U.
concept  eve::same_types_tuple
 Checks that all types within a product type are scalars of a single type U or simd_values sharing the same lane count and of element type U.

Typedefs

template<typename T>
using eve::value_type_t = typename decltype(_::value_type_impl<T>())::type
 A meta function for getting an associated value_type for a relaxed iterator/range.
template<typename T>
using eve::wide_value_type_t = as_wide_t<value_type_t<T>, iterator_width_v<T>>

Variables

template<typename Type, width_type Lanes>
using eve::abi_t
 Find proper ABI type for Type/Lanes pair.
template<typename Type, width_type N, typename ABI>
using eve::as_register_t
 Find proper register type for Type/Lanes/ABI triplet.
template<typename Type, width_type N, typename ABI>
using eve::as_logical_register_t
 Find proper logical register type for Type/Lanes/ABI triplet.
template<typename T>
constexpr std::size_t eve::max_scalar_size_v
 A meta function for getting a maximum size of scalar.

Typedef Documentation

◆ value_type_t

template<typename T>
using eve::value_type_t = typename decltype(_::value_type_impl<T>())::type

A meta function for getting an associated value_type for a relaxed iterator/range.

Template Parameters
TType to process

value_type_t<T> is computed as follows:

  • If T has begin/end - value_type_t for return type of begin
  • If T is std::iterator -> returns iterator_traits<T>::value_type
  • If T has nested value_type -> returns it
  • If T is a product type and all elements have value_type_t defined for them -
  • kumi::tuple for the individual product types.
  • Otherwise it's undefined.
Template Parameters
TType to process

Required header: #include <eve/traits.hpp>

◆ wide_value_type_t

template<typename T>
using eve::wide_value_type_t = as_wide_t<value_type_t<T>, iterator_width_v<T>>
Template Parameters
TType to process

Required header: #include <eve/traits/wide_value_type.hpp>, #include <eve/traits.hpp>

template<typename T>
using wide_value_type_t = as_wide_t<value_type_t<T>, iterator_width_v<T>>
as_wide_t< value_type_t< T >, iterator_width_v< T > > wide_value_type_t
Definition wide_value_type.hpp:33

Variable Documentation

◆ abi_t

template<typename Type, width_type Lanes>
using eve::abi_t

Find proper ABI type for Type/Lanes pair.

Computes the best ABI to use to efficiently store Lanes elements of type Type in order to use SIMD implementations and returns it's type.

Template Parameters
TypeType of the element to store
LanesNumber of elements to store

◆ as_logical_register_t

template<typename Type, width_type N, typename ABI>
using eve::as_logical_register_t

Find proper logical register type for Type/Lanes/ABI triplet.

Computes the correct logical register to use to efficiently store Lanes elements of type Type in the given ABI and returns it's type.

Template Parameters
TypeType of the element to store
LanesNumber of elements to store
ABICurrent ABI of the plateform

◆ as_register_t

template<typename Type, width_type N, typename ABI>
using eve::as_register_t

Find proper register type for Type/Lanes/ABI triplet.

Computes the correct register to use to efficiently store Lanes elements of type Type in the given ABI and returns it's type.

Template Parameters
TypeType of the element to store
LanesNumber of elements to store
ABICurrent ABI of the plateform

◆ max_scalar_size_v

template<typename T>
std::size_t eve::max_scalar_size_v
constexpr
Initial value:
= kumi::max_flat( kumi::as_tuple_t<T>{}
, [](auto m) { return sizeof(m); }
)
constexpr max_flat_t max_flat

A meta function for getting a maximum size of scalar.

Template Parameters
TType to process
   For a product type returns max size of individual fields.
   Otherwise returns sizeof(T)

Required header: #include <eve/traits/max_scalar_size.hpp>, #include <eve/traits.hpp>