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

make stdlib::readback work in lazy mode #106

Merged
merged 2 commits into from
Apr 2, 2024
Merged

make stdlib::readback work in lazy mode #106

merged 2 commits into from
Apr 2, 2024

Conversation

tjjfvi
Copy link
Contributor

@tjjfvi tjjfvi commented Apr 1, 2024

No description provided.

@HigherOrderBot

This comment has been minimized.

@HigherOrderBot
Copy link
Collaborator

Perf run for 51f4a77:

file              mode        main          51f4a77e48bb
========================================================
sum_rec           intr-singl      14.068 s      14.873 s
                  intr-multi       7.410 s       7.265 s
--------------------------------------------------------
bitonic_sort_lam  intr-singl      10.920 s      11.640 s
                  intr-multi       5.654 s       5.373 s
--------------------------------------------------------
merge_sort        intr-singl       7.173 s       7.603 s
                  intr-multi       3.651 s       3.699 s
--------------------------------------------------------
sum_tail          intr-singl       1.120 s       1.216 s
                  intr-multi       1.148 s       1.149 s
--------------------------------------------------------
c2                intr-singl       0.000 s       0.000 s
                  intr-multi       0.001 s       0.001 s
--------------------------------------------------------
sum_tree          intr-singl       9.092 s       9.395 s
                  intr-multi       4.427 s       4.366 s
--------------------------------------------------------
boom              intr-singl       2.263 s       2.289 s
                  intr-multi       2.590 s       2.836 s
--------------------------------------------------------
radix_sort_lam    intr-singl       9.674 s       9.584 s
                  intr-multi       4.759 s       4.776 s

Copy link
Member

@developedby developedby left a comment

Choose a reason for hiding this comment

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

I don't understand what is the difference between normalizing inside readback and normalizing and then calling readback.
Why was the previous one not working?

@tjjfvi
Copy link
Contributor Author

tjjfvi commented Apr 2, 2024

I'm not sure what you mean.

The old readback function was designed exclusively for strict mode, and used special reference nodes to ensure the argument was normalized. This approach doesn't work on lazy mode, because the interactions with the special reference nodes will never be reached in normalization.

In lazy mode, one simply needs to call normal_from on a wire to ensure it's normalized; you don't need to do anything with special reference nodes.

This PR just makes it so that the readback function chooses between those two approaches based on M::LAZY.

@developedby
Copy link
Member

I'm not sure what you mean.

The old readback function was designed exclusively for strict mode, and used special reference nodes to ensure the argument was normalized. This approach doesn't work on lazy mode, because the interactions with the special reference nodes will never be reached in normalization.

In lazy mode, one simply needs to call normal_from on a wire to ensure it's normalized; you don't need to do anything with special reference nodes.

This PR just makes it so that the readback function chooses between those two approaches based on M::LAZY.

I understand it now. Sorry, all this IO code is a bit hard to understand without an explanation

@tjjfvi tjjfvi marked this pull request as ready for review April 2, 2024 15:36
@tjjfvi tjjfvi added this pull request to the merge queue Apr 2, 2024
Merged via the queue into main with commit 35eca58 Apr 2, 2024
5 checks passed
@tjjfvi tjjfvi deleted the lazy-readback branch April 2, 2024 15:42
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