cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
326 stars 92 forks source link

[API] Allow users to create a dataflow graph #67

Closed seanlatias closed 6 years ago

seanlatias commented 6 years ago

Users can create a dataflow graph after creating the schedule.

s = hcl.create_schedule(...)
s.dataflow_graph()

This API returns a networkx.DiGraph. Users can inspect the nodes and edges. There are also several arguments to the API. First, users can specify which stage(s) should be in the dataflow graph. All their precedence stages will also be included. Second, users can specify the level of the graph. By default, all stages will be drawn. However, users, for instance, can generate only the top-most stages by specifying level=1. Finally, users can specify whether the graph should be plotted or not. If plot=True, a graph will be drawn using pyplot.