From 5f92d288c92d87139ec8068cb7f22b4321d77c0e Mon Sep 17 00:00:00 2001 From: dsh Date: Fri, 6 Nov 2026 19:24:41 +0800 Subject: [PATCH] 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. --- src/synth.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/synth.cc b/src/synth.cc index 90830ea..39f1183 100644 --- a/src/synth.cc +++ b/src/synth.cc @@ -121,9 +121,10 @@ r8asm_synth_run(const std::vector &in, const std::vector &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)];