AI Engine API User Guide (AIE) 2023.1
Loading...
Searching...
No Matches
aie::detail::mask< Elems > Class Template Reference

#include <mask.hpp>

Public Member Functions

__aie_inline constexpr mask (bool initial_set=false)
 
template<typename... T>
constexpr mask (unsigned w, T &&... words)
 
__aie_inline constexpr void clear (unsigned i)
 
__aie_inline constexpr unsigned clz () const
 
__aie_inline constexpr unsigned count () const
 
__aie_inline constexpr const std::array< unsigned, num_words > & data () const
 
__aie_inline constexpr bool empty () const
 
__aie_inline constexpr bool full () const
 
template<unsigned ElemsOut>
__aie_inline constexpr mask< ElemsOut > get_submask (unsigned i) const
 
__aie_inline constexpr mask operator& (const mask &a) const
 
__aie_inline constexpr maskoperator&= (const mask &a)
 
__aie_inline constexpr mask operator<< (unsigned shift) const
 
constexpr maskoperator<<= (unsigned shift)
 
__aie_inline constexpr bool operator== (const mask &a) const
 
__aie_inline constexpr mask operator>> (unsigned shift) const
 
constexpr maskoperator>>= (unsigned shift)
 
__aie_inline constexpr mask operator| (const mask &a) const
 
__aie_inline constexpr maskoperator|= (const mask &a)
 
__aie_inline constexpr mask operator~ () const
 
__aie_inline constexpr void set (unsigned i)
 
__aie_inline constexpr bool test (unsigned i) const
 
template<unsigned Elems2 = Elems>
requires (Elems2 <= 32)
__aie_inline constexpr unsigned to_uint32 () const
 
__aie_inline constexpr unsigned to_uint32 (unsigned i) const
 
template<unsigned Elems2 = Elems>
requires (Elems2 == 64)
__aie_inline constexpr uint64_t to_uint64 () const
 
__aie_inline constexpr uint64_t to_uint64 (unsigned i) const
 

Static Public Member Functions

template<unsigned Elems2, typename... T>
__aie_inline static constexpr mask< Elems > from_masks (const mask< Elems2 > &m, T &&... masks)
 
template<typename... T>
__aie_inline static constexpr mask< Elems > from_uint32 (unsigned w, T &&... words)
 
template<typename... T>
__aie_inline static constexpr mask< Elems > from_uint64 (uint64_t w, T &&... words)
 
static constexpr unsigned size ()
 

Friends

template<unsigned Elems2>
class mask
 

Constructor & Destructor Documentation

◆ mask() [1/2]

template<unsigned Elems>
__aie_inline constexpr aie::detail::mask< Elems >::mask ( bool  initial_set = false)
inlineexplicitconstexpr

Creates a mask

Parameters
initial_setIf true, the mask is initialized with 1s, otherise it is initialized with 0s.

◆ mask() [2/2]

template<unsigned Elems>
template<typename... T>
constexpr aie::detail::mask< Elems >::mask ( unsigned  w,
T &&...  words 
)
inlineexplicitconstexpr

Construct from unsigned (32b) words. Each bit in the input words is used to initialize one of the elements in the mask.

Parameters
wFirst word used to initialize the mask.
wordsRest of words used to initialize the mask.

Member Function Documentation

◆ clear()

template<unsigned Elems>
__aie_inline constexpr void aie::detail::mask< Elems >::clear ( unsigned  i)
inlineconstexpr

Sets the value of the element in the given index to 0.

Parameters
iElement index.

◆ clz()

template<unsigned Elems>
__aie_inline constexpr unsigned aie::detail::mask< Elems >::clz ( ) const
inlineconstexpr

Returns the count of consecutive elements, starting at the high part of the mask, whose value is 0.

◆ count()

template<unsigned Elems>
__aie_inline constexpr unsigned aie::detail::mask< Elems >::count ( ) const
inlineconstexpr

Returns the count of elements whose value is 1.

◆ data()

template<unsigned Elems>
__aie_inline constexpr const std::array< unsigned, num_words > & aie::detail::mask< Elems >::data ( ) const
inlineconstexpr

◆ empty()

template<unsigned Elems>
__aie_inline constexpr bool aie::detail::mask< Elems >::empty ( ) const
inlineconstexpr

Returns a bool that says whether the value of all the elements in the mask is 0.

◆ from_masks()

template<unsigned Elems>
template<unsigned Elems2, typename... T>
__aie_inline static constexpr mask< Elems > aie::detail::mask< Elems >::from_masks ( const mask< Elems2 > &  m,
T &&...  masks 
)
inlinestaticconstexpr

◆ from_uint32()

template<unsigned Elems>
template<typename... T>
__aie_inline static constexpr mask< Elems > aie::detail::mask< Elems >::from_uint32 ( unsigned  w,
T &&...  words 
)
inlinestaticconstexpr

Construct from unsigned (32b) words. Each bit in the input words is used to initialize one of the elements in the mask.

Parameters
wFirst word used to initialize the mask.
wordsRest of words used to initialize the mask.

◆ from_uint64()

template<unsigned Elems>
template<typename... T>
__aie_inline static constexpr mask< Elems > aie::detail::mask< Elems >::from_uint64 ( uint64_t  w,
T &&...  words 
)
inlinestaticconstexpr

