ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::Shuffle Class Referencefinal

Generic element transfer. More...

#include <Instrs.h>

Collaboration diagram for coco::Shuffle:

Public Member Functions

 Shuffle ()
 
ShuffleasShuffle (void) override
 
const ShuffleasShuffle (void) const override
 
Instrloc (void) override
 
Bagfrom (void) const
 
void from (Bag *bag)
 
Baginto (void) const
 
void into (Bag *)
 
uint32_t size (void) const
 Return the number of Element-wise transfers.
 
std::set< ElemIDrange (void) const
 Return a set of elements in the destination bag that Shuffle will update.
 
bool defined (const ElemID &dst) const
 Return true if a given elem is updated after execution.
 
const ElemIDat (const ElemID &dst) const
 
void insert (const ElemID &from, const ElemID &into)
 
- Public Member Functions inherited from coco::Instr
 Instr ()=default
 
 Instr (const Instr &)=delete
 
 Instr (Instr &&)=delete
 
virtual ~Instr ()
 
template<typename T >
accept (IVisitor< T > *v) const
 
template<typename T >
accept (IVisitor< T > &v) const
 
template<typename T >
accept (IVisitor< T > &&v) const
 
const InstrIndexindex (void) const
 
- Public Member Functions inherited from coco::DLinkedList< Child, Parent >::Node
 Node ()
 
virtual ~Node ()
 
Parent * parent (void) const
 
Child * prev (void) const
 
Child * next (void) const
 
void insertBefore (Node *next)
 
void insertAfter (Node *prev)
 
void detach (void)
 
- Public Member Functions inherited from coco::Entity
virtual ~Entity ()=default
 
Modulemodule (void) const
 
- Public Member Functions inherited from coco::Bag::Reader
virtual ~Reader ()=default
 
- Public Member Functions inherited from coco::Locatable
virtual ~Locatable ()=default
 
- Public Member Functions inherited from coco::Bag::Updater
virtual ~Updater ()=default
 

Detailed Description

Generic element transfer.

Definition at line 115 of file Instrs.h.

Constructor & Destructor Documentation

◆ Shuffle()

coco::Shuffle::Shuffle ( )
inline

Definition at line 118 of file Instrs.h.

118 : _from{this}, _into{this}
119 {
120 // DO NOTHING
121 }

Member Function Documentation

◆ asShuffle() [1/2]

const Shuffle * coco::Shuffle::asShuffle ( void  ) const
inlineoverride

Definition at line 125 of file Instrs.h.

125{ return this; }

◆ asShuffle() [2/2]

Shuffle * coco::Shuffle::asShuffle ( void  )
inlineoverride

Definition at line 124 of file Instrs.h.

124{ return this; }

Referenced by enco::hoist_object().

◆ at()

const ElemID & coco::Shuffle::at ( const ElemID dst) const
inline

Let M be the return of at(N). This means that N-th element in the destination bag will be filled with the value of M-th element in the source bag.

NOTE at(n) may be undefined on partial shuffle

Definition at line 160 of file Instrs.h.

160{ return _content.at(dst); }

Referenced by enco::hoist_object().

◆ defined()

bool coco::Shuffle::defined ( const ElemID dst) const
inline

Return true if a given elem is updated after execution.

Definition at line 151 of file Instrs.h.

151{ return _content.find(dst) != _content.end(); }

◆ from() [1/2]

void coco::Shuffle::from ( Bag bag)

Definition at line 38 of file Shuffle.cpp.

38{ _from.bag(b); }
Bag * bag(void) const
Definition Read.h:41

References coco::Read::bag().

◆ from() [2/2]

Bag * coco::Shuffle::from ( void  ) const
inline

Definition at line 131 of file Instrs.h.

131{ return _from.bag(); }

References coco::Read::bag().

Referenced by enco::generate_bypass_shuffle(), enco::hoist_object(), insert(), enco::lower_copy(), and InstrPrinter::visit().

◆ insert()

void coco::Shuffle::insert ( const ElemID from,
const ElemID into 
)

Definition at line 36 of file Shuffle.cpp.

36{ _content[into] = from; }
Bag * from(void) const
Definition Instrs.h:131
Bag * into(void) const
Definition Instrs.h:135

References from(), and into().

◆ into() [1/2]

void coco::Shuffle::into ( Bag b)

Definition at line 39 of file Shuffle.cpp.

39{ _into.bag(b); }
Bag * bag(void) const
Definition Update.h:37

References coco::Update::bag().

◆ into() [2/2]

Bag * coco::Shuffle::into ( void  ) const
inline

Definition at line 135 of file Instrs.h.

135{ return _into.bag(); }

References coco::Update::bag().

Referenced by enco::hoist_object(), insert(), and InstrPrinter::visit().

◆ loc()

Instr * coco::Shuffle::loc ( void  )
inlineoverridevirtual

Implements coco::Locatable.

Definition at line 128 of file Instrs.h.

128{ return this; }

◆ range()

std::set< ElemID > coco::Shuffle::range ( void  ) const

Return a set of elements in the destination bag that Shuffle will update.

Definition at line 24 of file Shuffle.cpp.

25{
26 std::set<ElemID> res;
27
28 for (auto it = _content.begin(); it != _content.end(); ++it)
29 {
30 res.insert(it->first);
31 }
32
33 return res;
34}

◆ size()

uint32_t coco::Shuffle::size ( void  ) const

Return the number of Element-wise transfers.

NOTE size() SHOULD BE identical to range().size()

Definition at line 22 of file Shuffle.cpp.

22{ return _content.size(); }

Referenced by tflimport::ReshapeGraphBuilder::build().


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