Data transfer¶
-
template<class T, class A = default_arch>
batch<T, A> broadcast(T v)¶ Creates a batch from the single value
v
.- Parameters
v – the value used to initialize the batch
- Returns
a new batch instance
-
template<class To, class A = default_arch, class From>
simd_return_type<From, To> broadcast_as(From v)¶ Creates a batch from the single value
v
and the specified batch value typeTo
.- Parameters
v – the value used to initialize the batch
- Returns
a new batch instance
-
template<class To, class A = default_arch, class From>
simd_return_type<From, To> load_as(From const *ptr, aligned_mode)¶ Creates a batch from the buffer
ptr
and the specifed batch value typeTo
.The memory needs to be aligned.
- Parameters
ptr – the memory buffer to read
- Returns
a new batch instance
-
template<class To, class A = default_arch, class From>
simd_return_type<From, To> load_as(From const *ptr, unaligned_mode)¶ Creates a batch from the buffer
ptr
and the specifed batch value typeTo
.The memory does not need to be aligned.
- Parameters
ptr – the memory buffer to read
- Returns
a new batch instance
-
template<class A = default_arch, class From>
batch<From, A> load(From const *ptr, aligned_mode = {})¶ Creates a batch from the buffer
ptr
.The memory needs to be aligned.
- Parameters
ptr – the memory buffer to read
- Returns
a new batch instance
-
template<class A = default_arch, class From>
batch<From, A> load(From const *ptr, unaligned_mode)¶ Creates a batch from the buffer
ptr
.The memory does not need to be aligned.
- Parameters
ptr – the memory buffer to read
- Returns
a new batch instance
-
template<class A = default_arch, class From>
batch<From, A> load_aligned(From const *ptr)¶ Creates a batch from the buffer
ptr
.The memory needs to be aligned.
- Parameters
ptr – the memory buffer to read
- Returns
a new batch instance
-
template<class A = default_arch, class From>
batch<From, A> load_unaligned(From const *ptr)¶ Creates a batch from the buffer
ptr
.The memory does not need to be aligned.
- Parameters
ptr – the memory buffer to read
- Returns
a new batch instance
-
template<class To, class A = default_arch, class From>
void store_as(To *dst, batch<From, A> const &src, aligned_mode)¶ Copy content of batch
src
to the bufferdst
.The memory needs to be aligned.
- Parameters
mem – the memory buffer to write to
val – the batch to copy
-
template<class To, class A = default_arch, class From>
void store_as(To *dst, batch<From, A> const &src, unaligned_mode)¶ Copy content of batch
src
to the bufferdst
.The memory does not need to be aligned.
- Parameters
mem – the memory buffer to write to
val – the batch to copy
-
template<class A, class T>
void store(T *mem, batch<T, A> const &val, aligned_mode = {})¶ Copy content of batch
val
to the buffermem
.The memory does not need to be aligned.
- Parameters
mem – the memory buffer to write to
val – the batch to copy from
-
template<class A, class T>
void store(T *mem, batch<T, A> const &val, unaligned_mode)¶ Copy content of batch
val
to the buffermem
.The memory does not need to be aligned.
- Parameters
mem – the memory buffer to write to
val – the batch to copy from
-
template<class A, class T>
void store_aligned(T *mem, batch<T, A> const &val)¶ Copy content of batch
val
to the buffermem
.The memory needs to be aligned.
- Parameters
mem – the memory buffer to write to
val – the batch to copy from
-
template<class A, class T>
void store_unaligned(T *mem, batch<T, A> const &val)¶ Copy content of batch
val
to the buffermem
.The memory does not need to be aligned.
- Parameters
mem – the memory buffer to write to
val – the batch to copy
-
template<class T, class A>
batch<T, A> zip_hi(batch<T, A> const &x, batch<T, A> const &y)¶ Unpack and interleave data from the HIGH half of batches
x
andy
.Store the results in the Return value.
- Parameters
x – a batch of integer or floating point or double precision values.
y – a batch of integer or floating point or double precision values.
- Returns
a batch of the high part of shuffled values.
-
template<class T, class A>
batch<T, A> zip_lo(batch<T, A> const &x, batch<T, A> const &y)¶ Unpack and interleave data from the LOW half of batches
x
andy
.Store the results in the Return value.
- Parameters
x – a batch of integer or floating point or double precision values.
y – a batch of integer or floating point or double precision values.
- Returns
a batch of the low part of shuffled values.
The following empty types are used for tag dispatching:
-
struct aligned_mode¶
tag for load and store of aligned memory.
-
struct unaligned_mode¶
tag for load and store of unaligned memory.