AI Engine API User Guide (AIE-API) 2026.1
Loading...
Searching...
No Matches
iterator.hpp File Reference
#include <iterator>
#include "detail/array_helpers.hpp"

Classes

class  aie::circular_iterator< T, Size, Resource >
 Implements an iterator that wraps around when it reaches the end of the buffer and, thus, has no end. More...
class  aie::pattern_iterator< T, Steps >
class  aie::random_circular_iterator< T, Size, Resource >
 Implements an iterator that wraps around when it reaches the end or the beginning of the buffer and, thus, has no end. More...
class  aie::restrict_vector_iterator< T, Elems, Resource >
class  aie::tensor_descriptor< Rank, T, Elems, Layout, Repr, ByteSteps >
struct  aie::tensor_dim
class  aie::unaligned_vector_input_buffer_stream< T, Elems, Resource >
 Implements an input stream that reads from a memory buffer with vector granularity. More...
class  aie::unaligned_vector_iterator< T, Elems, Resource >
 Implements an iterator that traverses an array using vectors instead of scalar values. More...
class  aie::unaligned_vector_output_buffer_stream< T, Elems, Resource >
 Implements an output stream that writes into a memory buffer with vector granularity. More...
class  aie::vector_circular_iterator< T, Elems, Size, Resource >
 Implements a vector iterator that wraps around when it reaches the end of the buffer and, thus, has no end. More...
class  aie::vector_input_buffer_stream< T, Elems, Resource >
 Implements an input stream that reads from a memory buffer with vector granularity. More...
class  aie::vector_iterator< T, Elems, Resource >
 Implements an iterator that traverses an array using vectors instead of scalar values. More...
class  aie::vector_output_buffer_stream< T, Elems, Resource >
 Implements an output stream that writes into a memory buffer with vector granularity. More...
class  aie::vector_random_circular_iterator< T, Elems, Size, Resource >
 Implements a vector iterator that wraps around when it reaches the end or the beginning of the buffer and, thus, has no end. More...

Namespaces

namespace  aie
 Base namespace for AIE operations and types.

Concepts

concept  aie::NativeDim
concept  aie::NativeOrSlidingDim
concept  aie::SlidingDim
concept  aie::TensorDim

Macros

#define __AIE_API_ITERATOR__HPP__

Typedefs

template<typename T, size_t Size = dynamic_extent, aie_dm_resource Resource = aie_dm_resource::none>
using aie::const_circular_iterator = circular_iterator<const T, Size, Resource>
 Same as circular_iterator, but the contents of the iterated array cannot be modified.
template<typename T, unsigned Steps>
using aie::const_pattern_iterator = pattern_iterator<std::add_const_t<T>, Steps>
template<typename T, size_t Size, aie_dm_resource Resource = aie_dm_resource::none>
using aie::const_random_circular_iterator = random_circular_iterator<const T, Size, Resource>
 Same as random_circular_iterator, but the contents of the iterated array cannot be modified.
template<typename T, unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none>
using aie::const_restrict_vector_iterator = restrict_vector_iterator<const std::remove_const_t<T>, Elems, Resource>
template<typename T, unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none>
using aie::const_unaligned_vector_iterator = unaligned_vector_iterator<const std::remove_const_t<T>, Elems, Resource>
 Same as unaligned_vector_iterator, but the contents of the iterated array cannot be modified.
template<typename T, unsigned Elems, size_t Size = dynamic_extent, aie_dm_resource Resource = aie_dm_resource::none>
using aie::const_vector_circular_iterator = vector_circular_iterator<const T, Elems, Size, Resource>
 Same as circular_iterator, but the contents of the iterated array cannot be modified.
template<typename T, unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none>
using aie::const_vector_iterator = vector_iterator<const std::remove_const_t<T>, Elems, Resource>
 Same as vector_iterator, but the contents of the iterated array cannot be modified.
template<typename T, unsigned Elems, size_t Size, aie_dm_resource Resource = aie_dm_resource::none>
using aie::const_vector_random_circular_iterator = vector_random_circular_iterator<const T, Elems, Size, Resource>
 Same as vector_random_circular_iterator, but the contents of the iterated array cannot be modified.
