Buffer Abstraction#263
Open
zkfriendly wants to merge 28 commits into
Open
Conversation
Closed
Merging this PR will not alter performance
Comparing Footnotes
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR introduces the buffer abstraction layer. All buffer abstraction traits are defined in the buffer crate (
src/buffer/mod.rs), with a CPU implementation that essentially wraps the existing in-memory code paths.At this moment, the buffer crate still depends on existing algebra and protocol crates. Future work can consolidate the relevant logic directly into the buffer crate as the abstraction settles.
Since the original review, the abstraction has been simplified substantially: the slice/view layer (
BufferRead/BufferWrite,CpuSlice/CpuSliceMut) is removed in favor of two traits (BufferOps,Buffer) over owned buffers only. Host readbacks (as_slice) now occur only at transcript boundaries where the data must reach the host anyway.Notes
There is also an experimental Metal implementation, but it is not included in this PR.
zk_whiris not fully ported to the buffer abstraction yet. It uses.as_slice()in places to keep the code working, so behavior is essentially unchanged compared to directly using CPU buffers. Since WHIR v3 is coming and is expected to replacezk_whir, that path is intentionally not fully ported for now.Supersedes #260 (same branch, previously from my fork — GitHub cannot retarget a PR head, so reopened from the in-repo branch). Review history and comment threads are on #260.