alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
Simd.hpp File Reference
#include "alpaka/SimdMask.hpp"
#include "alpaka/Vec.hpp"
#include "alpaka/cast.hpp"
#include "alpaka/core/util.hpp"
#include "alpaka/mem/Alignment.hpp"
#include "alpaka/simd/concepts.hpp"
#include "alpaka/simd/trait.hpp"
#include "alpaka/trait.hpp"
#include "simd/internal/EmuSimd.hpp"
#include "simd/internal/StdSimd.hpp"
#include <array>
#include <bit>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iosfwd>
#include <ranges>
#include <sstream>
#include <string>
#include <type_traits>

Go to the source code of this file.

Classes

struct  alpaka::internal::PCast::Op< T_To, alpaka::Simd< T_Type, T_width, T_Storage > >
struct  alpaka::Simd< T_Type, T_width, T_Storage >
 Simd vector. More...
struct  alpaka::trait::GetDim< alpaka::Simd< T_Type, T_width, T_Storage > >
struct  alpaka::trait::GetValueType< alpaka::Simd< T_Type, T_width, T_Storage > >
struct  alpaka::trait::IsSimd< Simd< T_Type, T_width, T_Storage > >
struct  std::tuple_element< I, alpaka::Simd< T_Type, T_width, T_Storage > >
struct  std::tuple_size< alpaka::Simd< T_Type, T_width, T_Storage > >

Namespaces

namespace  alpaka
 main alpaka namespace.
namespace  alpaka::internal
 alpaka internal implementations.
namespace  alpaka::trait
namespace  std
 STL namespace.

Macros

#define ALPAKA_NAMED_ARRAY_ACCESS(functionName, laneIdx)
#define ALPAKA_VECTOR_ASSIGN_OP(op)
 assign operator

Functions

template<std::size_t I, typename T_Type, uint32_t T_width, typename T_Storage>
constexpr auto & alpaka::get (Simd< T_Type, T_width, T_Storage > &v)
template<std::size_t I, typename T_Type, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::get (Simd< T_Type, T_width, T_Storage > const &v)
template<typename Type, uint32_t T_width, typename T_Storage>
std::ostream & alpaka::operator<< (std::ostream &s, Simd< Type, T_width, T_Storage > const &vec)
template<typename T_1, typename... T_Args>
ALPAKA_FN_HOST_ACC alpaka::Simd (T_1, T_Args...) -> Simd< T_1, uint32_t(sizeof...(T_Args)+1u)>
#define ALPAKA_VECTOR_BINARY_CMP_OP(typenameOrConcept, op)
 binary operators
#define ALPAKA_VECTOR_BINARY_OP(typenameOrConcept, op)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator!= (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator!= (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator!= (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<std::integral T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator% (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator% (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator% (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<std::integral T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator& (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator& (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator& (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator* (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator* (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator* (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator+ (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator+ (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator+ (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator- (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator- (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator- (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator/ (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator/ (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator/ (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator< (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator< (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator< (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<std::integral T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator<< (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator<< (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator<< (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator<= (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator<= (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator<= (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator== (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator== (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator== (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator> (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator> (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator> (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<typename T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator>= (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator>= (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<typename T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator>= (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<std::integral T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator>> (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator>> (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator>> (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<std::integral T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator^ (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator^ (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator^ (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators
template<std::integral T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage>
constexpr auto alpaka::operator| (const Simd< T_Type, T_width, T_Storage > &lhs, const Simd< T_Type, T_width, T_OtherStorage > &rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator| (const Simd< T_Type, T_width, T_Storage > &lhs, T_ValueType rhs)
 binary operators
template<std::integral T_Type, concepts::LosslesslyConvertible< T_Type > T_ValueType, uint32_t T_width, typename T_Storage>
constexpr auto alpaka::operator| (T_ValueType lhs, const Simd< T_Type, T_width, T_Storage > &rhs)
 binary operators

Macro Definition Documentation

◆ ALPAKA_NAMED_ARRAY_ACCESS

#define ALPAKA_NAMED_ARRAY_ACCESS ( functionName,
laneIdx )
Value:
constexpr reference functionName() requires(T_width >= laneIdx + 1) \
{ \
return (*this)[laneIdx]; \
} \
constexpr type functionName() const requires(T_width >= laneIdx + 1) \
{ \
return (*this)[laneIdx]; \
}