using aie::contiguous_dim = detail::contiguous_dim
using aie::data_layout = detail::data_layout
using aie::dim_2d = detail::dim_2d
using aie::dim_3d = detail::dim_3d
using aie::sliding_window_dim_1d = detail::sliding_window_dim_1d
using aie::sliding_window_dim_2d = detail::sliding_window_dim_2d
using aie::sliding_window_dim_3d = detail::sliding_window_dim_3d
using aie::tbs_mode = detail::tbs_mode

Functions

template<aie_dm_resource Resource, typename T>
constexpr auto aie::begin (T *base, size_t n)
 Returns an iterator for the array described by the given address and size.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T, unsigned Elems>
constexpr auto aie::begin (T(&base)[Elems])
 Returns an iterator for the given statically-sized array.
template<size_t Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr circular_iterator< T, Elems, Resource > aie::begin_circular (T *base)
 Returns a circular iterator for the array described by the given address and size.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr circular_iterator< T, dynamic_extent, Resource > aie::begin_circular (T *base, size_t n)
 Returns a circular iterator for the array described by the given address and size.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t Elems>
constexpr circular_iterator< T, Elems, Resource > aie::begin_circular (T(&base)[Elems])
 Returns a circular iterator for the given statically-sized array.
template<unsigned Steps, typename T, typename... Offsets>
constexpr auto aie::begin_pattern (T *base, Offsets &&... offsets)
 Returns a forward iterator for the array described by the given address.
template<size_t Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr random_circular_iterator< T, Elems, Resource > aie::begin_random_circular (T *base)
 Returns a random-access circular iterator for the array described by the given address and size.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr random_circular_iterator< T, dynamic_extent, Resource > aie::begin_random_circular (T *base, size_t n)
 Returns a random-access circular iterator for the array described by the given address and size.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t Elems>
constexpr random_circular_iterator< T, Elems, Resource > aie::begin_random_circular (T(&base)[Elems])
 Returns a random-access circular iterator for the array described by the given address and size.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr const_restrict_vector_iterator< T, Elems, Resource > aie::begin_restrict_vector (const T *base)
 Same as begin_vector, but the given pointer is considered restrict.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr restrict_vector_iterator< T, Elems, Resource > aie::begin_restrict_vector (T *base)
 Same as begin_vector, but the given pointer is considered restrict.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr unaligned_vector_iterator< T, Elems, Resource > aie::begin_unaligned_vector (T *base)
 Returns a vector iterator starting at the given address.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr const_vector_iterator< T, Elems, Resource > aie::begin_vector (const T *base)
 Returns a vector iterator starting at the given address.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr vector_iterator< T, Elems, Resource > aie::begin_vector (T *base)
 Returns a vector iterator starting at the given address.
template<unsigned Elems, size_t ArrayElems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr vector_circular_iterator< T, Elems, ArrayElems, Resource > aie::begin_vector_circular (T *base)
 Returns a circular iterator for the array described by the given address and size.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr vector_circular_iterator< T, Elems, dynamic_extent, Resource > aie::begin_vector_circular (T *base, size_t n)
 Returns a circular iterator for the array described by the given address and size.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t ArrayElems>
constexpr vector_circular_iterator< T, Elems, ArrayElems, Resource > aie::begin_vector_circular (T(&base)[ArrayElems])
 Returns a circular iterator for the array described by the given address and size.
template<unsigned Elems, size_t ArrayElems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr vector_random_circular_iterator< T, Elems, ArrayElems, Resource > aie::begin_vector_random_circular (T *base)
 Returns a circular iterator for the array described by the given address and size.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr vector_random_circular_iterator< T, Elems, dynamic_extent, Resource > aie::begin_vector_random_circular (T *base, size_t n)
 Returns a circular iterator for the array described by the given address and size.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t ArrayElems>
constexpr vector_random_circular_iterator< T, Elems, ArrayElems, Resource > aie::begin_vector_random_circular (T(&base)[ArrayElems])
 Returns a circular iterator for the array described by the given address and size.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType... Types>
constexpr auto aie::begin_vectors (Types *...ptrs)
template<aie_dm_resource Resource, typename T>
constexpr auto aie::cbegin (const T *base, size_t n)
 Returns an iterator for the constant array described by the given address and size.
