Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualization Backend Proposal #174

Open
sgpthomas opened this issue Apr 10, 2019 · 2 comments
Open

Visualization Backend Proposal #174

sgpthomas opened this issue Apr 10, 2019 · 2 comments

Comments

@sgpthomas
Copy link
Contributor

This is a proposal for adding a backend to generate GraphViz files from fuse programs. The very high level idea is to represent data and control flow through a program in a layout that's reminiscent of circuit diagrams.

Declarations are represented as blocks with name and type.
For array values, we display name, type, and number of banks:
test

For loops:
Array access form a sort of mux, array writes are a sort of demux
We can display offsets of the iterator variable on the edge from the control node that represents the iterator.
simple-t
corresponds to:

decl a: bit<32>[4 bank 4];
decl b: bit<32>[4 bank 4];

for (let i = 0..4) unroll 4{
  b[i] := a[i];
}

I don't know about while loops

Parallel sequencing is trivial, you just don't do anything special
Linear sequencing will require some sort of registers between stages

@sampsyo
Copy link
Contributor

sampsyo commented Apr 10, 2019

Cool! This is a tiny, superficial thing, but it occurs to me that it might be perfectly legible—and a little more compact—to combine the name and type "blocks" in an array representation. The top block could just say "a : int32" instead of having two blocks, one that says "a" and another for "int32."

@rachitnigam
Copy link
Member

Also, something to note about pretty printing:

  1. The toString method for Type is already overloaded so doing something like s"${pretty(expr)}: $t" will do the right thing.
  2. It would be worth defining a separate PrettySyntax.scala file that pretty prints AST nodes for the diagrams to reduce the noise from the big blocks (EArrAccess(...) would just become a[i])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants