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
Use memcpy and memset from musl for performance benefit #277
Conversation
CI is angry, looks like you need to run rustfmt. |
bbe3955
to
d93ce30
Compare
Indeed, it had the right to be annoyed, pushed an update. |
That error looks more like some kind of CI/build system/cache error, the commit clearly includes risc0/zkvm/sdk/rust/guest/src/memcpy.s as a path and https://doc.rust-lang.org/std/macro.include_str.html says it's located relative to the current file.. |
d93ce30
to
2ee4c5e
Compare
Fixed, bazelbuild/rules_rust#459 |
Can you include the copyright header in each |
Base: commit 37e18b7bf307fa4a8c745feebfcba54a0ba74f30 - src/string/memcpy.c - src/string/memset.c This was compiled into assembly with: clang-14 -target riscv32 -march=rv32im -O3 -S memcpy.c -nostdlib -fno-builtin -funroll-loops and labels manually updated to not conflict License is MIT, see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT and indicated in the .s files Signed-off-by: Carsten Munk <carsten@zippie.com>
11b4ade
to
2d004a6
Compare
Fixes:
|
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.
Great! Thanks!
Base: commit 37e18b7bf307fa4a8c745feebfcba54a0ba74f30
This was compiled into assembly with:
clang-14 -target riscv32 -march=rv32im -O3 -S memcpy.c -nostdlib -fno-builtin -funroll-loops
and labels manually updated to not conflict.
License is MIT, see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
This work was prompted by slow performance seen in compiler-builtins in Rust being the memcpy/memset:
https://github.com/rust-lang/compiler-builtins/blob/master/src/mem/mod.rs#L25
cargo bench output from risc0/zkvm/sdk/rust, initially ran on baseline of f99fe08 / current main at the time, with all CPUs in performance governor on a Intel(R) Xeon(R) CPU E3-1275 v5 @ 3.60GHz - please confirm independently (impact seen in memset and memcpy benchmarks):
Signed-off-by: Carsten Munk carsten@zippie.com