|
vir-simd 0.4.189
Parallelism TS 2 extensions and simd fallback implementation
|
This namespace collects libraries and tools authored by Matthias Kretz. More...
Namespaces | |
| namespace | execution |
| namespace | simd_permutations |
| Predefined permutations. | |
Classes | |
| struct | as_pair |
Defines the member type type to a std::pair specialization matching the non-static data members of T. More... | |
| struct | as_tuple |
Defines the member type type to a std::tuple specialization matching the non-static data members of T. More... | |
| struct | constexpr_wrapper |
| class | simd_tuple< T, N > |
simd-like interface for tuples of vectorized data members of T. More... | |
| struct | simd_version_t |
| Represents the vir-simd version of major, minor, and patchlevel components. More... | |
| struct | simdize_size |
| class | vectorized_struct< T, N > |
Concepts | |
| concept | arithmetic |
| This concept matches the core language defintion of an arithmetic type. | |
| concept | vectorizable |
Satisfied for all arithmetic types except bool. | |
| concept | simd_abi_tag |
Satisfied if T is a SIMD ABI tag. | |
| concept | any_simd |
Satisfied if V is a (valid) specialization of simd<T, Abi>. | |
| concept | any_simd_mask |
Satisfied if V is a (valid) specialization of simd_mask<T, Abi>. | |
| concept | any_simd_or_mask |
Satisfied if V is either a simd or a simd_mask. | |
| concept | typed_simd |
Satisfied if V is a simd<T, Abi> with arbitrary but valid ABI tag Abi. | |
| concept | sized_simd |
Satisfied if V is a simd with the given size Width. | |
| concept | sized_simd_mask |
Satisfied if V is a simd_mask with the given size Width. | |
| concept | vectorizable_struct_template |
A type T is a vectorizable struct template if all of its data members can be vectorized via template argument simdization. | |
| concept | vectorizable_struct |
| concept | reflectable_struct |
Satisfied if T can be used with the following functions and types. | |
Typedefs | |
| template<typename T, int N = 0> | |
| using | simdize = typename detail::simdize_impl<T, N>::type |
| Apply a type transformation to a scalar type to produce a data-parallel type. | |
| template<std::size_t N, reflectable_struct T> | |
| using | struct_element_t = std::remove_reference_t<decltype(struct_get<N>(std::declval<T &>()))> |
struct_element_t<N, T> is an alias for the type of the N -th non-static data member of T. | |
| template<typename T> | |
| using | as_tuple_t = typename as_tuple<T>::type |
Alias for a std::tuple specialization matching the non-static data members of T. | |
| template<typename T> | |
| using | as_pair_t = typename as_pair<T>::type |
Alias for a std::pair specialization matching the non-static data members of T. | |
Functions | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It, typename F> | |
| constexpr void | for_each (ExecutionPolicy pol, It first, It last, F &&fun) |
| Iterate over the given range (iterator overload). | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range R, typename F> | |
| constexpr void | for_each (ExecutionPolicy pol, R &&rng, F &&fun) |
| Iterate over the given range (range overload). | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator OutIt, typename UnaryOperation> | |
| constexpr OutIt | transform (ExecutionPolicy pol, It1 first1, It1 last1, OutIt d_first, UnaryOperation unary_op) |
| Unary transform (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator It2, detail::simd_execution_iterator OutIt, typename BinaryOperation> | |
| constexpr OutIt | transform (ExecutionPolicy pol, It1 first1, It1 last1, It2 first2, OutIt d_first, BinaryOperation binary_op) |
| Binary transform (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range R1, detail::simd_execution_range R2, typename UnaryOperation> | |
| constexpr auto | transform (ExecutionPolicy pol, R1 &&r1, R2 &d_rng, UnaryOperation unary_op) |
| Unary transform (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range R1, detail::simd_execution_range R2, detail::simd_execution_range R3, typename BinaryOperation> | |
| constexpr auto | transform (ExecutionPolicy pol, R1 &&r1, R2 &&r2, R3 &d_rng, BinaryOperation binary_op) |
| Binary transform (range overload) | |
| template<detail::simd_execution_range... Rs> | |
| constexpr auto | transform (detail::simd_execution_policy auto pol, const std::ranges::zip_view< Rs... > &rs, detail::simd_execution_range auto &&d_rg, auto op) |
| Many-input transform (zipped range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator It2, typename T> | |
| constexpr T | transform_reduce (ExecutionPolicy policy, It1 first1, It1 last1, It2 first2, T init) |
| Inner product (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It1, detail::simd_execution_iterator It2, typename T, typename BinaryReductionOp, typename BinaryTransformOp> | |
| constexpr T | transform_reduce (ExecutionPolicy policy, It1 first1, It1 last1, It2 first2, T init, BinaryReductionOp reduce_op, BinaryTransformOp transform_op) |
| As above but with user-provided transform and reduce operations (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It, typename T, typename BinaryReductionOp, typename UnaryTransformOp> | |
| constexpr T | transform_reduce (ExecutionPolicy policy, It first1, It last1, T init, BinaryReductionOp reduce_op, UnaryTransformOp transform_op) |
| Transform one input range with subsequent reduction (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rng1, detail::simd_execution_range Rng2, typename T> | |
| constexpr T | transform_reduce (ExecutionPolicy policy, Rng1 &&r1, Rng2 &&r2, T init) |
| Inner product (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rng1, detail::simd_execution_range Rng2, typename T, typename BinaryReductionOp, typename BinaryTransformOp> | |
| constexpr T | transform_reduce (ExecutionPolicy policy, Rng1 &&r1, Rng2 &&r2, T init, BinaryReductionOp reduce_op, BinaryTransformOp transform_op) |
| As above but with user-provided transform and reduce operations (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rng, typename T, typename BinaryReductionOp, typename UnaryTransformOp> | |
| constexpr T | transform_reduce (ExecutionPolicy policy, Rng &&r1, T init, BinaryReductionOp reduce_op, UnaryTransformOp transform_op) |
| Transform one input range with subsequent reduction (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It> | |
| constexpr std::iter_value_t< It > | reduce (ExecutionPolicy policy, It first, It last) |
| Sum the given range (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It, typename T> | |
| constexpr T | reduce (ExecutionPolicy policy, It first, It last, T init) |
Sum the given range with initial value init (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It, typename T, typename BinaryReductionOp> | |
| constexpr T | reduce (ExecutionPolicy policy, It first, It last, T init, BinaryReductionOp op) |
Reduce the given range with initial value init over op (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rg> | |
| constexpr std::ranges::range_value_t< Rg > | reduce (ExecutionPolicy policy, Rg &&rg) |
| Sum the given range (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rg, typename T> | |
| constexpr T | reduce (ExecutionPolicy policy, Rg &&rg, T init) |
Sum the given range with initial value init (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range Rg, typename T, typename BinaryReductionOp> | |
| constexpr T | reduce (ExecutionPolicy policy, Rg &&rg, T init, BinaryReductionOp op) |
Reduce the given range with initial value init over op (range overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_iterator It, typename F> | |
| constexpr int | count_if (ExecutionPolicy pol, It first, It last, F &&pred) |
Count the elements in the input range matching pred (iterator overload) | |
| template<detail::simd_execution_policy ExecutionPolicy, detail::simd_execution_range R, typename F> | |
| constexpr int | count_if (ExecutionPolicy pol, R &&rg, F &&pred) |
Count the elements in the input range matching pred (range overload) | |
| template<std::size_t N = 0, vir::any_simd_or_mask V, detail::index_permutation_function< V::size()> F> | |
| constexpr stdx::resize_simd_t< N==0 ? V::size() :N, V > | simd_permute (V const &v, F const idx_perm) noexcept |
Permute the elements of v using the index permutation function idx_perm. | |
| template<std::size_t N = 0, vir::vectorizable T, detail::index_permutation_function< 1 > F> | |
| constexpr std::conditional_t< N<=1, T, stdx::resize_simd_t< N==0 ? 1 :N, stdx::simd< T > > > | simd_permute (T const &v, F const idx_perm) noexcept |
| Overload for scalar inputs. | |
| template<int Offset, vir::any_simd_or_mask V> | |
| constexpr V | simd_shift_in (V const &a, std::convertible_to< V > auto const &... more) noexcept |
Concatenate a, more..., shift by Offset, and return the first V::size() elements. | |
| template<std::size_t I, reflectable_struct T, int N> requires (not vectorizable_struct_template<T>) | |
| constexpr decltype(auto) | get (const simd_tuple< T, N > &tup) |
| template<std::size_t I, vectorizable_struct_template T, int N> | |
| constexpr decltype(auto) | get (const vectorized_struct< T, N > &tup) |
|
template<std::size_t N, reflectable_struct T> requires (N < struct_size_v<std::remove_cvref_t<T>>) | |
| constexpr decltype(auto) | struct_get (T &&obj) |
Returns a cv-qualified reference to the N -th non-static data member in obj. | |
| template<reflectable_struct T> | |
| constexpr auto | to_tuple (T &&obj) |
Returns a std::tuple with a copy of all the non-static data members of obj. | |
| template<reflectable_struct T> | |
| constexpr auto | to_tuple_ref (T &&obj) |
Returns a std::tuple of lvalue references to all the non-static data members of obj. | |
|
template<typename T> requires (struct_size_v<std::remove_cvref_t<T>> == 2) | |
| constexpr auto | to_pair (T &&obj) |
Returns a std::pair with a copy of all the non-static data members of obj. | |
|
template<typename T> requires (struct_size_v<std::remove_cvref_t<T>> == 2) | |
| constexpr auto | to_pair_ref (T &&obj) |
Returns a std::pair of lvalue references to all the non-static data members of obj. | |
Variables | |
| constexpr int | simd_permute_zero = std::numeric_limits<int>::max() |
| Constant that requests a zero value instead of one of the input values. | |
| constexpr int | simd_permute_uninit = simd_permute_zero - 1 |
| Constant that allows an arbitrary value instead of one of the input values. | |
| constexpr simd_version_t | simd_version = { ( 0x0'04'bd / 0x10000), (( 0x0'04'bd % 0x10000) / 0x100), ( 0x0'04'bd % 0x100)} |
| The current version. | |
| template<typename T> | |
| vir::simdize_size vir::constexpr_wrapper int constexpr int | simdize_size_v = simdize_size<T>::value |
| Inline variable for the simdize_size trait. | |
| template<typename T> | |
| constexpr std::size_t | struct_size_v = 0 |
The number of non-static data members of T. | |
This namespace collects libraries and tools authored by Matthias Kretz.
This is just a name used for avoiding name collisions, without any deeper meaning.
| using vir::simdize = typename detail::simdize_impl<T, N>::type |
Apply a type transformation to a scalar type to produce a data-parallel type.
Meta-function that turns a vectorizable type or a tuple-like (recursively) of vectorizable types into a stdx::simd or std::tuple (recursively) of stdx::simd. If N is non-zero, N determines the resulting SIMD width. Otherwise, of all vectorizable types U the maximum stdx::native_simd<U>::size() determines the resulting SIMD width.
|
constexpr |
Implements structured bindings interface.
|
constexpr |
Implements structured bindings interface.
|
inlineconstexpr |
The current version.
Example: Check that you're compiling against vir-simd >= 0.5.0
|
inlineconstexpr |
The number of non-static data members of T.
The value of struct_size_v is the number of non-static data members of the type T. More precisely, struct_size_v is the number of elements in the identifier-list of a structured binding declaration.
| T | An aggregate type or a type specializing std::tuple_size that can be destructured via a structured binding. This implies that either T has only empty bases (only up to 3 are supported) or T has no non-static data members and a single base class with non-static data members. Using aggregate types that do not support destructuring is ill-formed. Using non-aggregate types that do not support destructuring results in a substitution failure. |