-
Notifications
You must be signed in to change notification settings - Fork 518
Perf: Improve gkr-mimc memory use #1616
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
Closed
Closed
Changes from all commits
Commits
Show all changes
117 commits
Select commit
Hold shift + click to select a range
609d47d
refactor: addInstance instead of series etc
Tabaie 79d4cbf
feat: check for duplicate gates, allow limiting curves for gate
Tabaie 82e33e5
refactor: gkr api tests
Tabaie ba06e5d
refactor gkr example
Tabaie 700c152
refactor: solve hint called per instance
Tabaie 30f5633
revert: newPrint back in std/gkr to avoid import cycle
Tabaie 44d6b4c
refactor: remove circuit/instance rearranging
Tabaie f5f726c
chore: generify
Tabaie 644fd6a
fix: registry duplicate detection
Tabaie 2001e83
fix: solver hint id mismatch
Tabaie d3ca3c1
remove redundant make
Tabaie 6474482
fix: works on plonk
Tabaie 0c0b6b0
refactor: solve hint for test engine
Tabaie 478d53d
fix prove hint
Tabaie 6c83740
fix package tests
Tabaie d6e382f
refactor: remove println
Tabaie a8f30a4
chore: generify print removal
Tabaie 8ac5f9f
feat: GetValue
Tabaie 5bb879d
fix all gkrapi tests pass
Tabaie 7f9a0f1
fix gkr-poseidon2
Tabaie 355277c
Merge branch 'master' into feat/gkr/add-instance
Tabaie cfdb9d3
fix: reduce in test engine
Tabaie 12788f3
fix: rename GkrCompressions -> GkrPermutations
Tabaie 9a0bf0e
bench: gkrposeidon2
Tabaie 618beff
fix pad for bls12377
Tabaie 22b77f2
some more padding fixes
Tabaie 250a35b
fix: padding issue in bn254
Tabaie 1586760
chore generify fix
Tabaie e593d90
Let Uint64 panic
Tabaie 9df619a
Update constraint/solver/gkrgates/registry.go
Tabaie 8c88c52
refactor: use assert.EqualError
Tabaie f4d7aa8
Merge branch 'master' into feat/gkr/add-instance
Tabaie 499ff52
refactor: import hash/all in test
Tabaie be747e0
refactor: shorten import name
Tabaie 4ae9324
Merge branch 'master' into feat/gkr/add-instance
Tabaie 4b43ce3
perf: addition rather than multiplication in gates
Tabaie 6b86526
Revert "perf: addition rather than multiplication in gates"
Tabaie c4b01b5
feat: generify poseidon2-gkr (not all s-Boxes available yet)
Tabaie 4765d61
revert incorrect renaming
Tabaie 5342952
fix test
Tabaie 9d9b13b
refactor generify tests
Tabaie 430661a
feat: gkrposeidon2 compression for all curves
Tabaie b75843d
feat gkr-poseidon2 hasher
Tabaie ca85a41
Merge branch 'feat/gkr/add-instance' into feat/gkr/hashes
Tabaie be8a07e
fix more renaming
Tabaie 1894cfa
feat: gkrmimc for sbox degree 5
Tabaie 241d645
mimc length 1 works
Tabaie bb36459
fix final layer
Tabaie 311d9d9
chore generify Println changes
Tabaie b3d1af8
fix: use multicommitter
Tabaie 815adc7
feat: use kvstore for caching instances
Tabaie 85d6aaa
Merge branch 'feat/gkr/add-instance' into feat/gkr/hashes
Tabaie 7ab8702
feat: merkledamgard hasher as statestorer
Tabaie 2fb7daa
test: SetState
Tabaie de55a27
feat: mimc.New to return StateStorer
Tabaie 31a0a59
fix: single instance and no instance edge cases
Tabaie bb0eca0
Merge branch 'feat/gkr/add-instance' into feat/gkr/hashes
Tabaie db56157
fix: single-instance, circuit with depth
Tabaie 7e4b954
Merge branch 'feat/gkr/add-instance' into feat/gkr/hashes
Tabaie b4544d6
Merge branch 'master' into feat/gkr/add-instance
Tabaie bdd01fd
Merge branch 'master' into feat/gkr/add-instance
Tabaie c170695
Merge branch 'master' into feat/gkr/add-instance
Tabaie 70802ea
Merge branch 'master' into feat/gkr/add-instance
Tabaie 4ca453c
docs: address cursor comments
Tabaie f2b1122
Merge branch 'master' into feat/gkr/add-instance
Tabaie b9c01be
Merge branch 'master' into feat/gkr/add-instance
Tabaie 8e92d99
Merge branch 'feat/gkr/add-instance' into feat/gkr/hashes
Tabaie 893ba91
Merge branch 'master' into feat/gkr/add-instance
Tabaie a13ac27
Merge branch 'master' into feat/gkr/add-instance
Tabaie 8947d9f
refactor: remove MapRange
Tabaie 4a09fd1
Merge branch 'master' into feat/gkr/add-instance
Tabaie 929d732
Merge branch 'master' into feat/gkr/add-instance
Tabaie 3ec0778
Merge branch 'feat/gkr/add-instance' into feat/gkr/hashes
Tabaie 8c37435
fix: bad merge
Tabaie 1e20850
perf: single-elem pool for bls12-377
Tabaie 4c69b65
build: generify changes
Tabaie b12c0ee
fix: api pointer receiver
Tabaie e6a64bc
bench: gkr mimc permutations
Tabaie d55dbf4
bench: gkr-mimc permutations
Tabaie b26f33c
Merge branch 'feat/gkr/hashes' into perf/mem/gkr
Tabaie 466f16b
refactor: remove loadCs
Tabaie 57e95bc
perf: reset api in gkr solver
Tabaie 6755e03
build: generify api reset
Tabaie b1de735
`hashTree` -> `merkleTree`
Tabaie 6c4c5c6
docs: copilot-inspired explanation for `freeElements`
Tabaie 8d0b353
perf: more pool freeing
Tabaie 5a048b6
perf: dedicated exp function
Tabaie c6b830c
build: generify exp changes
Tabaie 7bb78e7
fix: test for all curves
Tabaie 58a0fdb
perf: fastpath for ^17
Tabaie 4b2c102
fix: exp
Tabaie 30c39b4
fix: exp. really
Tabaie 6c7a7fc
test: modernize benchmark
Tabaie 266c5f6
Revert "build: generify exp changes"
Tabaie 5dd1d61
revert: exp func
Tabaie 1374bab
refactor: modulus name
Tabaie 9959f8a
revert: remove FrontendApiWrapper
Tabaie 271cff9
perf: dedicated exp17 func
Tabaie 1519d52
perf: SumExp17
Tabaie 2e3be9f
perf: cache key as fr.Element
Tabaie a05f8d6
build: generify
Tabaie f6613ce
perf: store keys as fr.Elements instead of big.Int
Tabaie d7eec96
Merge branch 'master' into feat/gkr/hashes
Tabaie 610d49c
fix: match api changes
Tabaie 8549a0b
fix: api use
Tabaie 8bcce8f
remove engine_hints
Tabaie a045f11
revert change to engine.go
Tabaie 9c35fd7
fix: mimc tests
Tabaie dd4e36a
fix: error message
Tabaie f2d2c2f
Merge branch 'master' into feat/gkr/hashes
Tabaie 560e80e
fix: error on empty list
Tabaie bc1750c
Merge branch 'master' into feat/gkr/hashes
Tabaie 543905e
Merge branch 'feat/gkr/hashes' into perf/mem/gkr-exp17
Tabaie c80eff5
revert: api in the solve hint
Tabaie 1488ac9
fix: constant is var
Tabaie 4395bd0
Merge branch 'master' into perf/mem/gkr-exp17
Tabaie 1676049
fix: imports
Tabaie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off-by-one causes unnecessary allocations in memory pool
Medium Severity
The
newElementfunction uses>=in its conditionif api.nbUsed >= len(api.allocated)when it should use>. After incrementingnbUsed, the function returnsallocated[nbUsed-1]. WhennbUsedequalslen(allocated), the indexnbUsed-1is still valid (within bounds), but the current condition triggers an unnecessaryappend. This causes an extra allocation every time the pool is reused up to its previous capacity, which undermines the PR's memory optimization goal. The condition should beapi.nbUsed > len(api.allocated).Additional Locations (2)
internal/gkr/bls12-377/gkr.go#L826-L827internal/gkr/small_rational/gkr.go#L826-L827