SeqAn3
Simd

The simd module contains a unified interface to provide simd types and functions used in seqan3. More...

Collaboration diagram for Simd:

Classes

interface  seqan3::simd::simd_concept
 The generic simd concept. More...
 
struct  seqan3::simd::simd_traits< simd_t >
 seqan3::simd::simd_traits is the trait class that provides uniform interface to the properties of simd_t types. More...
 
struct  seqan3::simd::simd_traits< builtin_simd_t >
 This class specializes seqan3::simd::simd_traits for seqan3::detail::builtin_simd types. More...
 
struct  seqan3::simd::simd_type< scalar_t, length, simd_backend >
 seqan3::simd::simd_type encapsulates simd vector types, which can be manipulated by simd operations. More...
 

Typedefs

template<typename scalar_t , size_t length = detail::default_simd_length<scalar_t, detail::default_simd_backend>, typename simd_backend = detail::default_simd_backend<scalar_t, length>>
using seqan3::simd::simd_type_t = typename simd_type< scalar_t, length, simd_backend >::type
 Helper type of seqan3::simd::simd_type.
 

Functions

template<simd_concept simd_t>
constexpr simd_t seqan3::simd::fill (typename simd_traits< simd_t >::scalar_type const scalar)
 Fills a seqan3::simd::simd_type vector with a scalar value. More...
 
template<simd_concept simd_t>
constexpr simd_t seqan3::simd::iota (typename simd_traits< simd_t >::scalar_type const offset)
 Fills a seqan3::simd::simd_type vector with the scalar values offset, offset+1, offset+2, ... More...
 
template<typename simd_t >
debug_stream_typeseqan3::operator<< (debug_stream_type &s, simd_t &&simd)
 Overload for debug_stream for simd types.
 

Detailed Description

The simd module contains a unified interface to provide simd types and functions used in seqan3.

See also
https://en.wikipedia.org/wiki/SIMD

There are different simd implementations (backends), which are auto-selected by seqan3::simd::simd_type_t.

Function Documentation

◆ fill()

template<simd_concept simd_t>
constexpr simd_t seqan3::simd::fill ( typename simd_traits< simd_t >::scalar_type const  scalar)

Fills a seqan3::simd::simd_type vector with a scalar value.

Template Parameters
simd_tThe simd type which satisfies seqan3::simd::simd_concept.
Parameters
[in]scalarThe scalar value to fill the seqan3::simd::simd_type vector.
using namespace seqan3;
using uint8x16_t = simd_type_t<uint16_t, 8>;
int main()
{
uint8x16_t a = fill<uint8x16_t>(4);
debug_stream << a << "\n"; // [4,4,4,4,4,4,4,4]
//or:
uint8x16_t b = simd::fill<uint8x16_t>(4);
debug_stream << b << "\n"; // [4,4,4,4,4,4,4,4]
return 0;
}

◆ iota()

template<simd_concept simd_t>
constexpr simd_t seqan3::simd::iota ( typename simd_traits< simd_t >::scalar_type const  offset)

Fills a seqan3::simd::simd_type vector with the scalar values offset, offset+1, offset+2, ...

Template Parameters
simd_tThe simd type which satisfies seqan3::simd::simd_concept.
Parameters
[in]offsetThe scalar offset to fill the seqan3::simd::simd_type vector.
using namespace seqan3;
using uint8x16_t = simd_type_t<uint16_t, 8>;
int main()
{
uint8x16_t a = iota<uint8x16_t>(1);
debug_stream << a << "\n"; // [1,2,3,4,5,6,7,8]
// or:
uint8x16_t b = simd::iota<uint8x16_t>(1);
debug_stream << b << "\n"; // [1,2,3,4,5,6,7,8]
return 0;
}