Construct from unsigned (64b) words. Each bit in the input words is used to initialize one of the elements in the mask.

Parameters
wFirst word used to initialize the mask.
wordsRest of words used to initialize the mask.

◆ full()

template<unsigned Elems>
__aie_inline constexpr bool aie::detail::mask< Elems >::full ( ) const
inlineconstexpr

Returns a bool that says whether the value of all the elements in the mask is 1.

◆ get_submask()

template<unsigned Elems>
template<unsigned ElemsOut>
__aie_inline constexpr mask< ElemsOut > aie::detail::mask< Elems >::get_submask ( unsigned  i) const
inlineconstexpr

◆ operator&()

template<unsigned Elems>
__aie_inline constexpr mask aie::detail::mask< Elems >::operator& ( const mask< Elems > &  a) const
inlineconstexpr

Returns the result of merging the current and the given masks using the AND operation.

Parameters
aMask to merge with.

◆ operator&=()

template<unsigned Elems>
__aie_inline constexpr mask & aie::detail::mask< Elems >::operator&= ( const mask< Elems > &  a)
inlineconstexpr

Updates the mask with the result of merging the current with the given masks using the AND operation. Returns a reference to the updated mask.

Parameters
aMask to merge with.

◆ operator<<()

template<unsigned Elems>
__aie_inline constexpr mask aie::detail::mask< Elems >::operator<< ( unsigned  shift) const
inlineconstexpr

Returns the result of a binary left shift of the mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator<<=()

template<unsigned Elems>
constexpr mask & aie::detail::mask< Elems >::operator<<= ( unsigned  shift)
inlineconstexpr

Returns the result of a binary left shift of the mask. Returns a reference to the updated mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator==()

template<unsigned Elems>
__aie_inline constexpr bool aie::detail::mask< Elems >::operator== ( const mask< Elems > &  a) const
inlineconstexpr

Compares whether two masks are equal.

Parameters
aMask to compare against.

◆ operator>>()

template<unsigned Elems>
__aie_inline constexpr mask aie::detail::mask< Elems >::operator>> ( unsigned  shift) const
inlineconstexpr

Returns the result of a binary right shift of the mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator>>=()

template<unsigned Elems>
constexpr mask & aie::detail::mask< Elems >::operator>>= ( unsigned  shift)
inlineconstexpr

Returns the result of a binary right shift of the mask. Returns a reference to the updated mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator|()

template<unsigned Elems>
__aie_inline constexpr mask aie::detail::mask< Elems >::operator| ( const mask< Elems > &  a) const
inlineconstexpr

Returns the result of merging the current and the given masks using the OR operation.

Parameters
aMask to merge with.

◆ operator|=()

template<unsigned Elems>
__aie_inline constexpr mask & aie::detail::mask< Elems >::operator|= ( const mask< Elems > &  a)
inlineconstexpr

Updates the mask with the result of merging the current and the given masks using the OR operation. Returns a reference to the updated mask.

Parameters
aMask to merge with.

◆ operator~()

template<unsigned Elems>
__aie_inline constexpr mask aie::detail::mask< Elems >::operator~ ( ) const
inlineconstexpr

Returns a mask that contains the negation of the values of all the elements in the mask (0->1, 1->0).

◆ set()

template<unsigned Elems>
__aie_inline constexpr void aie::detail::mask< Elems >::set ( unsigned  i)
inlineconstexpr

Sets the value of the element in the given index to 1.

Parameters
iElement index.

◆ size()

template<unsigned Elems>
static constexpr unsigned aie::detail::mask< Elems >::size ( )
inlinestaticconstexpr

Returns the number of elements in the mask

◆ test()

template<unsigned Elems>
__aie_inline constexpr bool aie::detail::mask< Elems >::test ( unsigned  i) const
inlineconstexpr

Returns the value of the element in the given index.

Parameters
iElement index.

◆ to_uint32() [1/2]

template<unsigned Elems>
template<unsigned Elems2 = Elems>
requires (Elems2 <= 32)
__aie_inline constexpr unsigned aie::detail::mask< Elems >::to_uint32 ( ) const
inlineconstexpr

◆ to_uint32() [2/2]

template<unsigned Elems>
__aie_inline constexpr unsigned aie::detail::mask< Elems >::to_uint32 ( unsigned  i) const
inlineconstexpr

◆ to_uint64() [1/2]

template<unsigned Elems>
template<unsigned Elems2 = Elems>
requires (Elems2 == 64)
__aie_inline constexpr uint64_t aie::detail::mask< Elems >::to_uint64 ( ) const
inlineconstexpr

◆ to_uint64() [2/2]

template<unsigned Elems>
__aie_inline constexpr uint64_t aie::detail::mask< Elems >::to_uint64 ( unsigned  i) const
inlineconstexpr

Friends And Related Function Documentation

◆ mask

template<unsigned Elems>
template<unsigned Elems2>
friend class mask
friend

Type for vector element masks. The documentation of this class and its members can be found at detail::mask.

This type is returned by logical operations and used as input in selection operations.

Template Parameters
ElemsNumber of elements represented in the mask.

The documentation for this class was generated from the following file: