Conversation
- Memory::get: skip the relocation round-trip and redundant copy for values that cannot be affected by relocation rules (everything except pointers into temporary segments). - Memory::insert: compute segment indexes once instead of twice. - Range-check validation: replace the boxed-closure rule with an inline tagged rule, removing a heap allocation per range-checked value. - step_instruction: drop the per-step mem::take + resize of the instruction cache; copy the (Copy) Instruction out instead. This also keeps the cache intact if run_instruction returns an error. - deduce_op1: take op0 by reference, avoiding a felt clone per deduced operand. - update_registers: take operands by reference instead of by value. - BuiltinHintProcessor: skip hashing the full hint source on every hint execution when no extra hints are registered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cp3KwJwrs4QKjhpMLeAA3f
…ssed - Memory::insert: convert the incoming value to a MemoryCell once and compare cells directly (ignoring the ACCESS flag), instead of materializing a MaybeRelocatable from the stored cell for the consistency check on every write. - mark_as_accessed_batch: mark the four per-step addresses (dst, op0, op1, pc) in one call, resolving each segment once for consecutive same-segment addresses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Sep 9, 2026
|
|
Benchmark Results for unmodified programs 🚀
|
- Pin the one remaining tag-referenced actions/cache/restore to the v3 commit SHA (org policy rejects tag-pinned actions). - Run cargo-machete directly: the bnjbvr/cargo-machete action internally uses clechasseur/rs-cargo by tag, which the policy rejects transitively. - Move the install canary from debian:11 (EOL, expired Release files) to debian:12. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 05f9326)
Under Node 24, the v3 cache/restore action logs the fail-on-cache-miss error but exits 0, so a cache miss silently produces jobs running with incomplete program caches (and merge-caches then persists a poisoned all-programs entry in the PR's cache scope). v4 fails properly, and its entries use a different cache version, which also side-steps already-poisoned v3 entries. iai_pr/iai_main/fuzzer still use v3: bumping the iai pair requires repopulating the main-scoped baseline caches first, or PR iai runs will hard-fail on the (previously silent) baseline miss. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 5666249)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2391 +/- ##
==========================================
+ Coverage 96.21% 96.23% +0.01%
==========================================
Files 107 107
Lines 37925 37985 +60
==========================================
+ Hits 36490 36555 +65
+ Misses 1435 1430 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vm/src/tests/cairo_test_suite has no programs on main, so its build target produces nothing, no cache is ever saved, and the restore in merge-caches can never hit (previously masked by the v3 exit-0 bug). Skip the restore while the suite is empty; once programs land, hashFiles is non-empty and the step hard-fails on real misses again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 666b691)
This branch has not been deployed
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.
Reduces per-instruction overhead in the VM execution hot paths:
Memory::get: skip the relocation round-trip and redundant 40-byte copy for values that cannot be affected by relocation rules (everything except pointers into temporary segments). Hits 3–4 reads per instruction.Memory::insert: compute segment indexes once instead of twice, and compareMemoryCells directly (ignoring the ACCESS flag) instead of materializing aMaybeRelocatablefor the consistency check.step_instruction: drop the per-stepmem::take+resizeof the instruction cache; copy the (Copy)Instructionout instead. Also keeps the cache intact ifrun_instructionerrors.deduce_op1: takeop0by reference, avoiding a felt clone per deduced operand.update_registers: take operands by reference instead of by value (~168-byte move per step).BuiltinHintProcessor: skip hashing the full hint source on every hint execution when no extra hints are registered.mark_as_accessed: batch the four per-step address marks, resolving each segment once for consecutive same-segment addresses.Measured on
cairo_programs/benchmarks(best-of-5,--layout all_cairo --proof_mode): −10% to −32% wall clock on most benchmarks (big_fibonacci −32%, pedersen −28%, linear_search −20%, keccak_integration −18%).🤖 Generated with Claude Code
Performance
Expected: removes per-instruction overhead on every VM step — 3–4 relocation round-trips + 40-byte copies per step in
Memory::get, a heap alloc per range-checked value, amem::take+resizeper step in the instruction cache, a felt clone per deduced operand, a ~168-byte operands move per step, a full-source hash per hint execution, and redundant index computations ininsert/mark_as_accessed. Applies to essentially every workload; biggest where steps are cheap (tight loops) so per-step overhead dominates.Measured (best-of-7, wall clock vs
main, local; noise ±2.4%):Every benchmark improves, −7% to −21%. An independent earlier measurement on a different machine (4-core container, best-of-5, before the
insert/mark_as_accessedcommits were added) showed the same shape: big_fibonacci −32%, pedersen −28%, linear_search −20%, keccak −18%, dict −16%, big_factorial −13%, math −10%.Methodology:
cairo_programs/benchmarks/*.cairocompiled with cairo-lang 0.14--proof_mode, run viacairo-vm-cli <prog>.json --layout all_cairo --proof_mode, hyperfine best-of-7 per binary, local x86-64 Linux. Noise floor (identical-code control pair): ±2.4%.This change is