Finish the library warm up: bit_raw_add now optimises instead of falling back

The flat metric goes deeper than the exact one did (415M states for the full
adder), and 700M was not enough for bit_raw_add: it ran out, fell back to the
layer answer and cached that.  The box has 64 GB, not the 32 I assumed, so the
ceiling is now 1.5B states (~22 GB) and the search completes:

    bit_raw_add_synth: tape cost 38 in 5 blocks, 990,636,137 states, 680s

Same tape length as the fallback happened to give, but now it is actually the
minimum of the metric rather than whatever the layer search reached.

All seven cached bodies were re-derived against the old implementations after
the switch and still match bit for bit (bit_raw_add 0 9 10 19 12 21 22 31
repeated, bit_raw_inc 0 5 6 11, clb_bit_or 0 4 4 4, clb_bit_xor 0 4 4 0, ...),
so the shorter tapes are a free win.  asm/test.r8asm: 1674 -> 1666 characters,
and assembling it from the committed cache takes 0.5s.
This commit is contained in:
dsh committed 2026-11-06 19:24:41 +08:00
1 parent 14af0ca6ff
commit 5f92d288c9
1 file changed
+4 -3
+4 -3
View File
@@ -121,9 +121,10 @@ r8asm_synth_run(const std::vector<int> &in, const std::vector<int> &out,
// 2) shortest tape -- exact, so it stops as soon as the goal is popped
typename V::cost_options copt;
copt.max_states = 700'000'000; // the layout free metric explores more than
// the exact one did (415M); past this the
// table stops fitting in a laptop
// ~22 bytes per state. The layout free metric goes deeper than the exact one
// (415M states): bit_raw_add needed 990M, which is ~22 GB, so this ceiling
// leaves room on a 64 GB box
copt.max_states = 1'500'000'000;
if (int(layout.size()) == P)
for (int i = 0; i < P; i++)
copt.addr[i] = layout[size_t(i)];