-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strict PIFO oracle and eDSL implementation (#2189)
This PR ties off the last half of #1810. It implements the python oracle and Calyx eDSL for strict PIFOs, which are generalized to n flows. Flows have a strict order of priority, which determines popping and peeking order. If the highest priority flow is silent when it is its turn, that flow simply skips its turn and the next flow is offered service. If that higher priority flow get pushed to in the interim, the next call to pop/peek will return from that flow. To re-generate the test files with 20000 commands and a max length of 16, type in the command line after navigating to the directory calyx/calyx-py/calyx ``` ./gen_queue_data_expect.sh ``` To run the runt tests on the eDSL implementation, type ``` runt -i "strict" ``` --------- Co-authored-by: Cassandra Nicole Sziklai <cns58@havarti.cs.cornell.edu> Co-authored-by: Anshuman Mohan <anshumanmohan@live.com> Co-authored-by: Anshuman Mohan <10830208+anshumanmohan@users.noreply.github.com>
- Loading branch information
1 parent
f59b893
commit 75c5cb8
Showing
44 changed files
with
600,516 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import sys | ||
import calyx.queues as queues | ||
from calyx import queue_util | ||
|
||
if __name__ == "__main__": | ||
num_cmds, len, numflows = int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]) | ||
keepgoing = "--keepgoing" in sys.argv | ||
commands, values, _ = queue_util.parse_json() | ||
|
||
if numflows == 2: | ||
boundaries = [200, 400] | ||
order = [1, 0] | ||
elif numflows == 3: | ||
boundaries = [133, 266, 400] | ||
order = [1, 2, 0] | ||
elif numflows == 4: | ||
boundaries = [100, 200, 300, 400] | ||
order = [3, 0, 2, 1] | ||
elif numflows == 5: | ||
boundaries = [80, 160, 240, 320, 400] | ||
order = [0, 1, 2, 3, 4] | ||
elif numflows == 6: | ||
boundaries = [66, 100, 200, 220, 300, 400] | ||
order = [3, 1, 5, 2, 4, 0] | ||
else: | ||
raise ValueError("Unsupported number of flows") | ||
|
||
# Our Strict queue orchestrates n FIFOs. It takes in a list of | ||
# boundaries of length n, as well as a list `order` which specifies the ranked | ||
# order of the flows. | ||
pifo = queues.StrictPifo(numflows, boundaries, order, len) | ||
|
||
ans = queues.operate_queue(pifo, num_cmds, commands, values, keepgoing=keepgoing) | ||
|
||
queue_util.dump_json(ans, commands, values) |
6 changes: 0 additions & 6 deletions
6
calyx-py/test/correctness/queues/rr_queues/rr_queue_2flows.py
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
calyx-py/test/correctness/queues/rr_queues/rr_queue_3flows.py
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
calyx-py/test/correctness/queues/rr_queues/rr_queue_4flows.py
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
calyx-py/test/correctness/queues/rr_queues/rr_queue_5flows.py
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
calyx-py/test/correctness/queues/rr_queues/rr_queue_6flows.py
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
calyx-py/test/correctness/queues/rr_queues/rr_queue_7flows.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
calyx-py/test/correctness/queues/strict_and_rr_queues/rr_queues/rr_queue_2flows.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import sys | ||
import inspect | ||
|
||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
|
||
from gen_strict_or_rr import build | ||
|
||
if __name__ == "__main__": | ||
"""Invoke the top-level function to build the program, with 2 flows.""" | ||
build(2, True).emit() |
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
calyx-py/test/correctness/queues/strict_and_rr_queues/rr_queues/rr_queue_3flows.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import sys | ||
import inspect | ||
|
||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
|
||
from gen_strict_or_rr import build | ||
|
||
if __name__ == "__main__": | ||
"""Invoke the top-level function to build the program, with 3 flows.""" | ||
build(3, True).emit() |
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
calyx-py/test/correctness/queues/strict_and_rr_queues/rr_queues/rr_queue_4flows.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import sys | ||
import inspect | ||
|
||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
|
||
from gen_strict_or_rr import build | ||
|
||
if __name__ == "__main__": | ||
"""Invoke the top-level function to build the program, with 4 flows.""" | ||
build(4, True).emit() |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.