Repository navigation
perf(sir-opt): share one state SSA analysis among sink recipe stability checks - #2003
Merged
Merged
Conversation
…ty checks Effect-case dispatch planning checked each sink recipe's loads with a StateSsa analysis of just those loads, which scans the whole execution unit: O(recipes x unit size) per selector group. State SSA versions an exact location from that location's own definitions and kills, so one analysis selecting every load of a region versions each location as an analysis of fewer loads does. The unit now builds that analysis once per region, on first use, and each recipe reads its verdict from it: - The shared analysis leaves out the loads that make their location invalid in every selection containing them, so they have no version there, as in their recipe's own analysis. - A packed load is versioned only when its recipe also has a static load of the same bits, as a slot exists only for those. If the shared analysis fails, the recipe is analyzed on its own as before. Every verdict is the same. Closes #1998 Change-Id: Ief18a8459b6318c3dc619453041e66c9fc9aa13d
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
Merge Queue Status
This pull request spent 30 minutes 58 seconds in the queue, including 26 minutes 23 seconds running CI. Required conditions to merge
|
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.
Effect-case dispatch planning checks each sink recipe's frontier loads with
loads_are_stable_at. That function ranStateSsa::analyze_selected_loads_two_stateover just those loads, which scans every instruction of the execution unit. It ran for each case context of each sink recipe, at two call sites, so the cost was O(recipes × unit size) per selector group.Change
State SSA versions an exact location from that location's own definitions, kills and phis. So one analysis selecting every load of a region versions each location as an analysis of fewer loads does.
plan_best_effect_case_dispatchnow keeps aLoadVersionsper unit: one shared analysis per region, built on first use. Each recipe reads its verdict from it.The parts of the per-recipe analysis that depend on the selection are handled explicitly:
Every verdict is the same as before. The cost is one scan per region plus the size of each recipe.
Tests
control_region_feasibility::tests::shared_load_versions_match_per_recipe_analysis(equivalence against the current per-recipe analysis). It builds random units with a branch, a join and a loop, containing overlapping static loads and stores, packed and dynamic loads, wrong-width, four-state and untyped registers, and zero-width accesses. For random load selections at every target block (over 10,000 checks, more than 100 of them stable), the shared verdict equalsloads_are_stable_at_by_analysis. The test fails if the per-recipe packed-load location check is removed, or if the shared selection keeps the invalidating loads.celox/systemverilog,celox-test-suite/{verilator,icarus,xezim,runtime-cases}) overcelox,celox-frontend-sv,celox-test-suiteandcelox-sir-opt: 15199 passed, 331 skipped.cargo clippy -p celox-sir-opt --all-targets -D warningsandcargo fmt --checkare clean.Like the other complexity-order fixes, this PR has no before/after benchmark.
Closes #1998