Trace-gen cleanup: single MU-column source, simpler push_reg_access, tighter visibility, stale docs#795
Open
MauroToscano wants to merge 1 commit into
Open
Conversation
…tighter visibility, stale docs - BITWISE MU columns now derive from one `MU_COLUMNS` array with a compile-time distinctness assert, so a duplicate column is a build error rather than a silent overwrite in fill_multiplicities. - push_reg_access takes [u32;2] val/old pairs and builds its own fallback op instead of an 8-scalar signature plus a repacking closure. - Narrow BitwiseHistogram + the MU-column/lookup-type helpers to pub(crate); scope the test-only generate_memw_register_trace wrapper. - Fix stale docs (MemwSink Vec impl is the sizing pass, not tests; generate_bitwise_trace MU columns are filled by fill_multiplicities).
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.
Cleanup bundle from #786's final review (findings #1/#3/#4/#7/#8). No behavior change; prove+verify pass byte-identical.
#1 — one source of truth for the MU-column map (bitwise.rs)
The compile-time guard proved
ALL ↔ lookup_type_indexis a bijection but did not covermu_columnitself, so a future typo mapping two lookup types to the same MU column would be silently lossy underfill_multiplicities' overwrite semantics (and diverge fromupdate_multiplicities, which increments). Now a singleconst MU_COLUMNS: [usize; NUM_LOOKUP_TYPES]inlookup_type_indexorder is the only type→column source;mu_column/type_mu_columnboth read from it, and aconst _assert checks the entries are pairwise distinct — a duplicate column is now a build error. Also deletes the second 10-arm match.#7 — simpler
push_reg_access(trace_builder.rs)Was 8 loose scalars (
val0/val1/old0/old1among them) plus abuild_fallbackclosure repeated at 3 call sites, needing#[allow(clippy::too_many_arguments)]. Now takesval: [u32;2],old: [u32;2](kills the transposition footgun — a swapped arg would silently write a wrong trace cell) and a sharedbuild_reg_fallbackbuilds the op internally. Verified byte-for-byte against the old closures: reads passval==old==reg_value, the write passesval=reg_value, old=old_value; the fallback packs[v0,v1,0,…]which is identical sincepack_register_valuealready zeroes indices 2–7.#8 — tighter visibility (bitwise.rs, memw_register.rs)
BitwiseHistogram+ its methods and the MU-column/lookup-type helpers (mu_column,lookup_type_index,NUM_LOOKUP_TYPES,BitwiseOperationType::ALL) are internal to the prover crate →pub(crate)(grep-verified no cross-crate use). TheMemwOperation-basedgenerate_memw_register_tracehad only test callers →#[cfg(test)](production usesgenerate_memw_register_trace_from_rows).#3, #4 — stale docs
MemwSink'sVecimpl is used by thecount_table_lengthssizing pass, not "tests/scratch";generate_bitwise_trace's MU columns are filled byfill_multiplicities, notupdate_multiplicities(which now only tops up the continuation L2G path).Testing
cargo test -p lambda-vm-prover --lib: 502 passed (only the 5 known missing rust-guest ELF fixtures fail, at file-read).make lint,clippy --all-targets,fmt --checkclean.Independent of #794 (the parallelism ABBA PR); both branch off
perf.