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: change in .expect interface #2170

Closed
Tracked by #2191
anshumanmohan opened this issue Jun 19, 2024 · 0 comments · Fixed by #2231
Closed
Tracked by #2191

Queues: change in .expect interface #2170

anshumanmohan opened this issue Jun 19, 2024 · 0 comments · Fixed by #2231
Assignees
Labels
C: calyx-py Items that have to do with the builder library C: Queues One of the queue-style frontends good first issue Good issue to start contributing on Calyx

Comments

@anshumanmohan
Copy link
Contributor

anshumanmohan commented Jun 19, 2024

This is a bookmark for a change that we'd like to make across all our queues. I'm parking it here because two big changes to the queues, #2067 and #1810, are in flight and I don't want to create an unnecessarily large diff.

Right now queue_call.py starts up two counters, i and j, and then:

  • Feeds commands[i] and values[i] to the queue it is driving. Increments i.
  • If the queue returns an answer (i.e., if the command passed was pop or peek and the queue executed it successfully), it writes the answer to the ans_mem memory like so: ans_mem[j++] = answer.

This has a couple problems:

  • When the queue returns errors (from overflow and underflow, chiefly), we have no "trace" of that fact in the answer memory and therefore no trace of that in our expect-testing.
  • The fact that i and j are out of sync means that it's hard to debug the behavior of a queue by looking over the expect files.

The new proposal is that queue_call.py should start up one counter i, and:

  • Feed commands[i] and values[i] to the queue it is driving.
  • If the queue returns an answer (i.e., if the command passed was pop or peek and the queue executed it successfully), write the answer to the answers memory just as before: ans_mem[i] = answer. If the queue returns an error, indicate this in the answer memory by writing some special value in ans_mem[i]. Similarly, put some special value into ans_mem[i] in case the command was a push and no output was expected.
  • Increment i.
@anshumanmohan anshumanmohan added good first issue Good issue to start contributing on Calyx C: calyx-py Items that have to do with the builder library C: Queues One of the queue-style frontends labels Jun 19, 2024
@anshumanmohan anshumanmohan changed the title Queues: change to .expect interface Queues: change in .expect interface Jun 21, 2024
@anshumanmohan anshumanmohan mentioned this issue Jul 2, 2024
9 tasks
@csziklai csziklai self-assigned this Jul 24, 2024
This was referenced Jul 26, 2024
csziklai added a commit that referenced this issue Aug 7, 2024
This PR makes progress towards
#2170. It applies the new expect
interface to all queues. These queues call queue_call, which has the
updated code. Additionally, code for the oracles had to be updated, in
particular the method operate_queue(). The value 2^32 - 2 is given to
pushes, and the value 2^32 - 1 for errors generated from underflow or
overflow.

This is the new version of #2227, because of branch environment issues.

---------

Co-authored-by: Anshuman Mohan <anshumanmohan@live.com>
@anshumanmohan anshumanmohan linked a pull request Aug 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: calyx-py Items that have to do with the builder library C: Queues One of the queue-style frontends good first issue Good issue to start contributing on Calyx
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants