Skip to content

perf(sv): parse wide based literals in linear time - #2703

Merged
mergify[bot] merged 1 commit into
masterfrom
perf/sv-linear-literal-parse
Oct 31, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
perf/sv-linear-literal-parse

Conversation

@tignear

@tignear tignear commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

parse_power_of_two_based_digits accumulated 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_shl2 and shl_assign under parse_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 build goes 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

  • New power_of_two_digits_parse_like_shifting_parser test: 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-analyzer lib tests (932) pass; systemverilog vtest literals:: | operators::: 385 passed.

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T08:52:09.921244Z 20361c5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 31, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 31, 2026
@mergify

mergify Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into master as 5a591bf at 09:59 UTC

Merged together with #2695, #2704. 19 min in the queue, 17 min of it CI.

So far

9 merge conditions met
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • check-success = Verify workflow lockfile
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/Queue validation
    • check-neutral = @github-actions/Queue validation
    • check-skipped = @github-actions/Queue validation
  • any of · required by GitHub repository ruleset rule master:
    • check-success = @github-actions/Verify workflow lockfile
    • check-neutral = @github-actions/Verify workflow lockfile
    • check-skipped = @github-actions/Verify workflow lockfile

Times in UTC · dashboard · how the merge queue works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant