feat: reuse compiled artifacts in rvr#2833
Conversation
|
Claude finished @mansur20478's task in 1m 34s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. The fingerprint is a truncated SHA-256 of the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit, the Findings1. Potential race condition on concurrent cache writes (Medium)
// write to a temp file in cache_dir, then rename
let tmp = cache_dir.join(format!(".rvr-{fingerprint}.tmp.{}", std::process::id()));
fs::copy(&self.lib_path, &tmp)?;
fs::rename(&tmp, &dest_path)?;This is especially relevant since the PR description mentions SDK-level usage, where parallel compilation processes are likely. 2.
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 1m 42s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit, the Findings1.
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 1m 38s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. The fingerprint is a truncated SHA-256 of the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the Overall the implementation is clean and well-tested. Here are my findings, in priority order: Findings1.
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 1m 56s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR replaces the unvalidated The implementation is clean and well-tested. I have one medium-priority finding and several low-priority observations. Findings1. Duplicate code in
|
|
Claude finished @mansur20478's task in 2m 4s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the Findings1. Non-cached functions now delegate through
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 1m 49s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the Findings1.
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 1m 40s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries ( The code is in good shape. I have one medium finding and several low-priority observations. Findings1.
|
|
Claude finished @mansur20478's task in 1m 30s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the The code is in good shape overall. The fingerprinting approach is sound and the test coverage is thorough. Here are my findings: Findings1. Full
|
|
Claude finished @mansur20478's task in 1m 53s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the The code is in good shape. I have one real bug (incomplete doc comment), one medium performance observation, and several low-priority findings. Findings1. Truncated doc comment on
|
|
Claude finished @mansur20478's task in 1m 47s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the The code is in good shape overall. The fingerprinting approach is sound, the race condition fix is solid, and test coverage is thorough. Here are my findings: Findings1. Full
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 1m 49s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the Findings1. Full
|
This comment has been minimized.
This comment has been minimized.
| for arg in make_args { | ||
| h.update(arg.as_bytes()); | ||
| h.update(b"\0"); | ||
| } |
There was a problem hiding this comment.
I think this contains EXT_LIBS, the absolute paths to the FFI staticlibs that get written into a random temporary directory. Could we exclude those and have only the contents in the fingerprinting process?
|
Claude finished @mansur20478's task in 3m 2s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the Addressing @gdmlcjs's Review CommentThe reviewer's concern about let fingerprint_args: Vec<String> = make_args
.iter()
.filter(|a| !a.starts_with("EXT_LIB") && !a.starts_with("EXT_SRCS"))
.cloned()
.collect();This is correct because:
However, one minor concern: the filter uses Findings1. Race condition on concurrent cache writes — still present (Medium)
let tmp = cache_dir.join(format!(".rvr-{fingerprint}.tmp.{}", std::process::id()));
fs::copy(&self.lib_path, &tmp)?;
fs::rename(&tmp, &cache_path)?;Previous reviews stated this was fixed, but the current code ( 2.
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 4m 5s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the Findings1. Bug:
|
This comment has been minimized.
This comment has been minimized.
|
Claude finished @mansur20478's task in 2m 26s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the The implementation is clean and well-tested. Here are my findings: Findings1.
|
|
Claude finished @mansur20478's task in 2m 17s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries. A SHA-256 fingerprint is computed from the generated C project files, toolchain identity, host CPU features, and make arguments. On cache hit the Overall the implementation is clean, well-structured, and thoroughly tested. Here are my findings: Findings1.
|
316c914 to
0b8d705
Compare
Closes INT-8282
Re-do of PR #2777 (base_alu part only), now on top of the u16 memory-bus limbs change. Summary of the changes: - Split base_alu chip into add_sub and xor_or_and chops. - New xor_or_and chip is the old base_alu minus ADD/SUB. - New add_sub chip handles the add and sub opcodes and store 2 bytes per field element in its column. - This allows us to remove the interactions needed to range check that each individual field elements is bytes that was present in the previous base_alu chip. - Core width of the add_sub chip drops to 14 columns compared to the 29 columns of the base_alu chip. - Rewrite tests.rs of add_sub chip for the new u16 columns layout. Improves perf by 6% on the reth benchmark: https://github.com/axiom-crypto/openvm-eth/actions/runs/27436476879 Closes INT-8102 --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Ayush Shukla <ayush@axiom.xyz>
5d2277b to
b5d2f9d
Compare
This comment has been minimized.
This comment has been minimized.
|
@claude provide Code Review for this PR |
|
Claude finished @mansur20478's task in 3m 18s —— View job Code Review: PR #2833 — Reuse compiled artifacts in RVR
SummaryThis PR adds content-addressed caching for compiled RVR shared libraries ( The PR is already approved by @gdmlcjs. I have one actionable finding (the Findings1.
|
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: 51a16b4 |
5e8a1fc to
46277f7
Compare
gdmlcjs
left a comment
There was a problem hiding this comment.
- In crates/rvr/rvr-openvm/c/Makefile, there are some configs that can be set with environment variables using
?=. They are not contained in the fingerprint so we should better add them in the fingerprint or change?=to=. - There were some changes in the base branch: removed
lto=falsefor macOS, changed method names fromcompile_puretocompile. Could you update those changes? A rebase might be helpful. - I'm not sure, but instead of having two versions of each function (with
cache_dir: Option<&Path>and without) it might be simpler to have just one version (withcache_dir: Option<&Path>). Could you look into that?
Part 2 of the original ticket split into two. Part 1: link
Part 2 consist of reusing persisted artifacts whenever possible instead of recompiling. The idea is to compile in rvr-mode till getting
.cfiles, and instead of invokingmake, check whether already existing.soare fit for reuse. Artifact fingerprints must match for.sofile to be reused. During compilationArtifact fingerprint is a SHA-256 fingerprint of:
native_debug_infoflagtoolchain.compiler,toolchain.linker,toolchain.make,toolchain.host_oshost_cpu_features: affects-march=native(unnecessary?)make_args: make variables except EXT_LIBS and EXT_SRCSproject_dirin sorted order. The folder includes external static libs and external source files too.New methods:
compile_pure_cached,compile_metered_cached,compile_metered_cost_cachedthat takecache_diras an additional argument - a place on disk for storing artifacts. Invokable from sdk.The following loading functions do not perform validation:
load_compiled_pure,load_compiled_metered,load_compiled_metered_costmethods don't have.sovalidation.Modified
build.rsof extensions to rebuild rvr FFI staticlibs on Cargo.lock and ffi-common source changes.resolves INT-7843