mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #271] [MERGED] perf: enable sha2 asm feature for hardware SHA-256 acceleration #307
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#307
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/271
Author: @YXalix
Created: 9/10/2026
Status: ✅ Merged
Merged: 9/10/2026
Merged by: @yingdi-shan
Base:
main← Head:perf/sha2-asm-accel📝 Commits (1)
c255384perf: enable sha2 asm feature for hardware SHA-256 acceleration📊 Changes
6 files changed (+15 additions, -5 deletions)
View changed files
📝
Cargo.lock(+10 -0)📝
Cargo.toml(+1 -1)📝
crates/benchmarks/Cargo.toml(+1 -1)📝
crates/e2e-tests/Cargo.toml(+1 -1)📝
storage/overlaybd/Cargo.toml(+1 -1)📝
storage/ublk/Cargo.toml(+1 -1)📄 Description
Motivation
SHA-256 is on the critical path of memory snapshot creation:
storage/overlaybd'sAppendDigestTrackerhashes every appended byte of the RW layer and the sealed layer at ZFile seal /compact_totime (memory snapshot commits),registryfs_v2's uploader hashes full layers during registry publication,src/digest.rsstreams whole-file digests for snapshot artifact publication/copy.The
sha2crate defaults to the portable software implementation. On aarch64, the ARMv8 SHA crypto extensions are only used when the optionalasmfeature is enabled explicitly — without it, multi-GB snapshot hashing runs entirely in software.Change
Enable
features = ["asm"]on everysha2declaration in the workspace (runtime deps ofagentenvandoverlaybd, plus dev-deps ofuvm-ublktests, e2e-tests and benchmarks).Cargo.lockgainssha2-asm v0.6.4; no source code changes.This is safe across all release targets (linux/darwin × x86_64/aarch64):
cpufeaturessince sha2 0.10.5), falling back to the software implementation on CPUs without SHA extensions — no behavior regression on older x86 hosts, and a free speedup on SHA-NI ones.Benchmark
aarch64 host; create sandbox →
dd1 GiB into tmpfs → take snapshot; 10 successful rounds per variant:Snapshot creation is ~35% faster (avg 9.733s → 6.354s); create and dd steps are unchanged within noise, isolating the win to the hashing-heavy snapshot path.
Verification
cargo tree -i sha2@0.10.9 -e featuresconfirms theasmfeature is active through both theagentenvandoverlaybddependency chains.cargo check --workspacepasses on aarch64 (sha2-asm assembly builds).objdumpshowssha256h/sha256suin the sha2 CGU).cargo test -p agentenv --lib digest::andcargo test -p overlaybd --lib(338 passed) — hash outputs are unchanged; the only failures are pre-existing mock-HTTP-server environment failures that reproduce identically on unmodifiedorigin/main.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.