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

Builder: tidy correctness examples #1630

Merged
merged 15 commits into from
Jul 25, 2023
Merged

Conversation

anshumanmohan
Copy link
Contributor

Just a quick pass to lift a few common Python methods into their own file. This is presently just for the arbiter and the reduction tree, but the incoming FIFO/PIFO/PIFO tree work will benefit from these as well.

One additional observation has to do with how cb.if_ and cb.while_ often get used. I will make comments in the code below. If you like it, we can put those changes in too.

@rachitnigam
Copy link
Contributor

It occurs to me that some of these could be in calyx-extra once #1626 is merged? The downside with that approach is that you have to an additional flit install calyx-extra to get the library in Python.

Copy link
Contributor

@rachitnigam rachitnigam left a comment

Choose a reason for hiding this comment

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

I like the idea of higher-level builders provided in this library! I bet if we look at our generators, we'll find other useful patterns to add to this library!

@anshumanmohan
Copy link
Contributor Author

Thanks for taking a look! Most of what you suggested is now in. I'll sum up the remaining items. I think these can all be no-ops, or separate PRs if we do want them to be acted upon.

  1. Giving the builder library some sugary variants of if and while that are used when we know we want a cell and an intimately connected comb group. Builder: tidy correctness examples #1630 (comment)
  2. The matter of where this should live. Builder: tidy correctness examples #1630 (comment)
  3. Optional registers and other optional named components. Builder: tidy correctness examples #1630 (comment)

anshumanmohan added a commit that referenced this pull request Jul 24, 2023
@rachitnigam
Copy link
Contributor

Just pushed a fix for #1626 so hopefully that can be merged and we can move this to calyx-extra? I'm fine with the sugary variants of if and while as long as we abstract the (cell, comb_group) thing as a dataclass and only allow passing those to the sugared versions?

Copy link
Contributor

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

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

Very very cool!!!! I found a few code-level suggestions to offer, but I really like the idea of continuing to "upstream" useful utilities that help make the Python generator code easier to read/write.

calyx-py/calyx/builder.py Outdated Show resolved Hide resolved
calyx-py/calyx/builder_util.py Show resolved Hide resolved
calyx-py/calyx/builder_util.py Outdated Show resolved Hide resolved
calyx-py/calyx/builder_util.py Outdated Show resolved Hide resolved
calyx-py/calyx/builder_util.py Outdated Show resolved Hide resolved
calyx-py/calyx/builder_util.py Outdated Show resolved Hide resolved
calyx-py/calyx/builder_util.py Show resolved Hide resolved
calyx-py/test/correctness/arbiter_6.py Show resolved Hide resolved
@sampsyo
Copy link
Contributor

sampsyo commented Jul 25, 2023

Just pushed a fix for #1626 so hopefully that can be merged and we can move this to calyx-extra?

I think it might be even more natural for these to live right in the builder classes, as mentioned in one inline comment… partly because I expect they would be useful for any generator written using our eDSL, and partly because it will make the API a little more convenient.

@rachitnigam
Copy link
Contributor

@sampsyo fair enough! Let's merge this into the builder API itself then

@anshumanmohan
Copy link
Contributor Author

Thank you both for your time!!

I've resolved most of the comments, either via commits or via new issues. What's left is:

@sampsyo
Copy link
Contributor

sampsyo commented Jul 25, 2023

Excellent!

@anshumanmohan anshumanmohan enabled auto-merge (squash) July 25, 2023 17:30
@anshumanmohan anshumanmohan merged commit 7596ee1 into master Jul 25, 2023
5 checks passed
@anshumanmohan anshumanmohan deleted the tidy-calyx-py-correctness branch July 25, 2023 17:45
rachitnigam pushed a commit that referenced this pull request Feb 16, 2024
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.

3 participants