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

Simplify Bus Interaction #2047

Merged
merged 7 commits into from
Nov 13, 2024
Merged

Simplify Bus Interaction #2047

merged 7 commits into from
Nov 13, 2024

Conversation

georgwiese
Copy link
Collaborator

@georgwiese georgwiese commented Nov 5, 2024

Fixes #1823

This PR cleans up our bus_interaction function and all functions that depend on it, so that columns and challenges are added when needed, instead of being passed by the caller.

I also changed the tests a bit: I removed test_data/std/bus_{permutation,lookup}_via_challenges{_ext?}.asm and instead added more realistic tests:

  • test_data/std/bus_lookup.asm: Is a fixed lookup, completely analogous to lookup_via_challenges.
  • test_data/std/bus_permutation.asm: Uses a permutation to connect a block machine.

@georgwiese georgwiese changed the base branch from main to expressionizer November 11, 2024 07:59
@georgwiese georgwiese changed the title [WIP] Simplify Bus Interaction Simplify Bus Interaction Nov 11, 2024
@georgwiese georgwiese marked this pull request as ready for review November 11, 2024 11:14
use std::protocols::lookup::unpack_lookup_constraint;
use std::math::fp2::Fp2;
use std::constraints::to_phantom_lookup;

Copy link
Member

Choose a reason for hiding this comment

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

Why not keep the simple lookup function that just calls send and receive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because we'd want to do the receive in the callee machine and the send in the caller machine. Otherwise, the added columns would be in the wrong namespace.

Copy link
Member

Choose a reason for hiding this comment

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

But namespaces will not matter later on anyway...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But they do now :) I think this a simple thing to fix later.

Also, this API is more flexible: Instead of generating one send and receive per lookup, we can only generate one send per caller (same as now) and one receive per receiver (instead of one per caller).

Copy link
Member

Choose a reason for hiding this comment

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

How do they matter? Only wrt degree, or is there something else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We split by namespace in our split_pil function, used by the composite backend and Plonky3 backend to split the columns (and constraints) into machines, so we can prove them even when they a have different number of rows. I think this will go away once we have proof objects.

If we had one lookup function that was called in the machine linking to the callee (just like our current ASM linker adds the native lookup constraint to the caller), the multiplicity column would end up in the wrong namespace, which would lead to an error in the split_pil function, because it doesn't expect constraints to reference columns in multiple namespaces.

Base automatically changed from expressionizer to main November 11, 2024 12:07
@georgwiese
Copy link
Collaborator Author

Rebased onto main and pushed 32f40d0, which I forgot to push earlier.

Comment on lines +13 to +15
// Currently, witgen fails if the block machine has just enough rows to
// fit all the blocks, so let's not have a call in the last row.
col fixed sel = [1, 1, 1, 1, 1, 1, 1, 0];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This can be removed after #2070 is merged.

@georgwiese georgwiese added this pull request to the merge queue Nov 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 13, 2024
@georgwiese georgwiese added this pull request to the merge queue Nov 13, 2024
github-merge-queue bot pushed a commit that referenced this pull request Nov 13, 2024
Fixes #1823

This PR cleans up our `bus_interaction` function and all functions that
depend on it, so that columns and challenges are added when needed,
instead of being passed by the caller.

I also changed the tests a bit: I removed
`test_data/std/bus_{permutation,lookup}_via_challenges{_ext?}.asm` and
instead added more realistic tests:
- `test_data/std/bus_lookup.asm`: Is a fixed lookup, completely
analogous to `lookup_via_challenges`.
- `test_data/std/bus_permutation.asm`: Uses a permutation to connect a
block machine.
Merged via the queue into main with commit 287503a Nov 13, 2024
14 checks passed
@georgwiese georgwiese deleted the simplify-bus-interaction branch November 13, 2024 18:50
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.

Simplify Bus&Permutation in PIL by adding prover functions
2 participants