File tree Expand file tree Collapse file tree 6 files changed +52
-25
lines changed
include/rocRoller/KernelGraph Expand file tree Collapse file tree 6 files changed +52
-25
lines changed Original file line number Diff line number Diff line change 77
88namespace rocRoller ::KernelGraph::DataDependenceDAG
99{
10+ /* *
11+ * Builds the data dependence graph for the given kernel graph,
12+ * specifically based on its control graph portion. It explicitly
13+ * represents only the data dependences(flow, anti, and output) between
14+ * the control graph nodes at the basic-block level.
15+ *
16+ * The data dependence graph has no cycles in it, therefore it
17+ * is termed as data dependence DAG (directed acyclic graph).
18+ *
19+ * It describes the dependency relationship between the control graph nodes,
20+ * so it makes sense to use the existing `rocRoller::KernelGraph::ControlGraph`
21+ * structure for its represenatation.
22+ *
23+ * The dependences are indicated using `Sequence` edges at each basic-block
24+ * level i.e. between the nodes sharing the same immediate body-parent
25+ * in `graph.control`.
26+ */
1027 ControlGraph::ControlGraph ConstructDataDependenceDAG (KernelGraph const & graph);
1128}
Original file line number Diff line number Diff line change @@ -10,12 +10,36 @@ namespace rocRoller::KernelGraph::DataDependenceDAG::Detail
1010 class DataDependenceDAGDetail
1111 {
1212 public:
13+ /* *
14+ * Initializes the data dependence DAG structure (`m_dependenceDAG`)
15+ * with only the control nodes from the given kernel graph.
16+ */
1317 DataDependenceDAGDetail (KernelGraph const & graph);
1418
15- int getBodyParent (int control);
16- void addDependenceEdge (int sourceControl, int destControl);
19+ /* *
20+ * Returns the body-parent for the given node in the control graph.
21+ */
22+ int getBodyParent (int control);
23+ /* *
24+ * Adds a dependence edge(represented via `Sequence`) between the given
25+ * source and destination nodes in the dependence DAG (`m_dependenceDAG),
26+ * if both the nodes have the same body-parent.
27+ */
28+ void addDependenceEdge (int source, int dest);
29+ /* *
30+ * Makes necessary updates to `m_latestWriteToCoord`, `m_latestReadsToCoord`
31+ * and `m_dependenceDAG` structures for the given `ReadWriteRecord`.
32+ */
1733 void processReadWriteRecord (ControlFlowRWTracer::ReadWriteRecord const & record);
34+ /* *
35+ * Builds the data dependence DAG by populating the `m_dependenceDAG` structure
36+ * with required dependence edges based on the trace generated using `ControlFlowRWTracer`
37+ * for `m_graph`.
38+ */
1839 void constructDataDependenceDAG ();
40+ /* *
41+ * Returns the data dependence DAG (`m_dependenceDAG`).
42+ */
1943 ControlGraph::ControlGraph getDataDependenceDAG ();
2044
2145 private:
Original file line number Diff line number Diff line change @@ -46,15 +46,6 @@ namespace rocRoller::KernelGraph
4646 * `graph.control`.
4747 */
4848 void orderNodes (KernelGraph const & graph, std::vector<int >& nodes, auto const & comp);
49-
50- /* *
51- * Builds the data dependence graph for the given kernel graph.
52- *
53- * The dependences are represented at each basic block level i.e. between the
54- * nodes sharing the same immediate body-parent in `graph.control`.
55- * The flow, anti, and output data dependences between such nodes are included.
56- */
57- ControlGraph::ControlGraph ConstructDataDependenceDAG (KernelGraph const & graph);
5849 }
5950}
6051
Original file line number Diff line number Diff line change @@ -78,21 +78,19 @@ namespace rocRoller::KernelGraph
7878 return bodyParent.value ();
7979 }
8080
81- void DataDependenceDAGDetail::addDependenceEdge (int sourceControl , int destControl )
81+ void DataDependenceDAGDetail::addDependenceEdge (int source , int dest )
8282 {
83- AssertFatal (
84- sourceControl != destControl, ShowValue (sourceControl), ShowValue (destControl));
83+ AssertFatal (source != dest, ShowValue (source), ShowValue (dest));
8584
86- auto sourceBodyParent = getBodyParent (sourceControl );
87- auto destBodyParent = getBodyParent (destControl );
85+ auto sourceBodyParent = getBodyParent (source );
86+ auto destBodyParent = getBodyParent (dest );
8887
8988 if (sourceBodyParent != destBodyParent)
9089 return ;
9190
92- if (!m_dependenceDAG.findEdge (sourceControl, destControl ).has_value ())
91+ if (!m_dependenceDAG.findEdge (source, dest ).has_value ())
9392 {
94- m_dependenceDAG.addElement (
95- ControlGraph::Sequence (), {sourceControl}, {destControl});
93+ m_dependenceDAG.addElement (ControlGraph::Sequence (), {source}, {dest});
9694 }
9795 }
9896
Original file line number Diff line number Diff line change 66#include < rocRoller/KernelGraph/Transforms/Simplify.hpp>
77#include < rocRoller/KernelGraph/Utils.hpp>
88
9- #include < map>
10- #include < unordered_map>
11- #include < unordered_set>
12-
139namespace rocRoller ::KernelGraph::NodeScheduling
1410{
1511 ControlGraph::ControlGraph createSubGraph (KernelGraph const & graph,
@@ -55,4 +51,5 @@ namespace rocRoller::KernelGraph::NodeScheduling
5551
5652 return subGraph;
5753 }
54+
5855}
Original file line number Diff line number Diff line change @@ -1098,7 +1098,7 @@ namespace rocRoller
10981098 tag = *parent;
10991099
11001100 AssertFatal (graph.mapper .get <CT::Unroll>(tag) > 0 ,
1101- " SetCoordinate needs Unroll/ForLoop dimension" );
1101+ " SetCoordinate needs Unroll dimension" );
11021102
11031103 result.insert (tag);
11041104 }
@@ -1125,7 +1125,7 @@ namespace rocRoller
11251125
11261126 AssertFatal (graph.mapper .get <CT::Unroll>(tag) > 0
11271127 || graph.mapper .get <CT::ForLoop>(tag) > 0 ,
1128- " SetCoordinate needs Unroll dimension" );
1128+ " SetCoordinate needs Unroll/ForLoop dimension" );
11291129 }
11301130 return tag;
11311131 }
You can’t perform that action at this time.
0 commit comments