Definition at line 275 of file Simd.hpp.

◆ ALPAKA_VECTOR_ASSIGN_OP

#define ALPAKA_VECTOR_ASSIGN_OP ( op)
Value:
template<typename T_OtherStorage> \
constexpr Simd& operator op(Simd<T_Type, T_width, T_OtherStorage> const& rhs) \
{ \
this->asStorage() op rhs.asStorage(); \
return *this; \
} \
constexpr Simd& operator op(concepts::LosslesslyConvertible<T_Type> auto const value) \
{ \
this->asStorage() op static_cast<T_Type>(value); \
return *this; \
}

assign operator

Definition at line 232 of file Simd.hpp.

◆ ALPAKA_VECTOR_BINARY_CMP_OP

#define ALPAKA_VECTOR_BINARY_CMP_OP ( typenameOrConcept,
op )
Value:
template<typenameOrConcept T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage> \
constexpr auto operator op( \
const Simd<T_Type, T_width, T_Storage>& lhs, \
const Simd<T_Type, T_width, T_OtherStorage>& rhs) \
{ \
using StoreageType = ALPAKA_TYPEOF(lhs.asStorage() op rhs.asStorage()); \
return SimdMask<T_Type, T_width, StoreageType>(lhs.asStorage() op rhs.asStorage()); \
} \
template< \
typenameOrConcept T_Type, \
concepts::LosslesslyConvertible<T_Type> T_ValueType, \
uint32_t T_width, \
typename T_Storage> \
constexpr auto operator op(const Simd<T_Type, T_width, T_Storage>& lhs, T_ValueType rhs) \
{ \
using StoreageType = ALPAKA_TYPEOF(lhs.asStorage() op static_cast<T_Type>(rhs)); \
return SimdMask<T_Type, T_width, StoreageType>(lhs.asStorage() op static_cast<T_Type>(rhs)); \
} \
template< \
typenameOrConcept T_Type, \
concepts::LosslesslyConvertible<T_Type> T_ValueType, \
uint32_t T_width, \
typename T_Storage> \
constexpr auto operator op(T_ValueType lhs, const Simd<T_Type, T_width, T_Storage>& rhs) \
{ \
using StoreageType = ALPAKA_TYPEOF(static_cast<T_Type>(lhs) op rhs.asStorage()); \
return SimdMask<T_Type, T_width, StoreageType>(static_cast<T_Type>(lhs) op rhs.asStorage()); \
}
#define ALPAKA_TYPEOF(...)
Get the type of instance.
Definition common.hpp:153

binary operators

Definition at line 593 of file Simd.hpp.

◆ ALPAKA_VECTOR_BINARY_OP

#define ALPAKA_VECTOR_BINARY_OP ( typenameOrConcept,
op )
Value:
template<typenameOrConcept T_Type, uint32_t T_width, typename T_Storage, typename T_OtherStorage> \
constexpr auto operator op( \
const Simd<T_Type, T_width, T_Storage>& lhs, \
const Simd<T_Type, T_width, T_OtherStorage>& rhs) \
{ \
using StoreageType = ALPAKA_TYPEOF(lhs.asStorage() op rhs.asStorage()); \
return Simd<T_Type, T_width, StoreageType>(lhs.asStorage() op rhs.asStorage()); \
} \
template< \
typenameOrConcept T_Type, \
concepts::LosslesslyConvertible<T_Type> T_ValueType, \
uint32_t T_width, \
typename T_Storage> \
constexpr auto operator op(const Simd<T_Type, T_width, T_Storage>& lhs, T_ValueType rhs) \
{ \
using StoreageType = ALPAKA_TYPEOF(lhs.asStorage() op static_cast<T_Type>(rhs)); \
return Simd<T_Type, T_width, StoreageType>(lhs.asStorage() op static_cast<T_Type>(rhs)); \
} \
template< \
typenameOrConcept T_Type, \
concepts::LosslesslyConvertible<T_Type> T_ValueType, \
uint32_t T_width, \
typename T_Storage> \
constexpr auto operator op(T_ValueType lhs, const Simd<T_Type, T_width, T_Storage>& rhs) \
{ \
using StoreageType = ALPAKA_TYPEOF(static_cast<T_Type>(lhs) op rhs.asStorage()); \
return Simd<T_Type, T_width, StoreageType>(static_cast<T_Type>(lhs) op rhs.asStorage()); \
}

binary operators

Definition at line 549 of file Simd.hpp.