CGRA-ME
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
MappingGraph Class Reference

#include <Mapping.h>

Classes

struct  NodeDescriptor
 
struct  NodeDescriptorHash
 
struct  VerifyMessage
 

Public Types

using ToMRRGVertexMap = std::unordered_map< NodeDescriptor, MRRG::NodeDescriptor, NodeDescriptorHash >
 

Public Member Functions

 MappingGraph ()=default
 
 MappingGraph (const MappingGraph &src)=default
 
 MappingGraph (MappingGraph &&)=default
 
MappingGraphoperator= (const MappingGraph &rhs)=default
 
MappingGraphoperator= (MappingGraph &&)=default
 
std::pair< NodeDescriptor, bool > insert (MappingGraphNode node)
 
std::pair< NodeDescriptor, bool > insert (NodeDescriptor fanin, MappingGraphNode node)
 
bool contains (NodeDescriptor node)
 
bool contains (std::ptrdiff_t id)
 
template<typename NodeDescList = std::vector<NodeDescriptor>>
std::pair< NodeDescriptor, bool > insertMultiFanin (NodeDescList fanins, MappingGraphNode node)
 
void link (MappingGraph::NodeDescriptor driver, MappingGraph::NodeDescriptor fanout)
 
void unlink (MappingGraph::NodeDescriptor driver, MappingGraph::NodeDescriptor fanout)
 
void erase (MappingGraph::NodeDescriptor n)
 
MappingGraphNodegetNodeRef (NodeDescriptor ndesc)
 
const MappingGraphNodegetNodeRef (NodeDescriptor ndesc) const
 
auto & fanout (NodeDescriptor ndesc) const
 
auto & fanin (const NodeDescriptor ndesc) const
 
std::vector< VerifyMessageverify (const MRRG &mrrg, const ToMRRGVertexMap &toMRRG) const
 
void printDot (std::ostream &os, const MRRG &mrrg, const OpGraph &opgraph, const ToMRRGVertexMap &toMRRG, const ConfigStore &archAttributes) const
 
std::ptrdiff_t size () const
 
auto & allNodes () const
 

Private Attributes

NodeDescriptor nextId = {1}
 
std::unordered_map< NodeDescriptor, MappingGraphNode, NodeDescriptorHashnodes = {}
 
std::unordered_set< int > deletedIds = {}
 
std::unordered_map< NodeDescriptor, std::vector< NodeDescriptor >, NodeDescriptorHashfanout_lists = {}
 
std::unordered_map< NodeDescriptor, std::vector< NodeDescriptor >, NodeDescriptorHashfanin_lists = {}
 

Detailed Description

Definition at line 129 of file Mapping.h.

Member Typedef Documentation

◆ ToMRRGVertexMap

Definition at line 146 of file Mapping.h.

Constructor & Destructor Documentation

◆ MappingGraph() [1/3]

MappingGraph::MappingGraph ( )
default

◆ MappingGraph() [2/3]

MappingGraph::MappingGraph ( const MappingGraph src)
default

◆ MappingGraph() [3/3]

MappingGraph::MappingGraph ( MappingGraph &&  )
default

Member Function Documentation

◆ allNodes()

auto& MappingGraph::allNodes ( ) const
inline

Definition at line 234 of file Mapping.h.

◆ contains() [1/2]

bool MappingGraph::contains ( NodeDescriptor  node)
inline

Definition at line 162 of file Mapping.h.

◆ contains() [2/2]

bool MappingGraph::contains ( std::ptrdiff_t  id)
inline

Definition at line 165 of file Mapping.h.

◆ erase()

void MappingGraph::erase ( MappingGraph::NodeDescriptor  n)

Remove the node from the graph. Disconnects all fanout & fanin

Definition at line 340 of file Mapping.cpp.

◆ fanin()

auto& MappingGraph::fanin ( const NodeDescriptor  ndesc) const
inline

Gives a list of elements that fan-out from the given descriptor. Allows a MappingGraph to be used with most graph algorithms.

Definition at line 207 of file Mapping.h.

◆ fanout()

auto& MappingGraph::fanout ( NodeDescriptor  ndesc) const
inline

