Repository navigation
perf(sv-analyzer): retain resolved parameter literals - #1174
Merged
Merged
Conversation
tignear
marked this pull request as ready for review
October 10, 2026 12:36
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tignear
enabled auto-merge
October 10, 2026 12:45
tignear
added this pull request to the merge queue
Oct 10, 2026
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.
Parameter binding and AST-to-IR conversion resolved a nonnumeric value twice: numeric fallback first produced an X/Z or wide literal and discarded it, then the caller resolved the same literal again for publication. Return the numeric result and fallback literal together so each binding resolves a literal at most once.
Direct numeric values still skip literal resolution. A number recovered from a fallback literal retains numeric precedence, while unknown/wide literals remain available to dependent declarations. Unresolved expressions, type-publication order, numeric formatting and the generate binder's existing fallback are preserved. The result is local to each binding; no cache crosses declarations or analyses. Public APIs are unchanged.
Owning-crate regressions compare against the former two-stage resolver for dependencies, selects, signed shifts, stale self-values, two-state conversion, wide values and unresolved names. They verify numeric recovery from an unknown dependency and the generate binder's unresolved fallback. Complete module AST/IR runs at 16/64/256 parameters count one literal evaluation per binding and per exported IR parameter, instead of two.
Performance
Base: synchronized master
ef37b2c6c(#1170). A manual optimizedheliodor-devprobe replays the same synthetic unknown prefix with both resolvers in one process, alternates their order, asserts every 32-bit X mask and reports seven-run medians:The large replay sample is about 2.8x faster. This measures value resolution, metadata publication and mask checks, excluding parsing, enclosing-declaration discovery and backend/simulation work. Counts establish the eliminated second evaluation independently of timing variability.
Separate full AST runs do not establish an overall speedup on the shared machine: at 512 four-state module parameters, AST time was 285.531/481.522 ms before/after while parsing was 80.219/137.527 ms; reverse-generate AST was 3,961.605/8,534.573 ms while parsing was 85.630/209.199 ms. Preliminary generated size queries still dominate that path. Detailed phase timings and limitations are retained in
docs/internals/sv-analysis-performance.md; no universal speedup or linearity is claimed.Validation
Locked Nix shell, default managed Cargo targets:
cargo clippy --locked -p celox-sv-analyzer -p celox-frontend-sv --all-targets --all-features -- -D warnings.cargo test --locked -p celox-sv-analyzer -p celox-frontend-sv --all-features --quiet— 230 passed; doctests passed. The new manual timing probe is deliberately ignored in ordinary runs and was executed separately.cargo test --locked -p celox --features sv-dpi --test systemverilog --test sv_unpacked_array --test sv_dpi --test sv_packages --test interface --test advanced_interface --quiet— 1,617 SV, 52 DPI, 7 array, 37 package and 216 interface tests passed; 39 existing interface exclusions remain. Includes native/Cranelift/Wasm and applicable parallel/four-state variants.cargo test --locked -p celox-test-suite --features verilator,icarus --quiet— 52 library/integration tests and 2 doctests passed; 9 existing external oracles ignored.cargo doc --locked -p celox-sv-analyzer -p celox-frontend-sv --no-depsandpnpm docs:build.cargo test --locked -p celox-sv-analyzer --profile heliodor-dev --lib compare_retained_and_repeated_parameter_resolution -- --ignored --nocapture— passed.type_queriesmodes at 32/128/512 entries, asserting their IR outputs.No shared executable cases, external adapters/emitter or retained proof/report artifacts change. External simulators were not rerun for this analyzer-only optimization under AGENTS.md/CONTRIBUTING.md. Default NAPI does not enable this frontend.