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.
|
Add save and load compiled artifacts feature in `rvr` mode. The feature consist of having the ability to save compilation artifacts on disk and load them into the sdk to execute (part 1). Reusing of the persisted artifacts whenever possible instead of recompiling based on some metadata (part 2) will be done in separate PR. This PR is related to the part 1. The following methods were added: 1) `Sdk::load_compiled_pure`, `Sdk::load_compiled_metered`, `Sdk::load_compiled_metered_cost` and related methods for loading pure, metered and metered cost `.so` files 2) `RvrPureInstance::save`, `RvrMeteredInstance::save`, `RvrMeteredCostInstance::save` and related methods for saving `.so` file towards INT-7843
db2328d to
61ee036
Compare
Code reviewFindings1. Cache fingerprint does not differentiate aarch64 (or any non-x86) Linux hosts —
openvm/crates/vm/src/arch/rvr/artifact_cache.rs Lines 64 to 93 in 5d2277b That line only exists on x86/x86_64. On aarch64 Linux the equivalent line is Meanwhile the Concrete failure: A shared Suggested fix (smallest): on Linux, look for both CLAUDE.md compliance: clean — no file-structure, CUDA-gating, generated-C, or naming-convention violations in the changed lines. Reviewed at PR head |
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: 5d2277b |
04b8de5 to
5b4a788
Compare
316c914 to
0b8d705
Compare
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.towards INT-7843