Gives a list of elements that fan-out from the given descriptor. Allows a MappingGraph to be used with most graph algorithms.

Definition at line 201 of file Mapping.h.

◆ getNodeRef() [1/2]

MappingGraphNode & MappingGraph::getNodeRef ( NodeDescriptor  ndesc)

Get an actual node object from your descriptor. Undefined Behaviour if this node is not in this MappingGraph.

Definition at line 359 of file Mapping.cpp.

◆ getNodeRef() [2/2]

const MappingGraphNode & MappingGraph::getNodeRef ( NodeDescriptor  ndesc) const

Definition at line 363 of file Mapping.cpp.

◆ insert() [1/2]

auto MappingGraph::insert ( MappingGraphNode  node)

Add node to this MappingGraph by std::moveing it to the heap. Overloads with a fanin(s) argument also add link(s) from the node(s) in that argument.

Definition at line 303 of file Mapping.cpp.

◆ insert() [2/2]

std::pair<NodeDescriptor,bool> MappingGraph::insert ( NodeDescriptor  fanin,
MappingGraphNode  node 
)
inline

Definition at line 160 of file Mapping.h.

◆ insertMultiFanin()

template<typename NodeDescList = std::vector<NodeDescriptor>>
std::pair<NodeDescriptor,bool> MappingGraph::insertMultiFanin ( NodeDescList  fanins,
MappingGraphNode  node 
)
inline

Definition at line 170 of file Mapping.h.

◆ link()

void MappingGraph::link ( MappingGraph::NodeDescriptor  driver,
MappingGraph::NodeDescriptor  fanout 
)

For creating and destroying edges between nodes in an MappingGraph All may perform some checks (especially when unlinking) on the validity of the graph, throwing if something is wrong. Overall, better than manipulating the fanout & fanin lists directly.

Definition at line 317 of file Mapping.cpp.

◆ operator=() [1/2]

MappingGraph& MappingGraph::operator= ( const MappingGraph rhs)
default

◆ operator=() [2/2]

MappingGraph& MappingGraph::operator= ( MappingGraph &&  )
default

◆ printDot()

void MappingGraph::printDot ( std::ostream &  os,
const MRRG mrrg,
const OpGraph opgraph,
const ToMRRGVertexMap toMRRG,
const ConfigStore archAttributes 
) const

Print a machine readable text form of this graph. Uses the classic .dot format, openable with xdot and other programs.

Definition at line 419 of file Mapping.cpp.

◆ size()

std::ptrdiff_t MappingGraph::size ( ) const

The number of nodes. No guarantee on time complexity.

Definition at line 313 of file Mapping.cpp.

◆ unlink()

void MappingGraph::unlink ( MappingGraph::NodeDescriptor  driver,
MappingGraph::NodeDescriptor  fanout 
)

Definition at line 327 of file Mapping.cpp.

◆ verify()

std::vector< MappingGraph::VerifyMessage > MappingGraph::verify ( const MRRG mrrg,
const ToMRRGVertexMap toMRRG 
) const

Conduct BFS from all the functional units, in both directions (fanouts and fanins), any unvisited routing units after BFS should be removed from the graph.

Definition at line 367 of file Mapping.cpp.

Member Data Documentation

◆ deletedIds

std::unordered_set<int> MappingGraph::deletedIds = {}
private

Definition at line 239 of file Mapping.h.

◆ fanin_lists

std::unordered_map<NodeDescriptor, std::vector<NodeDescriptor>, NodeDescriptorHash> MappingGraph::fanin_lists = {}
private

Definition at line 242 of file Mapping.h.

◆ fanout_lists

std::unordered_map<NodeDescriptor, std::vector<NodeDescriptor>, NodeDescriptorHash> MappingGraph::fanout_lists = {}
private

Definition at line 241 of file Mapping.h.

◆ nextId

NodeDescriptor MappingGraph::nextId = {1}
private

Definition at line 237 of file Mapping.h.

◆ nodes

std::unordered_map<NodeDescriptor, MappingGraphNode, NodeDescriptorHash> MappingGraph::nodes = {}
private

Definition at line 238 of file Mapping.h.


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