Commit 5181d0c
feat(vcr-ra): spill-cost ranking — Chaitin cost/degree spill choice (wiring step 2) (#285)
* feat(vcr-ra): spill-cost ranking — Chaitin cost/degree spill choice (#209/#242, wiring step 2)
VCR-RA-001 wiring step 2 (docs/design/vcr-ra-allocator-wiring.md). When no
node can be simplified (every degree >= k), the optimistic spill candidate is
now chosen by Chaitin's metric — minimise cost/degree, where cost is the
node's def+use occurrence count (each spill inserts a store per def and a
reload per use) and high degree is good to spill (more interference relieved).
- color_graph_precolored_costed(g, k, precolored, costs): the costed
variant. Integer cross-multiplied comparison (cost_a*deg_b vs
cost_b*deg_a), ties to the smallest register — fully deterministic.
- use_def_counts(instrs): per-register def+use occurrence counts via
reg_effect — the cost numerator.
- color_graph_precolored delegates with an empty cost map: every node
defaults to cost 1, so minimising cost/degree degenerates to maximising
degree — the historic degree-only candidate AND tie-break, exactly.
- allocate_function now computes real counts and ranks spill candidates
by them.
Pure and unwired: allocate_function is reachable only from the flag-gated
shadow pass (eprintln-only) and tests, so emitted bytes are unchanged by
construction — and verified: all four fixture ELFs are cmp-bit-identical to
main's, and the full differential passes (control_step 13/13 0x00210A55,
flight_seam inlined+flat 0x07FDF307, div_const 338/338).
Tests: costed_spill_picks_the_cheapest_node_not_the_smallest_reg (K4@k=3,
degree-symmetric, costs force R3 — exact spill set {R3}),
empty_costs_reproduce_the_degree_only_choice (same graph, no costs → {R0}),
use_def_counts_sums_defs_and_uses. 326/326 lib tests green, clippy clean.
Next (consequential, full differential gate): virtual-register selector
output (flag default-off) -> spill-code insertion -> wire-in + per-function
flip -> delete a hard-fail site.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* docs(vcr-ra): settle the step-3 design — 3a post-pass range re-allocation, 3b exhaustion-only virtual temps (#242)
3a is bounded and wins the measured targets (spurious spills, const-CSE
residency) but cannot remove the hard-fail; 3b (virtual temp ids >= 9 on the
would-have-failed path only) is what meets the acceptance criterion. Both
consume the same no-regret machinery (rename_def, range_interference, generic
Chaitin core, apply_range_coloring).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* docs(vcr): release-plan tags — SEL-002→v0.11.35, RA-001→v0.11.37, RA-002→v0.11.38 (#242)
Release plan lives in rivet (release-vX.Y tags; queryable via
rivet list --filter '(has-tag "release-v0.11.35")'). This rivet build has
no first-class release: field — friction filed separately.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent c963b7d commit 5181d0c
3 files changed
Lines changed: 191 additions & 12 deletions
File tree
- artifacts
- crates/synth-synthesis/src
- docs/design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
101 | 107 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
105 | 111 | | |
106 | 112 | | |
107 | 113 | | |
| |||
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
119 | | - | |
| 125 | + | |
120 | 126 | | |
121 | 127 | | |
122 | 128 | | |
| |||
303 | 309 | | |
304 | 310 | | |
305 | 311 | | |
306 | | - | |
| 312 | + | |
307 | 313 | | |
308 | 314 | | |
309 | 315 | | |
| |||
328 | 334 | | |
329 | 335 | | |
330 | 336 | | |
331 | | - | |
| 337 | + | |
332 | 338 | | |
333 | 339 | | |
334 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
937 | 937 | | |
938 | 938 | | |
939 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
940 | 965 | | |
941 | 966 | | |
942 | 967 | | |
| |||
949 | 974 | | |
950 | 975 | | |
951 | 976 | | |
952 | | - | |
| 977 | + | |
953 | 978 | | |
954 | 979 | | |
955 | 980 | | |
956 | 981 | | |
957 | 982 | | |
958 | 983 | | |
959 | | - | |
960 | | - | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
961 | 988 | | |
962 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
963 | 994 | | |
964 | 995 | | |
965 | 996 | | |
| |||
1564 | 1595 | | |
1565 | 1596 | | |
1566 | 1597 | | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
1567 | 1615 | | |
1568 | | - | |
| 1616 | + | |
| 1617 | + | |
1569 | 1618 | | |
1570 | 1619 | | |
1571 | 1620 | | |
| |||
1578 | 1627 | | |
1579 | 1628 | | |
1580 | 1629 | | |
1581 | | - | |
| 1630 | + | |
| 1631 | + | |
1582 | 1632 | | |
1583 | 1633 | | |
1584 | 1634 | | |
| |||
2493 | 2543 | | |
2494 | 2544 | | |
2495 | 2545 | | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
2496 | 2610 | | |
2497 | 2611 | | |
2498 | 2612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
0 commit comments