template<size_t Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_circular_iterator< T, Elems, Resource > aie::cbegin_circular (const T *base)
 Similar to begin_circular, but the returned iterator is constant.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_circular_iterator< T, dynamic_extent, Resource > aie::cbegin_circular (const T *base, size_t n)
 Similar to begin_circular, but the returned iterator is constant.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t Elems>
constexpr const_circular_iterator< T, Elems, Resource > aie::cbegin_circular (const T(&base)[Elems])
 Similar to begin_circular, but the returned iterator is constant.
template<unsigned Steps, typename T, typename... Offsets>
constexpr const_pattern_iterator< T, Steps > aie::cbegin_pattern (const T *base, Offsets &&... offsets)
 Similar to begin_pattern, but the returned iterator is constant.
template<size_t Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_random_circular_iterator< T, Elems, Resource > aie::cbegin_random_circular (const T *base)
 Similar to begin_random_circular, but the returned iterator is constant.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_random_circular_iterator< T, dynamic_extent, Resource > aie::cbegin_random_circular (const T *base, size_t n)
 Similar to begin_random_circular, but the returned iterator is constant.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t Elems>
constexpr const_random_circular_iterator< T, Elems > aie::cbegin_random_circular (const T(&base)[Elems])
 Similar to begin_random_circular, but the returned iterator is constant.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr const_restrict_vector_iterator< T, Elems, Resource > aie::cbegin_restrict_vector (const T *base)
 Same as begin_vector, but the given pointer is considered restrict.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr const_unaligned_vector_iterator< T, Elems, Resource > aie::cbegin_unaligned_vector (T *base)
 Returns a vector iterator starting at the given address.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
constexpr const_vector_iterator< T, Elems, Resource > aie::cbegin_vector (const T *base)
 Same as begin_vector.
template<unsigned Elems, size_t ArrayElems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_vector_circular_iterator< T, Elems, ArrayElems, Resource > aie::cbegin_vector_circular (const T *base)
 Similar to begin_circular, but the returned iterator is constant.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_vector_circular_iterator< T, Elems, dynamic_extent, Resource > aie::cbegin_vector_circular (const T *base, size_t n)
 Similar to begin_circular, but the returned iterator is constant.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t ArrayElems>
constexpr const_vector_circular_iterator< T, Elems, ArrayElems, Resource > aie::cbegin_vector_circular (const T(&base)[ArrayElems])
 Similar to begin_circular, but the returned iterator is constant.
template<unsigned Elems, size_t ArrayElems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_vector_random_circular_iterator< T, Elems, ArrayElems, Resource > aie::cbegin_vector_random_circular (const T *base)
 Similar to begin_circular, but the returned iterator is constant.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr const_vector_random_circular_iterator< T, Elems, dynamic_extent, Resource > aie::cbegin_vector_random_circular (const T *base, size_t n)
 Similar to begin_circular, but the returned iterator is constant.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, typename T, size_t ArrayElems>
constexpr const_vector_random_circular_iterator< T, Elems, ArrayElems, Resource > aie::cbegin_vector_random_circular (const T(&base)[ArrayElems])
 Similar to begin_circular, but the returned iterator is constant.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType... Types>
constexpr auto aie::cbegin_vectors (const Types *...ptrs)
template<aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr auto aie::cend (const T *base, size_t n)
 Returns an iterator that points at the end of the constant array described by the given address and size.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T>
constexpr auto aie::end (T *base, size_t n)
 Returns an iterator that points at the end of the array described by the given address and size.
template<aie_dm_resource Resource = aie_dm_resource::none, typename T, unsigned Elems>
constexpr auto aie::end (T(&base)[Elems])
 Returns an iterator that points at the end of the given statically-sized array.
template<aie_dm_resource Resource = aie_dm_resource::none, tbs_mode Mode = tbs_mode::default_mode, DecoratedElemBaseOrBlockType T, typename TensorDescriptor>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_restrict_tensor_buffer_stream (T *__restrict base, const TensorDescriptor &tensor_desc)
 Creates a restrict tensor buffer stream for accessing multidimensional data with optimized memory addressing patterns.
