Skip to content

perf(sv): lower the state modules of packages in parallel - #4857

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/perf/sv-parallel-lowering/lower-state-modules-pkgs-parallel--3c8a4060
Nov 28, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/perf/sv-parallel-lowering/lower-state-modules-pkgs-parallel--3c8a4060

Conversation

@tignear

@tignear tignear commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

The state modules of the packages are lowered on up to compile_workers
threads (ParallelScheduleOptions), the largest first, and what they give
is passed on in their order as before, so the result is the same for every
thread count. A UVM design has one per package, each with thousands of
subroutines.

The count comes from the new compile_threads option
(SimulatorBuilder::compile_threads, NAPI/TS compileThreads, celox run --compile-threads), which defaults to the available parallelism and is
not the simulation threads. It is one budget for compiling: native code
generation takes its workers within it too (compile_resources, the lane
kernels), still at most four and as its memory budget allows. One thread
compiles everything on the calling thread. opt_level, optimize and
optimize_options keep a count set before them, as they keep the lanes.

A test lowers six packages and four module specializations at 1, 2, 4
and 16 threads and compares the SIR, the warnings and the recursion
report.

AVIP axi4_base_test (nocb copy, heliodor-dev, 16 cores, quiet lock), this
commit alone at 16 threads: the packages phase 10.9 s -> 4.4 s, wall
1:22.9 -> 1:17.0. With the next commit, master -> tip, two runs each:

  • wall 1:24.6 / 1:24.1 -> 1:13.3 / 1:13.0 (-13%)
  • packages 11.8 / 11.8 s -> 4.2 / 4.5 s; specialize_modules 6.1 / 5.7 s
    -> 2.4 / 2.6 s; sv_frontend 63.7 / 63.3 s -> 53.1 / 53.7 s
  • CPU 129.5 / 128.4 s -> 137.2 / 137.0 s; instructions:u 988.7 / 992.4 G ->
    1009.1 / 1018.4 G
  • peak RSS 10.90 / 10.96 GB -> 10.93 / 11.03 GB; 10.73 GB at 4 threads,
    10.96 GB at 8, 9.05 GB at 1 (native code generation on one worker)
  • stdout identical to master at 1, 4, 8 and 16 threads

Gates (heliodor-dev, master ee408c1 -> the stack tip at the default 16
compile threads):

  • the UVM cases give output identical to master: 18.10 instructions:u
    182.2 -> 182.6 G, 16.10 245.4 -> 247.1 G, uvm_scoreboard_env 287.2 ->
    289.0 G; the 16.9 elaboration exits 0 (183.8 -> 185.5 G);
  • VeeR-EL2: compile 91.7 / 92.5 s -> 89.3 / 89.5 s; instructions:u
    1197.11 / 1197.04 G -> 1198.64 / 1198.64 G (+0.13%, the thread
    overhead: 1197.02 G with --compile-threads 1). Its simulation executes
    12740.84 M -> 12741.64 M instructions (+0.006%) at 1 and at 16 threads
    alike, from the first commit of the stack on, which only moves the task
    runner between crates: the layout of the host binary, not the generated
    code.

Depends-On: #4856

The state modules of the packages are lowered on up to `compile_workers`
threads (`ParallelScheduleOptions`), the largest first, and what they give
is passed on in their order as before, so the result is the same for every
thread count. A UVM design has one per package, each with thousands of
subroutines.

The count comes from the new `compile_threads` option
(`SimulatorBuilder::compile_threads`, NAPI/TS `compileThreads`, `celox run
--compile-threads`), which defaults to the available parallelism and is
not the simulation `threads`. It is one budget for compiling: native code
generation takes its workers within it too (`compile_resources`, the lane
kernels), still at most four and as its memory budget allows. One thread
compiles everything on the calling thread. `opt_level`, `optimize` and
`optimize_options` keep a count set before them, as they keep the lanes.

A test lowers six packages and four module specializations at 1, 2, 4
and 16 threads and compares the SIR, the warnings and the recursion
report.

AVIP axi4_base_test (nocb copy, heliodor-dev, 16 cores, quiet lock), this
commit alone at 16 threads: the `packages` phase 10.9 s -> 4.4 s, wall
1:22.9 -> 1:17.0. With the next commit, master -> tip, two runs each:
- wall 1:24.6 / 1:24.1 -> 1:13.3 / 1:13.0 (-13%)
- `packages` 11.8 / 11.8 s -> 4.2 / 4.5 s; `specialize_modules` 6.1 / 5.7 s
  -> 2.4 / 2.6 s; sv_frontend 63.7 / 63.3 s -> 53.1 / 53.7 s
- CPU 129.5 / 128.4 s -> 137.2 / 137.0 s; instructions:u 988.7 / 992.4 G ->
  1009.1 / 1018.4 G
- peak RSS 10.90 / 10.96 GB -> 10.93 / 11.03 GB; 10.73 GB at 4 threads,
  10.96 GB at 8, 9.05 GB at 1 (native code generation on one worker)
- stdout identical to master at 1, 4, 8 and 16 threads

Gates (heliodor-dev, master ee408c1 -> the stack tip at the default 16
compile threads):
- the UVM cases give output identical to master: 18.10 instructions:u
  182.2 -> 182.6 G, 16.10 245.4 -> 247.1 G, uvm_scoreboard_env 287.2 ->
  289.0 G; the 16.9 elaboration exits 0 (183.8 -> 185.5 G);
- VeeR-EL2: compile 91.7 / 92.5 s -> 89.3 / 89.5 s; instructions:u
  1197.11 / 1197.04 G -> 1198.64 / 1198.64 G (+0.13%, the thread
  overhead: 1197.02 G with --compile-threads 1). Its simulation executes
  12740.84 M -> 12741.64 M instructions (+0.006%) at 1 and at 16 threads
  alike, from the first commit of the stack on, which only moves the task
  runner between crates: the layout of the host binary, not the generated
  code.

Change-Id: I3c8a40603fbb829a8fcc81728424963c925d0efa
@tignear

tignear commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 refactor(sv): lower the package state modules as self-contained tasks #4856
2 perf(sv): lower the state modules of packages in parallel #4857 👈
3 perf(sv): lower the specialized modules in parallel #4858

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T14:00:01.013986Z 5d7848e 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.

@mergify

mergify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

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

mergify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into master as fb177a9 at 14:47 UTC

Merged together with #4858. 12 min in the queue, 11 min of it CI.

So far

  • ✅ Entered the queue Sat 28 Nov, 14:35 · rule changes · triggered by rule Queue explicitly requested merges
  • ✅ Passed · draft #4860
  • ✅ Merged 14:47 · fb177a9 · merge
11 merge conditions met
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • check-success = Verify workflow lockfile
  • depends-on=celox-sim/celox#4857
  • any of:
    • depends-on = celox-sim/celox#4856
    • number != 4857
  • 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

Base automatically changed from stack/tignear/perf/sv-parallel-lowering/lower-pkg-state-modules-self-contained-tasks--ba2b1236 to master November 28, 2026 14:39
@mergify
mergify Bot merged commit fb177a9 into master Nov 28, 2026
30 checks passed
@mergify mergify Bot removed the queued Mergify queue entry label Nov 28, 2026
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