CGRA-ME
Functions
Mapping.cpp File Reference
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <memory>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <deque>
#include <CGRA/utility/ConfigGraph.h>
#include <CGRA/Exception.h>
#include <CGRA/Mapping.h>
#include <CGRA/Module.h>
#include <CGRA/MRRGProcedures.h>
#include <CGRA/utility/Collections.h>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, MappingStatus ms)
 
static bool find_sink (const std::vector< MRRG::NodeDescriptor > &val_map, std::map< MRRG::NodeDescriptor, bool > &visited, MRRG::NodeDescriptor src, MRRG::NodeDescriptor sink)
 
Mapping withRemappedOps (const Mapping &src, const std::unordered_map< OpGraph::NodeDescriptor, OpGraph::NodeDescriptor > &forward_mappings)
 
CreateMappingGraphResult createMappingGraph (const MRRG &mrrg, const Mapping &m)
 
MappingGraph removeIsolatedRoutingNodes (const MappingGraph &mapping, const MRRG &mrrg, const MappingGraph::ToMRRGVertexMap &toMRRG)
 
std::pair< bool, MappingGraphCycleAssignmentlatencyCheck (const MappingGraph &mapping, const MRRG &mrrg, const CreateMappingGraphResult::ToMRRG &toMRRG)
 

Function Documentation

◆ createMappingGraph()

CreateMappingGraphResult createMappingGraph ( const MRRG mg,
const Mapping m 
)

Generates a mapping graph and the mapping to and from mapping graph nodes to mrrg nodes.

Definition at line 468 of file Mapping.cpp.

◆ find_sink()

static bool find_sink ( const std::vector< MRRG::NodeDescriptor > &  val_map,
std::map< MRRG::NodeDescriptor, bool > &  visited,
MRRG::NodeDescriptor  src,
MRRG::NodeDescriptor  sink 
)
static

Definition at line 99 of file Mapping.cpp.

◆ latencyCheck()

std::pair<bool, MappingGraphCycleAssignment> latencyCheck ( const MappingGraph mapping,
const MRRG mrrg,
const CreateMappingGraphResult::ToMRRG toMRRG 
)

Checks the mapping to make sure that the latencies are balanced.

Algorithm:

  1. Conduct BFS from unvisited nodes, moving in both directions, fanouts and fanins, tracking the latency needed to reach nodes.
  2. During BFS, if a search visits a node with t(n) + II = t(f) + latency, then it should be added to the set of nodes to check for cycles
  3. For the nodes to check for cycles: Conduct a BFS and ensure that a) we visit these nodes again to confirm cycle and b) the latency is t (n) + II.

Definition at line 582 of file Mapping.cpp.

◆ operator<<()

std::ostream& operator<< ( std::ostream &  os,
MappingStatus  ms 
)

Definition at line 28 of file Mapping.cpp.

◆ removeIsolatedRoutingNodes()

MappingGraph removeIsolatedRoutingNodes ( const MappingGraph mapping,
const MRRG mrrg,
const MappingGraph::ToMRRGVertexMap toMRRG 
)

Fixes the mapping by removing clusters of nodes that do not contain functional units

Definition at line 504 of file Mapping.cpp.

◆ withRemappedOps()

Mapping withRemappedOps ( const Mapping src,
const std::unordered_map< OpGraph::NodeDescriptor, OpGraph::NodeDescriptor > &  forward_mappings 
)

Returns a near copy of src, but for each key-value of forward_mappings, the nodes that were mapped to key are now mapped to value, and key is not present.

Definition at line 288 of file Mapping.cpp.