CGRA-ME
|
#include <OpGraph.h>
Classes | |
struct | EdgeDescriptor |
struct | OpOpInsertResult |
struct | VerifyMessage |
Public Types | |
using | NodeDescriptor = const OpGraphNode * |
using | OpDescriptor = const OpGraphOp * |
using | ValDescriptor = const OpGraphVal * |
using | Walk = std::vector< EdgeDescriptor > |
Public Member Functions | |
OpGraph () | |
OpGraph (const OpGraph &) | |
OpGraph (OpGraph &&)=default | |
OpGraph & | operator= (const OpGraph &) |
OpGraph & | operator= (OpGraph &&)=default |
~OpGraph () | |
OpDescriptor | insert (OpGraphOp op) |
template<typename... Args> | |
OpDescriptor | emplace (Args &&... args) |
OpOpInsertResult | insert (OpDescriptor driver, OpGraphOp fanout, std::string operand_group, int bitwidth=32, int dist=0, EdgeKind kind=EdgeKind::kDataFlow) |
ValDescriptor | link (OpDescriptor driver, OpDescriptor fanout, std::string operand_group, int bitwidth=32, int dist=0, EdgeKind kind=EdgeKind::kDataFlow, bool predicate=false) |
ValDescriptor | link (ValDescriptor val, OpDescriptor fanout, std::string operand_group) |
ValDescriptor | link_like (OpDescriptor driver, OpDescriptor fanout, EdgeDescriptor base) |
void | unLink (ValDescriptor driver_val, OpDescriptor fanout) |
void | erase (OpDescriptor op) |
auto & | opNodes () const |
auto & | valNodes () const |
auto & | aliasNodes () const |
ValDescriptor | outputVal (OpDescriptor op) const |
std::vector< ValDescriptor > | outputVals (OpDescriptor op_desc) const |
const std::vector< OpGraphVal * > & | inputVals (OpDescriptor op) const |
const std::vector< OpGraphOp * > & | outputOps (ValDescriptor op) const |
const std::vector< OpGraphOp * > & | outputOps (OpDescriptor op) const |
std::vector< OpDescriptor > | inputOps (OpDescriptor op) const |
const std::vector< OpGraphOp * > & | fanout (OpDescriptor op) const |
OpDescriptor | inputOp (ValDescriptor val) const |
const OperandTag & | getOperandTag (EdgeDescriptor edge) const |
const int | getDist (EdgeDescriptor edge) const |
const int | getBitwidth (EdgeDescriptor edge) const |
const EdgeKind | getKind (EdgeDescriptor edge) const |
OpDescriptor | targetOfEdge (EdgeDescriptor ed) const |
std::vector< EdgeDescriptor > | outEdges (const OpDescriptor &op) const |
std::vector< EdgeDescriptor > | inEdges (const OpDescriptor &op) const |
decltype(auto) | fanout (const EdgeDescriptor &ed) const |
decltype(auto) | fanin (const EdgeDescriptor &ed) const |
OpGraphOp & | getNodeRef (OpDescriptor ndesc) |
const OpGraphOp & | getNodeRef (OpDescriptor ndesc) const |
OpGraphVal & | getNodeRef (ValDescriptor ndesc) |
const OpGraphVal & | getNodeRef (ValDescriptor ndesc) const |
OpGraphNode & | getNodeRef (NodeDescriptor ndesc) |
const OpGraphNode & | getNodeRef (NodeDescriptor ndesc) const |
OpDescriptor | getOp (const std::string &name) const |
ValDescriptor | getVal (const std::string &name) const |
OpGraphOp & | getOpRef (const std::string &name) |
const OpGraphOp & | getOpRef (const std::string &name) const |
OpGraphVal & | getValRef (const std::string &name) |
const OpGraphVal & | getValRef (const std::string &name) const |
int | getOpIndex (OpGraphOp *op) const |
int | getValIndex (OpGraphVal *op) const |
int | getAliasIndex (OpGraphVal *op) const |
const OpGraphOp * | getOpByIndex (int index) const |
const OpGraphVal * | getValByIndex (int index) const |
OpDescriptor | asOp (NodeDescriptor ndesc) const |
ValDescriptor | asVal (NodeDescriptor ndesc) const |
int | getMaxCycle () |
std::map< EdgeDescriptor, int > | edgeLatencies () const |
void | print_dot (std::ostream &s) const |
void | printDOTwithOps (std::ostream &s) const |
void | serialize (std::ostream &s) const |
void | serialize (std::ostream &s, const std::map< OpDescriptor, int > &op_print_ranking) const |
void | clear () |
std::vector< VerifyMessage > | verify () const |
Private Attributes | |
std::vector< OpGraphOp * > | op_nodes |
std::vector< OpGraphVal * > | val_nodes |
std::vector< OpGraphVal * > | alias_nodes |
std::unordered_map< std::string, OpDescriptor > | ops_by_name |
std::unordered_map< std::string, ValDescriptor > | vals_by_name |
std::vector< std::unique_ptr< OpGraphNode > > | defunct_nodes = {} |
Static Private Attributes | |
static const std::vector< OpGraphOp * > | empty_op_vector = {} |
static const std::vector< OpGraphVal * > | empty_val_vector = {} |
static const std::vector< EdgeDescriptor > | empty_edge_vector = {} |
static constexpr ValDescriptor | null_val = nullptr |
static constexpr OpDescriptor | null_op = nullptr |
static constexpr EdgeDescriptor | null_edge = {nullptr, -1} |
Friends | |
bool | operator== (const OpGraph &lhs, const OpGraph &rhs) |
bool | operator!= (const OpGraph &lhs, const OpGraph &rhs) |
std::ostream & | operator<< (std::ostream &os, const OpGraph &og) |
using OpGraph::NodeDescriptor = const OpGraphNode* |
using OpGraph::OpDescriptor = const OpGraphOp* |
using OpGraph::ValDescriptor = const OpGraphVal* |
using OpGraph::Walk = std::vector<EdgeDescriptor> |
OpGraph::OpGraph | ( | ) |
Create an empty graph. see also createOpGraphFromConfig
in OpGraphProcedures.h
Definition at line 282 of file OpGraph.cpp.
OpGraph::OpGraph | ( | const OpGraph & | src | ) |
Move-only for now, as copying unimplemented.
Definition at line 310 of file OpGraph.cpp.
|
default |
OpGraph::~OpGraph | ( | ) |
Assumes ownership of all nodes
Definition at line 294 of file OpGraph.cpp.
auto OpGraph::asOp | ( | NodeDescriptor | ndesc | ) | const |
Cast to descriptor subtype May crash if called from no-RTTI code, eg LLVM plugins
Definition at line 1275 of file OpGraph.cpp.
auto OpGraph::asVal | ( | NodeDescriptor | ndesc | ) | const |
Definition at line 1276 of file OpGraph.cpp.
void OpGraph::clear | ( | ) |
Make this graph empty, free all memory.
Definition at line 296 of file OpGraph.cpp.
auto OpGraph::edgeLatencies | ( | ) | const |
A hold-over until this information is annotated directly on the OpGraph. Finds edges that cause cycles, and assumes that they require a latency of 1. All other edges are assumed to have latency 0. The returned map is surjective; it covers the entire domain of edges.
Definition at line 906 of file OpGraph.cpp.
|
inline |
void OpGraph::erase | ( | OpDescriptor | op | ) |
Remove op from this DFG, as well as connecting edges Does not affect existing operand indexes
Definition at line 453 of file OpGraph.cpp.
|
inline |
|
inline |
|
inline |
int OpGraph::getAliasIndex | ( | OpGraphVal * | op | ) | const |
Definition at line 765 of file OpGraph.cpp.
const int OpGraph::getBitwidth | ( | EdgeDescriptor | edge | ) | const |
Definition at line 517 of file OpGraph.cpp.
const int OpGraph::getDist | ( | EdgeDescriptor | edge | ) | const |
Get the dist output of val
Definition at line 513 of file OpGraph.cpp.
const EdgeKind OpGraph::getKind | ( | EdgeDescriptor | edge | ) | const |
Definition at line 521 of file OpGraph.cpp.
int OpGraph::getMaxCycle | ( | ) |
Definition at line 867 of file OpGraph.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
const OpGraphOp * OpGraph::getOpByIndex | ( | int | index | ) | const |
Get the operation at index x within the vector
Definition at line 774 of file OpGraph.cpp.
const OperandTag & OpGraph::getOperandTag | ( | EdgeDescriptor | edge | ) | const |
Get the operand group name that is associated with the i'th output of val
Definition at line 509 of file OpGraph.cpp.
int OpGraph::getOpIndex | ( | OpGraphOp * | op | ) | const |
Get the index of the operation within the vector
Definition at line 747 of file OpGraph.cpp.
|
inline |
|
inline |
|
inline |
const OpGraphVal * OpGraph::getValByIndex | ( | int | index | ) | const |
Definition at line 782 of file OpGraph.cpp.
int OpGraph::getValIndex | ( | OpGraphVal * | op | ) | const |
Definition at line 756 of file OpGraph.cpp.
|
inline |
|
inline |
auto OpGraph::inEdges | ( | const OpDescriptor & | op | ) | const |
Definition at line 540 of file OpGraph.cpp.
auto OpGraph::inputOp | ( | ValDescriptor | val | ) | const |
Get the op that drives val. May return null op
Definition at line 504 of file OpGraph.cpp.
auto OpGraph::inputOps | ( | OpDescriptor | op | ) | const |
Definition at line 497 of file OpGraph.cpp.
const std::vector< OpGraphVal * > & OpGraph::inputVals | ( | OpDescriptor | op | ) | const |
Definition at line 551 of file OpGraph.cpp.
OpGraph::OpOpInsertResult OpGraph::insert | ( | OpDescriptor | driver, |
OpGraphOp | fanout, | ||
std::string | operand_group, | ||
int | bitwidth = 32 , |
||
int | dist = 0 , |
||
EdgeKind | kind = EdgeKind::kDataFlow |
||
) |
Definition at line 352 of file OpGraph.cpp.
OpGraph::OpDescriptor OpGraph::insert | ( | OpGraphOp | op | ) |
Move op into the graph, returning it's descriptor. The op will have no fanout. Returns the op's descriptor.
Definition at line 338 of file OpGraph.cpp.
OpGraph::ValDescriptor OpGraph::link | ( | OpDescriptor | driver, |
OpDescriptor | fanout, | ||
std::string | operand_group, | ||
int | bitwidth = 32 , |
||
int | dist = 0 , |
||
EdgeKind | kind = EdgeKind::kDataFlow , |
||
bool | predicate = false |
||
) |
Makes fanout a fanout of diver, creating the val if necessary. Returns the linking vals's descriptor.
Definition at line 364 of file OpGraph.cpp.
OpGraph::ValDescriptor OpGraph::link | ( | ValDescriptor | val, |
OpDescriptor | fanout, | ||
std::string | operand_group | ||
) |
Definition at line 408 of file OpGraph.cpp.
auto OpGraph::link_like | ( | OpDescriptor | driver, |
OpDescriptor | fanout, | ||
EdgeDescriptor | base | ||
) |
Same as the regular link, but get the edge properties from base
Definition at line 418 of file OpGraph.cpp.
Definition at line 319 of file OpGraph.cpp.
|
inline |
auto OpGraph::outEdges | ( | const OpDescriptor & | op | ) | const |
Hyper-edge output pins that originate from/terminate at op
Definition at line 530 of file OpGraph.cpp.
const std::vector< OpGraphOp * > & OpGraph::outputOps | ( | OpDescriptor | op | ) | const |
Definition at line 493 of file OpGraph.cpp.
const std::vector< OpGraphOp * > & OpGraph::outputOps | ( | ValDescriptor | op | ) | const |
Get the ops that op drives. (looks through val node) Returns an empty range if this op drives no val
Definition at line 488 of file OpGraph.cpp.
OpGraph::ValDescriptor OpGraph::outputVal | ( | OpDescriptor | op | ) | const |
Get the val that this op drives/vals that drive this op. May return the null descriptor or an empty list
Definition at line 476 of file OpGraph.cpp.
std::vector< OpGraph::ValDescriptor > OpGraph::outputVals | ( | OpDescriptor | op_desc | ) | const |
Definition at line 483 of file OpGraph.cpp.
void OpGraph::print_dot | ( | std::ostream & | s | ) | const |
Definition at line 1040 of file OpGraph.cpp.
void OpGraph::printDOTwithOps | ( | std::ostream & | s | ) | const |
Definition at line 1000 of file OpGraph.cpp.
void OpGraph::serialize | ( | std::ostream & | s | ) | const |
Print this graph in a way that looses no information. Reading it back should produce the same logical graph
The second overload allows you to specify an order to the ops. Lower means print earlier. Is also used for edge ordering.
Definition at line 1070 of file OpGraph.cpp.
void OpGraph::serialize | ( | std::ostream & | s, |
const std::map< OpDescriptor, int > & | op_print_ranking | ||
) | const |
Definition at line 1091 of file OpGraph.cpp.
auto OpGraph::targetOfEdge | ( | EdgeDescriptor | ed | ) | const |
Get the op that is at the target end of this edge. null edge gives null op
Definition at line 525 of file OpGraph.cpp.
void OpGraph::unLink | ( | ValDescriptor | driver_val, |
OpDescriptor | fanout | ||
) |
Remove this link Does not affect existing operand indexes
Definition at line 422 of file OpGraph.cpp.
auto OpGraph::verify | ( | ) | const |
Definition at line 684 of file OpGraph.cpp.
|
friend |
Definition at line 1159 of file OpGraph.cpp.
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
private |
|
private |
|
private |