Dune Core Modules (2.10.0)
How to add support for a new vectorization library. More...
Files | |
file | base.hh |
Basic definitions for SIMD Implementations. | |
file | defaults.hh |
Default implementations for SIMD Implementations. | |
Namespaces | |
namespace | Dune::Simd::Overloads |
Namespace for the overloads and specializations that make up a SIMD implementation. | |
Classes | |
struct | Dune::Simd::Overloads::ADLTag< i, bool > |
Tag used to force late-binding lookup in Dune::Simd::Overloads. More... | |
struct | Dune::Simd::Overloads::ScalarType< V, class > |
should have a member type type More... | |
struct | Dune::Simd::Overloads::RebindType< S, class, class > |
should have a member type type More... | |
struct | Dune::Simd::Overloads::LaneCount< class, class > |
should be derived from a Dune::index_constant More... | |
Overloadable and default functions | |
This group contains functions that you, as an abstraction developer, must implement. All functions that are deleted must be provided, functions that have a default implementation may be left unimplemented if the default behaviour is satisfactory. | |
template<class V > | |
decltype(auto) | Dune::Simd::Overloads::lane (ADLTag< 0 >, std::size_t l, V v)=delete |
implements Simd::lane() | |
template<class V > | |
constexpr V | Dune::Simd::Overloads::implCast (ADLTag< 0 >, MetaType< V >, const V &u) |
implements Simd::implCast<V>(V) | |
template<class V , class U > | |
constexpr V | Dune::Simd::Overloads::implCast (ADLTag< 0 >, MetaType< V >, const U &u) |
implements Simd::implCast<V>(U) | |
template<class V , class S > | |
auto | Dune::Simd::Overloads::broadcast (ADLTag< 0 >, MetaType< V >, S s) |
implements Simd::broadcast<V>() | |
template<class V > | |
V | Dune::Simd::Overloads::cond (ADLTag< 0 >, const Mask< V > &mask, const V &ifTrue, const V &ifFalse)=delete |
implements Simd::cond() | |
template<class V > | |
auto | Dune::Simd::Overloads::max (ADLTag< 0 >, const V &v1, const V &v2) |
implements binary Simd::max() | |
template<class V > | |
auto | Dune::Simd::Overloads::min (ADLTag< 0 >, const V &v1, const V &v2) |
implements binary Simd::min() | |
template<class Mask > | |
bool | Dune::Simd::Overloads::anyTrue (ADLTag< 0 >, const Mask &mask)=delete |
implements Simd::anyTrue() | |
template<class Mask > | |
bool | Dune::Simd::Overloads::allTrue (ADLTag< 0 >, const Mask &mask) |
implements Simd::allTrue() More... | |
template<class Mask > | |
bool | Dune::Simd::Overloads::anyFalse (ADLTag< 0 >, const Mask &mask) |
implements Simd::anyFalse() More... | |
template<class Mask > | |
bool | Dune::Simd::Overloads::allFalse (ADLTag< 0 >, const Mask &mask) |
implements Simd::allFalse() More... | |
template<class V > | |
auto | Dune::Simd::Overloads::max (ADLTag< 0 >, const V &v) |
implements Simd::maxValue() | |
template<class V > | |
auto | Dune::Simd::Overloads::min (ADLTag< 0 >, const V &v) |
implements Simd::minValue() | |
template<class V > | |
Mask< V > | Dune::Simd::Overloads::mask (ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v) |
implements Simd::mask() | |
template<class V > | |
auto | Dune::Simd::Overloads::mask (ADLTag< 0, !std::is_same< V, Mask< V > >::value >, const V &v) |
implements Simd::mask() | |
template<class V1 , class V2 > | |
auto | Dune::Simd::Overloads::maskOr (ADLTag< 0 >, const V1 &v1, const V2 &v2) |
implements Simd::maskOr() | |
template<class V1 , class V2 > | |
auto | Dune::Simd::Overloads::maskAnd (ADLTag< 0 >, const V1 &v1, const V2 &v2) |
implements Simd::maskAnd() | |
Detailed Description
How to add support for a new vectorization library.
This module describes the interface that you must implement if you want to provide an abstraction layer for some vectorization library. To understand some of the design choices, have a look at dune/common/simd/DESIGN.md in dune-common's source.
Everything an abstraction implementation needs to provide is in namespace Dune::Simd::Overloads
.
An implementation must specialize all the template classes in namespace Overloads
(with the exception of Overloads::ADLTag
, see below). To make it possible for certain specializations not to participate in overload resolution, each template class provides a dummy template parameter SFINAETag
that defaults to void
.
An implementation must overload all functions within namespace Overloads
that are defined deleted. It may overload other functions if the default behaviour is not suitable. All functions take a value of type Overloads::ADLTag<priority, true>
as their first argument to enable argument-dependent lookup, to be able to prioritize different overloads with respect to each other, and to be able to inhibit certain overloads from taking part in overload resolution. See the documentation for Overloads::ADLTag
for a detailed explanation.
An abstraction implementation may not specialize Overloads::ADLTag
, and may not introduce new names into namespace Overloads
.
Function Documentation
◆ allFalse()
implements Simd::allFalse()
Default uses Simd::anyTrue()
References Dune::Simd::anyTrue(), and Dune::Simd::Overloads::mask().
◆ allTrue()
implements Simd::allTrue()
Default uses Simd::anyTrue()
References Dune::Simd::anyTrue(), and Dune::Simd::Overloads::mask().
◆ anyFalse()
implements Simd::anyFalse()
Default uses Simd::anyTrue()
References Dune::Simd::anyTrue(), and Dune::Simd::Overloads::mask().