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

Add Arith256Memory machine #2109

Merged
merged 19 commits into from
Nov 22, 2024
Merged

Add Arith256Memory machine #2109

merged 19 commits into from
Nov 22, 2024

Conversation

georgwiese
Copy link
Collaborator

@georgwiese georgwiese commented Nov 18, 2024

Depends on #2117

This PR adds a new Arith256Memory machine. It is largely a copy of std::machines::large_field::arith::Arith, but receives its inputs / writes its outputs via a memory pointer.

The first commit copies the existing machine and test. So, I would recommend reviewing the diff to the first commit.

@georgwiese georgwiese changed the base branch from main to fix-cached-sequence November 19, 2024 19:07
@georgwiese georgwiese changed the title [WIP] Add Arith256Memory machine Add Arith256Memory machine Nov 19, 2024
@@ -267,7 +267,8 @@ machine Main with degree: 65536 {
assert_eq t_0_0, t_0_1, t_0_2, t_0_3, t_0_4, t_0_5, t_0_6, t_0_7, 0x70afe85a, 0xc5b0f470, 0x9620095b, 0x687cf441, 0x4d734633, 0x15c38f00, 0x48e7561b, 0xd01115d5;
assert_eq t_1_0, t_1_1, t_1_2, t_1_3, t_1_4, t_1_5, t_1_6, t_1_7, 0xf4062327, 0x6b051b13, 0xd9a86d52, 0x79238c5d, 0xe17bd815, 0xa8b64537, 0xc815e0d7, 0xa9f34ffd;

// Auto-generated rest of the test cases:
// Auto-generated rest of the test cases,
// see: https://gist.github.com/georgwiese/a66425ae95c839b548edffffe6a692f9
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thankfully, I found an old Python notebook that used to generate these tests. I uploaded them to Gist and linked it here for future reference. The script also contains code to generate the memory tests.

@georgwiese georgwiese marked this pull request as ready for review November 19, 2024 20:07
github-merge-queue bot pushed a commit that referenced this pull request Nov 19, 2024
Fixes a bug I encountered in #2109:
- For blog machines, we have a cache which tracks a sequence of solving
steps that led to a success in the past.
- However, the needed sequence could be different from call to call. In
particular, it could depend on the operation ID.
- Because of that, in #1562, we added that the "default" sequence
iterator is always run after the cached sequence.
- But, we never called `report_progress()` on the default iterator,
which led to a bug in #2109.
Base automatically changed from fix-cached-sequence to main November 19, 2024 20:45
Copy link
Member

@leonardoalt leonardoalt left a comment

Choose a reason for hiding this comment

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

crazy

.unwrap();

test_halo2(make_simple_prepared_pipeline(f));
}
Copy link
Member

Choose a reason for hiding this comment

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

Why all but P3?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Also added to the "normal" arith test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, reverted again. It fails because the constraint degree is too large.

Copy link
Member

Choose a reason for hiding this comment

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

ah true. Does this actually run with Halo2 in CI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, think so!

Byte2 byte2;

// One-hot encode the operation
pol commit is_affine, is_mod, is_ec_add, is_ec_double;
Copy link
Member

Choose a reason for hiding this comment

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

col witness?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@leonardoalt
Copy link
Member

still needs updates

This reverts commit bb70d2c.
@georgwiese georgwiese added this pull request to the merge queue Nov 22, 2024
Merged via the queue into main with commit b3272db Nov 22, 2024
14 checks passed
@georgwiese georgwiese deleted the arith-memory branch November 22, 2024 18:55
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.

2 participants