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

Various fixes for benchmarks #62

Merged
merged 22 commits into from
Oct 30, 2023
Merged

Various fixes for benchmarks #62

merged 22 commits into from
Oct 30, 2023

Conversation

tim-hoffman
Copy link

No description provided.

@tim-hoffman tim-hoffman force-pushed the th/poseidon-fix-extract branch from 3f79ff1 to a169a98 Compare October 24, 2023 19:02
@tim-hoffman tim-hoffman force-pushed the th/poseidon-fix-extract branch from a169a98 to 4b9feca Compare October 24, 2023 19:08
@tim-hoffman tim-hoffman marked this pull request as draft October 24, 2023 19:11
@tim-hoffman tim-hoffman marked this pull request as ready for review October 24, 2023 20:19
Base automatically changed from th/poseidon-fix-extract to llvm-v2 October 30, 2023 16:23
Copy link

@iangneal iangneal left a comment

Choose a reason for hiding this comment

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

A few comments/questions while I work through the rest of the changes.

// "loop.body" function, this branch is dead code, thus no parameter was added
// to the function to reference the destination of this StoreBucket and the
// location information was not updated so there is an invalid parameter reference
// that causes 'functions.rs::get_arg_ptr' to crash, but it's in dead code.

Choose a reason for hiding this comment

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

Maybe update the comment here since we're not crashing at get_arg_ptr anymore.

Copy link
Author

Choose a reason for hiding this comment

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

Oof, I added the checks but didn't even put the correct command at the start to use the checks.

//CHECK-NOT: define void @..generated..loop.body.[[[0-9]+]](
//CHECK: define void @..generated..loop.body.[[[0-9]+]].T(
//CHECK-NOT: define void @..generated..loop.body.[[[0-9]+]](
//CHECK: define void @..generated..loop.body.[[[0-9]+]].F.T(

Choose a reason for hiding this comment

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

I'm a little confused why we end up generating:

@..generated..loop.body.[[[0-9]+]].T(...)
@..generated..loop.body.[[[0-9]+]].F(...)
@..generated..loop.body.[[[0-9]+]].F(...)

for the first 3 iterations of the unrolled loop, but

@..generated..loop.body.[[[0-9]+]].F.T(...)
@..generated..loop.body.[[[0-9]+]].F.T(...)
@..generated..loop.body.[[[0-9]+]].F.T(...)

for the last three iterations. Shouldn't we be able to generate

@..generated..loop.body.[[[0-9]+]].F(...)
@..generated..loop.body.[[[0-9]+]].F(...)
@..generated..loop.body.[[[0-9]+]].F(...)

For the last three iterations?

There also seems to be a bug here, because if I change OR to:

template OR() {
    signal input a;
    a === 0;
}

I find that OR_0_run is only called by @..generated..loop.body.[[[0-9]+]].F.T and not @..generated..loop.body.[[[0-9]+]].F or @..generated..loop.body.[[[0-9]+]].F.T, so the first three iterations end up omitting the body of OR_0_Run.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it really should have 6 calls to the run function. Part of what's going on here is addressed in some of the other PRs so I'll make a JIRA ticket to re-check this after all of this mess is merged in.

Copy link
Author

Choose a reason for hiding this comment

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

@tim-hoffman tim-hoffman requested a review from iangneal October 30, 2023 22:04
Copy link

@iangneal iangneal left a comment

Choose a reason for hiding this comment

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

I think I'm good with this; it'd be helpful to get this merged in with the other PR so we can have a more unified view of everything.

@tim-hoffman tim-hoffman merged commit 8cc3b56 into llvm-v2 Oct 30, 2023
3 checks passed
@tim-hoffman tim-hoffman deleted the th/benchmark-fixes branch October 30, 2023 22:30
tim-hoffman added a commit that referenced this pull request Oct 31, 2023
* skip body extraction when the loop has 0 iterations
* Modify interpreter to distinguish between circom functions and loop body functions
* [VAN-676] duplicate extracted functions when flattening branch buckets
* [VAN-670] generate and flatten subcmp counter/run
* impl Debug for Env to be more friendly, expand on test case comment
* remove debug println
* fix: conditions not flattening in non-generated methods
* [VAN-582] properly convert mapped to indexed when there are multiple versions of the subcomponent
* fix XFAIL test outputs so they pass
* add test cases
* handle CallBucket return case in mapped_to_indexed
* fix body_extractor assertion failure
* fix segfault from improper GEP
* use BucketId as key to speed up SimplificationPass
* fix function name to reflect actual usage
* Remove functions that cannot be reached from any template
Co-authored-by: Daniel Dominguez <[email protected]>
tim-hoffman added a commit that referenced this pull request Nov 8, 2023
* skip body extraction when the loop has 0 iterations
* Modify interpreter to distinguish between circom functions and loop body functions
* [VAN-676] duplicate extracted functions when flattening branch buckets
* [VAN-670] generate and flatten subcmp counter/run
* impl Debug for Env to be more friendly, expand on test case comment
* remove debug println
* fix: conditions not flattening in non-generated methods
* [VAN-582] properly convert mapped to indexed when there are multiple versions of the subcomponent
* fix XFAIL test outputs so they pass
* add test cases
* handle CallBucket return case in mapped_to_indexed
* fix body_extractor assertion failure
* fix segfault from improper GEP
* use BucketId as key to speed up SimplificationPass
* fix function name to reflect actual usage
* Remove functions that cannot be reached from any template
Co-authored-by: Daniel Dominguez <[email protected]>
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