template<aie_dm_resource Resource = aie_dm_resource::none, tbs_mode Mode = tbs_mode::default_mode, DecoratedElemBaseOrBlockType T, typename TensorDescriptor>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_buffer_stream (const T *base, const TensorDescriptor &tensor_desc)
 Creates a constant tensor buffer stream for accessing multidimensional data with optimized memory addressing patterns.
template<aie_dm_resource Resource = aie_dm_resource::none, tbs_mode Mode = tbs_mode::default_mode, DecoratedElemBaseOrBlockType T, typename TensorDescriptor>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_buffer_stream (T *base, const TensorDescriptor &tensor_desc)
 Creates a tensor buffer stream for accessing multidimensional data with optimized memory addressing patterns.
template<Mask M, typename Repr, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream of aie::mask values.
template<Mask M, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream of aie::mask values.
template<typename T, typename Repr, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor (Args &&... args)
 Creates a tensor descriptor of scalar values that is to be used to create a tensor buffer stream.
template<typename T, unsigned Elems, typename Repr, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream.
template<typename T, unsigned Elems = 1u, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream.
template<Mask M, data_layout Layout = data_layout::row_major>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor (const contiguous_dim &arg)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream of aie::mask values.
template<typename T, unsigned Elems = 1u, data_layout Layout = data_layout::row_major>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor (const contiguous_dim &arg)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream.
template<Mask M, typename Repr, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_bytes (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream of aie::mask values.
template<Mask M, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_bytes (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream of aie::mask values.
template<typename T, typename Repr, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_bytes (Args &&... args)
 Creates a tensor descriptor of scalar values that is to be used to create a tensor buffer stream.
template<typename T, unsigned Elems, typename Repr, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_bytes (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream.
template<typename T, unsigned Elems = 1u, data_layout Layout = data_layout::row_major, TensorDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_bytes (Args &&... args)
 Creates a tensor descriptor that is to be used to create a tensor buffer stream.
template<Mask M, data_layout Layout = data_layout::row_major, NativeDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_from_native (Args &&... args)
 Creates a tensor descriptor from native dim types (int, dim_2d, dim_3d) that is to be used to create a tensor buffer stream of aie::mask values.
template<typename T, unsigned Elems = 1u, data_layout Layout = data_layout::row_major, NativeDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_from_native (Args &&... args)
 Creates a tensor descriptor from native dim types (int, dim_2d, dim_3d) that is to be used to create a tensor buffer stream.
template<Mask M, data_layout Layout = data_layout::row_major, NativeDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_from_native_bytes (Args &&... args)
 Creates a tensor descriptor from native dim types (int, dim_2d, dim_3d) that is to be used to create a tensor buffer stream of aie::mask values.
template<typename T, unsigned Elems = 1u, data_layout Layout = data_layout::row_major, NativeOrSlidingDim... Args>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_tensor_descriptor_from_native_bytes (Args &&... args)
 Creates a tensor descriptor from native dim types (int, dim_2d, dim_3d) that is to be used to create a tensor buffer stream.
template<aie_dm_resource Resource = aie_dm_resource::none, tbs_mode Mode = tbs_mode::default_mode, DecoratedElemBaseOrBlockType T, typename TensorDescriptor>
requires (arch::is(arch::Gen2))
constexpr auto aie::make_unaligned_tensor_buffer_stream (const T *base, const TensorDescriptor &tensor_desc)
 Creates a constant tensor buffer stream for accessing unaligned multidimensional data with optimized memory addressing patterns.
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
auto aie::make_unaligned_vector_input_buffer_stream (const T *ptr) -> unaligned_vector_input_buffer_stream< T, Elems, Resource >
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
auto aie::make_unaligned_vector_output_buffer_stream (T *ptr) -> unaligned_vector_output_buffer_stream< T, Elems, Resource >
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
auto aie::make_vector_input_buffer_stream (const T *ptr) -> vector_input_buffer_stream< T, Elems, Resource >
template<unsigned Elems, aie_dm_resource Resource = aie_dm_resource::none, DecoratedElemBaseType T>
auto aie::make_vector_output_buffer_stream (T *ptr) -> vector_output_buffer_stream< T, Elems, Resource >

Macro Definition Documentation

◆ __AIE_API_ITERATOR__HPP__

#define __AIE_API_ITERATOR__HPP__