Go to the documentation of this file.
11 #ifndef __MAPPING_H___
12 #define __MAPPING_H___
16 #include <unordered_map>
17 #include <unordered_set>
47 std::map<OpGraph::NodeDescriptor,std::vector<MRRG::NodeDescriptor>>&
getMapping() {
return mapping; }
48 const std::map<OpGraph::NodeDescriptor,std::vector<MRRG::NodeDescriptor>>&
getMapping()
const {
return mapping; }
87 for (
const auto& og_node_and_mappings :
mapping) {
88 std::forward<F>(f)(og_node_and_mappings.first, og_node_and_mappings.second);
95 for (
auto& mrrg_node : mappings) {
96 std::forward<F>(f)(og_node, mrrg_node);
102 std::map<OpGraph::NodeDescriptor,std::vector<MRRG::NodeDescriptor>>
mapping = {};
120 const std::unordered_map<OpGraph::NodeDescriptor, OpGraph::NodeDescriptor>& forward_mappings
133 return this->
id == rhs.
id;
136 return this->
id < rhs.
id;
146 using ToMRRGVertexMap = std::unordered_map<NodeDescriptor, MRRG::NodeDescriptor, NodeDescriptorHash>;
169 template<
typename NodeDescList = std::vector<NodeDescriptor>>
171 auto ir =
insert(std::move(node));
232 std::ptrdiff_t
size()
const;
238 std::unordered_map<NodeDescriptor, MappingGraphNode, NodeDescriptorHash>
nodes = {};
248 using FromMRRG = std::unordered_map<MRRG::NodeDescriptor, MappingGraph::NodeDescriptor>;
270 std::pair<bool, MappingGraphCycleAssignment>
latencyCheck(
Mapping(std::shared_ptr< CGRA > cgra, int II, std::shared_ptr< OpGraph > opgraph)
std::pair< NodeDescriptor, bool > insert(NodeDescriptor fanin, MappingGraphNode node)
Mapping withRemappedOps(const Mapping &src, const std::unordered_map< OpGraph::NodeDescriptor, OpGraph::NodeDescriptor > &forward_mappings)
auto & fanin(const NodeDescriptor ndesc) const
MRRG::NodeDescriptor getSingleMapping(OpGraph::NodeDescriptor key) const
std::map< OpGraph::NodeDescriptor, std::vector< MRRG::NodeDescriptor > > & getMapping()
std::unordered_set< int > deletedIds
std::ostream & operator<<(std::ostream &os, MappingStatus ms)
CreateMappingGraphResult createMappingGraph(const MRRG &mg, const Mapping &m)
MappingGraph::ToMRRGVertexMap ToMRRG
double solve_time_in_seconds
auto getCGRA_shared() const
bool operator==(const NodeDescriptor &rhs) const
std::shared_ptr< OpGraph > opgraph
const std::vector< MRRG::NodeDescriptor > & getMappingList(OpGraph::NodeDescriptor key) const
void outputMapping(std::ostream &o=std::cout) const
void setMapping(std::map< OpGraph::NodeDescriptor, std::vector< MRRG::NodeDescriptor >> mapping)
void assertHasMapping(OpGraph::NodeDescriptor key) const
OpGraph::NodeDescriptor op_node_desc
MappingStatus getStatus() const
void printDot(std::ostream &os, const MRRG &mrrg, const OpGraph &opgraph, const ToMRRGVertexMap &toMRRG, const ConfigStore &archAttributes) const
std::unordered_map< NodeDescriptor, std::vector< NodeDescriptor >, NodeDescriptorHash > fanout_lists
void setNodeMapping(OpGraph::NodeDescriptor, std::vector< MRRG::NodeDescriptor > mapping)
void mapMRRGNode(OpGraph::NodeDescriptor, MRRG::NodeDescriptor node)
bool hasMapping(OpGraph::NodeDescriptor key) const
void erase(MappingGraph::NodeDescriptor n)
void assertHasSingleMapping(OpGraph::NodeDescriptor key) const
void outputValMapping(OpGraphVal *val, std::ostream &o=std::cout) const
MappingGraph & operator=(const MappingGraph &rhs)=default
bool verifyOpGraphMappingConnectivity()
std::size_t operator()(const NodeDescriptor &ndesc) const
std::unordered_map< NodeDescriptor, std::vector< NodeDescriptor >, NodeDescriptorHash > fanin_lists
std::unordered_map< MRRG::NodeDescriptor, MappingGraph::NodeDescriptor > FromMRRG
VerifyMessage(Type t, std::string s)
bool contains(std::ptrdiff_t id)
auto & fanout(NodeDescriptor ndesc) const
bool contains(NodeDescriptor node)
std::shared_ptr< CGRA > cgra
void forEachMappingList(F &&f) const
bool hasSingleMapping(OpGraph::NodeDescriptor key) const
std::unordered_map< NodeDescriptor, MRRG::NodeDescriptor, NodeDescriptorHash > ToMRRGVertexMap
auto end(const SingleItemImmutableSet< VertexID > &siis)
std::map< OpGraph::NodeDescriptor, std::vector< MRRG::NodeDescriptor > > mapping
std::vector< VerifyMessage > verify(const MRRG &mrrg, const ToMRRGVertexMap &toMRRG) const
std::ptrdiff_t size() const
void link(MappingGraph::NodeDescriptor driver, MappingGraph::NodeDescriptor fanout)
void outputDetailedMapping(std::ostream &o=std::cout) const
const OpGraph & getOpGraph() const
void forEachMapping(F &&f) const
MappingGraphNode & getNodeRef(NodeDescriptor ndesc)
std::pair< NodeDescriptor, bool > insertMultiFanin(NodeDescList fanins, MappingGraphNode node)
std::pair< NodeDescriptor, bool > insert(MappingGraphNode node)
MappingGraph removeIsolatedRoutingNodes(const MappingGraph &mapping, const MRRG &mrrg, const MappingGraph::ToMRRGVertexMap &toMRRG)
bool operator<(const NodeDescriptor &rhs) const
void unmapMRRGNode(OpGraph::NodeDescriptor, MRRG::NodeDescriptor node)
void unlink(MappingGraph::NodeDescriptor driver, MappingGraph::NodeDescriptor fanout)
std::pair< bool, MappingGraphCycleAssignment > latencyCheck(const MappingGraph &mapping, const MRRG &mrrg, const CreateMappingGraphResult::ToMRRG &toMRRG)
std::unordered_map< NodeDescriptor, MappingGraphNode, NodeDescriptorHash > nodes
void setStatus(MappingStatus new_status)
const std::map< OpGraph::NodeDescriptor, std::vector< MRRG::NodeDescriptor > > & getMapping() const
std::unordered_map< MappingGraph::NodeDescriptor, int, MappingGraph::NodeDescriptorHash > MappingGraphCycleAssignment