Repository navigation
perf(sv): parse wide based literals in linear time - #2703
Merged
Merged
Conversation
Binary, octal and hex digits were accumulated by shifting the whole value and mask once per digit, so parsing a literal was quadratic in its width. The constant interpreter round-trips wide values through such literals: evaluating the 14,884-bit mask function of Taxi's 64-bit LFSR spent about 30% of its compile time in these shifts. Fill each digit's bits of the value and mask words directly instead; octal digits may straddle a word boundary. An equivalence test checks random digit strings, including unknown and invalid digits, against the shifting parser. Change-Id: Icdda4fd7195824bdd3bfcbad8e02a4c7a518ba70
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. |
Contributor
✅ Merged into
|
This was referenced Oct 31, 2026
Merged
Closed
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.
parse_power_of_two_based_digitsaccumulated binary, octal and hex digits by shifting the whole value and mask once per digit, so parsing was quadratic in the literal width. The constant interpreter round-trips wide values through such literals. Evaluating the 14,884-bit mask function of Taxi's 64-bit LFSR spent about 30% of the remaining compile time in these shifts (biguint_shl2andshl_assignunderparse_integral_literal).The parser now fills each digit's bits of the value and mask words directly. An octal digit may straddle a 32-bit word boundary, and the parser handles that case.
Effect
Together with the PR that folds zero-argument functions whose kept result is never read, single-CPU
celox vpi buildgoes from 18 s to 10 s for Taxi lfsr64 and from 50 s to 24 s for phy64. Peak RSS is unchanged at about 250 to 290 MiB.Validation
power_of_two_digits_parse_like_shifting_parsertest: 20,000 random digit strings (binary, octal and hex, with x/z/? and invalid digits) give results equal to the previous shifting parser.celox-sv-analyzerlib tests (932) pass;systemverilogvtestliterals:: | operators::: 385 passed.