Skip to content

perf(sv): find multi-store candidates through condensed block components - #1990

Merged
mergify[bot] merged 1 commit into
masterfrom
perf/1988-multi-write-candidates
Oct 25, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
perf/1988-multi-write-candidates

Conversation

@tignear

@tignear tignear commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Closes #1988.

Summary

multi_write_candidates (crates/celox-frontend-core/src/watch.rs) walked every block reachable from each write to look for another write of the same key. That made it quadratic or worse in the unit size, and on C906 ff_multi_stored spends minutes in it.

It now:

  • condenses the block graph into strongly connected components once (iterative Tarjan);
  • computes, per component, the set of written keys in it or downstream of it (bit sets, processed a chunk of 4096 keys at a time to bound memory);
  • marks a write as a candidate when its key is written again later in its block, its block lies in a cyclic component, or a successor component's downstream set holds the key.

Keys written only once in the unit skip the bit sets: such a key is a candidate only around a loop. The result is the same list in the same order (first qualifying write by block id, then position), so every caller (multi_store_candidates, multi_store_only_candidates, the SV lowering and SDK callers) gets the speedup with unchanged diagnostics and lowering.

Tests

  • candidates_match_a_walk_from_every_write: keeps the old walk as a reference and compares it with the new function on 5000 generated units. The units have sparse block ids, forward and backward edges (loops, self loops), edges to missing blocks, returns, jumps, branches and switches, and stores, commits and other instructions.
  • candidates_beyond_one_chunk_of_keys_are_found: 5000 multiply written keys, more than one chunk of the bit sets.
  • The existing watch tests pass unchanged.

Per the decision for complexity-order fixes, no timing or callgrind comparison was run.

Closes #1988

Change-Id: Id174035327e6e49871ff41babe63eb7724cb9736
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 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-25T10:58:58.485968Z 73fc204 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 25, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 25, 2026
@mergify

mergify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 40 minutes 50 seconds in the queue, including 39 minutes 12 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • any of [🛡 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 [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 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 [🛡 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 [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 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

@mergify
mergify Bot merged commit fc0b162 into master Oct 25, 2026
23 checks passed
@mergify
mergify Bot deleted the perf/1988-multi-write-candidates branch October 25, 2026 12:09
@mergify mergify Bot removed the queued Mergify queue entry label Oct 25, 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.

perf(sv): multi-store candidate detection walks reachable blocks for every store

1 participant