perf(syscalls): zero-copy private input API and migrate guests#865
Closed
diegokingston wants to merge 1 commit into
Closed
perf(syscalls): zero-copy private input API and migrate guests#865diegokingston wants to merge 1 commit into
diegokingston wants to merge 1 commit into
Conversation
Collaborator
Author
|
Closing in favor of the zero-copy private-input implementation already on |
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
get_private_input()used to end inslice.to_vec(), bulk-copying the whole private input every run even though the region is a fixed static mapping (0xFF000000) and a zero-copy path already existed (ef_io::read_input). This changes the API to return&'static [u8]and migrates the in-repo callers:syscalls/src/syscalls.rs: return thefrom_raw_partsslice directly (host writes the mapping before execution and never mutates it, so the borrow is valid for the whole run); doc + SAFETY notes updated.ethrex(rkyv::from_bytes(input)),commit,commit_sum.memoryneeded no change (itstry_into()resolves viaTryFrom<&[u8]>).syscalls/README.mdAPI table updated.Measured guest cycles (
cli execute --cycles, deterministic)Savings exceed the single-syscall-copy model (~3 instrs per 8 input bytes): the owned
Vecalso forced downstream clones in the guest's rkyv deserialization layers, which are gone too.Verification
lambda-vm-syscalls,commit,commit_sum,memory, and the fullethrexguest — all clean.ecsm_mul/keccak_permute).Follow-up (not in this PR)
bench_vs/lambda/recursion(untracked WIP guest) needs the same call-site tweak (postcard::from_bytes(&blob)→(blob)) once this lands.syscalls/is not in the root workspace'sexclude, socargo checkfrom its own dir errors ("believes it's in a workspace when it's not"); an empty[workspace]table in its Cargo.toml would fix it.