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

Queues: PCAP-based benchmarking harness #2358

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

polybeandip
Copy link
Collaborator

@polybeandip polybeandip commented Nov 19, 2024

Closing #2304, we can generate data files for queues directly from packet captures using parse_pcap.py!

Changes:

  • add parse_pcap.py, a PCAP parser for generating data files
  • move synthesis, parsing, and plotting scripts into evaluation/
  • add pcap_sim.py, a harness similar to queue_call for iterating through commands in our data file
  • add insert_tuple_flow_inference to flow_inference.py, flow inference to be used with pcap_sim.py
  • remove generate functions from binheap/round_robin.py, binheap/strict.py, and strict_or_rr.py
    • cleaner seperation of queue components and tests
  • tweak round robin and strict tests to take command line argument sim-pcap
    • if sim-pcap is True, use pcap_sim.py instead of queue_call.py
  • add calyx_py-to-calyx.rhai to fud2/scripts/
    • creates a state for CalyxPy and an operation from CalyxPy to Calyx
    • add associated fud2 tests to pass CI
  • add plot_pcap_sim.py, a script for generating Gantt charts from output memories

Example

Say you want a data file of the format used by our Testing Harness, with timing based on packets 10 through 20 of kachow.pcap.

Simply run

python3 parse_pcap.py kachow.pcap kachow.data --start 10 --end 20

This produces two outputs

  • kachow.data, the data file
  • various statistics about the data file and PCAP: namely, num_cmds, the size of the commands memory in kachow.data

We can run kachow.data using sim_pcap.py on any of our round robin or strict queues:

  1. pick your favorite round robin or strict test in tests/
  2. generate Calyx with python3 <num_cmds> --sim-pcap <test_name>.py
  3. run the produced Calyx with data file kachow.data and your simulator of choice

For example, we can combining steps 2 and 3 into a single fud2 command

fud2 rr_2flow_test.py -o rr_2flow_test.json \
    --through verilator \
    -s sim.data=kachow.data \
    -s py.args="<num_cmds> --sim-pcap" \

which produces the output memories rr_2flow_test.json.

We can visualize these memories with graphs, in the style of Formal Abstractions, by feeding them to plot_pcap_sim.py:

python3 plot_pcap_sim.py rr_2flow_test.json

This generates the Gantt chart rr_2flow_test.png.

@polybeandip polybeandip marked this pull request as ready for review November 20, 2024 03:46
@polybeandip
Copy link
Collaborator Author

Some Gantt charts from packets 1 through 20 of a PCAP (it's too big for me to upload and I forgot where I found it, sorry!)

2-flow Specialized Round Robin

2-flow Binary Heap Round Robin

2-flow Specialized Strict

2-flow Binary Heap Strict

The order packets are popped is the same (phew!), but it seems they stay in the queue much longer in the heap-based versions.

Copy link
Contributor

@anshumanmohan anshumanmohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the great work, and for walking me through this IRL! Comments on Github are minimal because we spoke offline.

frontends/queues/evaluation/parse_pcap.py Outdated Show resolved Hide resolved
@@ -0,0 +1,10 @@
import "calyx" as c;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jku20 Akash has added a fud2 stage that runs python3 on a file. This spares us from the usual pattern of:

python3 myfile.py | 
fud ...

Would you please take a look for style etc? Also we know this should have been its own PR; sorry about that!

polybeandip and others added 3 commits December 11, 2024 15:49
Co-authored-by: Anshuman Mohan <10830208+anshumanmohan@users.noreply.github.com>
…ing-harness' into realistic-benchmarking-harness
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

Successfully merging this pull request may close these issues.

2 participants