-
Notifications
You must be signed in to change notification settings - Fork 53
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
Tutorial: toy arbitration logic #1474
Comments
Pretty solid idea! |
I've made some progress and hit a few roadblocks. Some are likely silly and some deep, but it's time to get y'all involved, I think. The code to look at is here; run it with I have a bunch of inline comments, and the ones tagged "AM" could use some love. Many thanks! |
Here's what I'd like to have by the time the tutorial rolls around:
|
Perhaps this would overfitted to this problem, but I can imagine a whole bunch of quality-of-life improvements in the builder library in service of this task. Partial-application of
|
This looks like the right ballpark to me. FWIW, I think your idea for "partial application" for invokes there could fortunately be not too hard to write as a plain ol' Python function within the MrXL compiler… that is, you could prototype a utility like that (takes the ref-cell bindings, returns a function to "finish" constructing the invoke with input ports) and see how it works here. If it does seem cool and reusable, we could move it to the builder library. |
@anshumanmohan I would make sure that you can handwrite a version of the arbiter in Calyx before attempting to implement it through the builder library. Otherwise, one failure mode is discovering limitations in Calyx and having to refactor your python code. |
I've begun work on the handwritten version and I have a question about
And I'm not sure why, in 3, we seem to be clobbering the invoked component's outputs. As you can sorta see from my "dream" example in pseduo-Calyx above, I'd like to echo the invoked component's outputs. |
Alrighty, here is my handwritten file! Run it by changing to this branch, changing to
It goes forever, and help re: that is much appreciated. Further, the question re: Once we get this running, the dream is not far! |
Can you explain what you mean by clobbering the outputs? The invoked component in the example doesn’t have any outputs but if it did, you could just forward them. |
Whoops the link went to the page, not the section. I wanted you to look at this. The component
To make sure I'm getting this right:
Is that right? And, relatedly, is this what you mean by forwarding? |
Yup, you are correct. For the inputs, the syntax is sane, for the outputs, it is not but it does the expected things. For example:
Is the same as:
An easy way to figure out what the generated code will do is to compile away the invokes:
|
One annoying problem with the above is that the An alternative is switching to |
Ah nice nice. Thanks for the example, and for the pointer re: compiling away the invokes. Tomorrow I'll work on this and get closer to my goal. I'll ponder re: the semantics I want and play with your suggestions. One option that occurred to me was to:
Sound okay, or known to be bad idea? |
Quick update: I went with the proposal above and a baby version works great. Now on to the dream. |
FWIW, the |
Try out a small arbitration logic using
ref
cells.This will be a component that takes two
ref
cells as input, but itself exposes the interface of one memory. Internally, it logically bridges the two as needed.In pseudocode:
Note that
wrapper
has not actually made new components.When asked for index
0
it knows it can just read offa
.When asked for index
4
it knows it must skip overa
and read offb
.Originally posted by @anshumanmohan in #1472 (comment)
The text was updated successfully, but these errors were encountered: