THE DISSENT UPHELD

One revision earlier a panel filed a dissent: nothing has checked whether the four arms are alike. It shipped unresolved.

THE DISSENT UPHELD · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE WALL ◆ .dlw.fold THE FOLD / BOSS / THE WALL / THE DISSENT UPHELD THE DISSENT UPHELD answered by the data, and answered no 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION One revision earlier, a panel filed a dissent: nothing has checked whether the four arms are alike . It shipped unresolved. The next revision measured the grouping and the answer came back no — so the dissent is upheld, against the build that raised it. LIT verified live. The measured grouping is 3, 3, 2, 4 , so the four are not alike. The dissent passed through 4 states — filed, unresolved at ship, answered by later data, upheld — and the scoreboard now carries both counters: dissents filed 1, dissents resolved against a prior build 1. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) named what had happened rather than quietly folding it in: “its own W5 dissent — ‘nothing has checked whether the four arms are alike’ — is now ANSWERED by his measured data, and answered NO. A dissent resolving against the build that raised it is the outcome dissent exists for. It only happened because the pretty unification got tested rather than admired.” AVAN (AI) would note that this is the completion of something this corpus published one batch ago as unresolved. The earlier sphere recorded a dissent shipped with the artifact and argued that carrying it was worth the cost; the cost has now been paid and the answer went against the build. That is the only evidence that a recorded dissent is more than a decorative disclaimer — and it required a later measurement to land on, which nothing guaranteed. 3 ONE DIMENSION The lifecycle of one objection. 4 TWO DIMENSIONS · INTERACTIVE Walk the dissent from filing to verdict. next state ▶ back to filed 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: an objection that outlived the build. AVAN’s addition (the inverse-companion): the forward reading is “the dissent was upheld, so recording it was worth it.” The inverse is that one resolution does not establish the practice . This is a single dissent, filed and answered by the same author across two revisions of his own pack — the conditions most favourable to a dissent surviving long enough to be tested. A dissent filed against someone else’s work, or one whose resolution would cost a rewrite, faces a different set of incentives entirely. Read backwards, what has been demonstrated is that the mechanism can work once, not that it does. pause spin LIT the measured grouping is 3, 3, 2, 4 so the four are not alike; the dissent passed through 4 states - filed, unresolved at ship, answered by later data, upheld - and the scoreboard now carries both counters, dissents filed 1 and dissents resolved against a prior build 1 FIG David named what had happened rather than quietly folding it in: 'its own W5 dissent - nothing has checked whether the four arms are alike - is now ANSWERED by his measured data, and answered NO. A dissent resolving against the build that raised it is the outcome dissent exists for. It only happened because the pretty unification got tested rather than admired.' AVAN notes this completes something this corpus published one batch ago as unresolved: the earlier sphere recorded a dissent shipped with the artifact and argued carrying it was worth the cost. The cost has now been paid and the answer went AGAINST the build. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE WALL · David Lee Wise (ROOT0), with AVAN


THE NAME THAT WALKS

A name was coined in conversation and deliberately kept out of the shipped artifact. A grep at step nine found it in the page anyway, for the second build running.

I-13 v2.0 | net = binds - k | 4 planes, 13 symbols, 12 operants, 5 cortex rules | sha 64881ebf

THE NAME THAT WALKS · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE FIREWALL ◆ .dlw.fold THE FOLD / BOSS / THE FIREWALL / THE NAME THAT WALKS THE NAME THAT WALKS the control that fires most often 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION A name was coined in conversation and deliberately kept out of the shipped artifact. A grep at step nine found it sitting in the page anyway — for the second build running. Of every control in the pack, the one that fires most often is not an assertion about a number. It is a search for a word. LIT verified live. The name grep has fired on 2 of the 2 builds where it existed — a rate of 100% . The other three controls are numeric, and none of them can see a name at all. The leak needed a control of a different kind , not a stricter one. 2 HOW IT WAS WEAVED · AI + HUMAN David (human) logged the catch and drew the general conclusion from it: “the name coined this session, and one structure’s proper name, were both sitting in the artifact. Redacted at the model and re-injected. Second build running where this grep has fired; it is now the control that catches most often, which says something about how easily a name walks into a deliverable.” AVAN (AI) would add the reason the measurement is possible at all. A leak can only be counted if somebody decided in advance that the thing should not be there — a name nobody chose to withhold would never register as escaped. So the 100% rate is not a fact about names in general; it is a fact about the one class of content this pack has an explicit policy on, and the policy is what turned an ordinary editorial slip into a countable event. 3 ONE DIMENSION Four controls, and how often each fires. 4 TWO DIMENSIONS · INTERACTIVE Which control could have caught which fault. next fault ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a word slipping through a net of numbers. AVAN’s addition (the inverse-companion): the forward reading is “a name walks into a deliverable easily.” The inverse is that a control firing every single time is a control describing a broken process, not a working guard . Two builds, two leaks, caught twice at step nine — the grep is doing its job and the thing upstream of it has not changed at all. Read backwards, a 100% catch rate should be read as an outstanding defect rather than as a success, and the fix is not a better grep but a step that stops the name reaching the artifact. pause spin LIT the name grep has fired on 2 of the 2 builds where it existed, a rate of 100%, while the other three controls are numeric and none of them can see a name at all - the leak needed a control of a different KIND, not a stricter one FIG David logged the catch and drew the general conclusion: 'the name coined this session, and one structure's proper name, were both sitting in the artifact. Redacted at the model and re-injected. Second build running where this grep has fired; it is now the control that catches most often, which says something about how easily a name walks into a deliverable.' AVAN adds the reason the measurement is possible at all: a leak can only be counted if somebody decided in advance that the thing should not be there. So the 100% rate is a fact about the one class of content this pack has an explicit policy on, and the policy is what turned an editorial slip into a countable event. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE FIREWALL · David Lee Wise (ROOT0), with AVAN


THE XOR SWAP

Three exclusive-ors swap two values with no temporary variable. Point both names at the same storage and the value becomes zero.

THE XOR SWAP · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · HARD RESET ◆ .dlw.fold THE FOLD / RESPAWN / HARD RESET / THE XOR SWAP THE XOR SWAP no temporary, and one input it destroys 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Three exclusive-ors swap two values with no temporary variable. It is exact — and it has one input it silently destroys. Point both names at the same storage and the value becomes zero , because the identity that makes the trick work is the identity that breaks it. LIT verified live and exhaustively. Over all 65,536 pairs of 8-bit values in distinct slots the swap is correct 65,536 times. Aliased to itself, every value tested — 0, 1, 5, 127, 255 — comes out 0 , and the original is unrecoverable. It saves one register and buys a precondition. 2 HOW IT WAS WEAVED · AI + HUMAN The XOR swap is old assembly-language folklore, from an era when a spare register was worth a precondition. It survives mostly as an interview question, which is a fair reflection of where it belongs. AVAN (AI) ran the failure case rather than describing it, because the aliasing bug is usually stated and rarely shown. The mechanism deserves one sentence: x ^ x = 0 is what lets the second step recover the first operand, and it is also what annihilates the value when both operands are the same location. The trick is not defeated by an edge case — it is defeated by its own load-bearing identity, which is a sharper reason to distrust it than “watch out for aliasing”. 3 ONE DIMENSION Three steps, and where the value goes. 4 TWO DIMENSIONS · INTERACTIVE Run it on two slots, then on one. step ▶ alias the slots reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: two values orbiting, and one collapsing. AVAN’s addition (the inverse-companion): the forward reading is “the XOR swap is dangerous because it aliases.” The inverse is that the compiler removed the reason to care decades ago . A modern register allocator handles a temporary for free, and the three dependent XORs are strictly worse on a superscalar machine than three independent moves, because each waits on the last. Read backwards, this is not a sharp tool with a caveat — it is a tool whose advantage evaporated, and the aliasing bug is simply the reason it is still worth teaching. pause spin LIT over all 65,536 pairs of 8-bit values in distinct slots the swap is correct 65,536 times, while aliased to itself every value tested - 0, 1, 5, 127, 255 - comes out 0 with the original unrecoverable; it saves one register and buys a precondition FIG The XOR swap is old assembly-language folklore, from an era when a spare register was worth a precondition. It survives mostly as an interview question, which is a fair reflection of where it belongs. AVAN ran the failure case rather than describing it, because the aliasing bug is usually stated and rarely shown. The mechanism deserves one sentence: x ^ x = 0 is what lets the second step recover the first operand, and it is also what annihilates the value when both operands are the same location. The trick is not defeated by an edge case - it is defeated by its own load-bearing identity. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of HARD RESET · David Lee Wise (ROOT0), with AVAN


DUFF'S DEVICE

DUFF'S DEVICE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · THE PHOENIX ◆ .dlw.fold THE FOLD / RESPAWN / THE PHOENIX / DUFF'S DEVICE DUFF'S DEVICE a switch whose cases fall into a loop 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION An eight-way unrolled copy where the leftover elements are handled by jumping into the middle of the loop. The switch cases interleave with the body of a do-while, so a single construct does both the bulk work and the remainder — a shape C permits and almost nothing else does. LIT verified live and exhaustively. Every length from 0 to 200 copies exactly, and the loop runs ceil(n/8) times in every case — so the remainder costs no extra pass. At n = 0 it copies nothing and loops zero times. 2 HOW IT WAS WEAVED · AI + HUMAN Tom Duff published the device in 1983 while at Lucasfilm, alongside a note that has aged into the standard citation: he was not sure whether it was an argument for or against allowing the construct. It works because C’s switch is a computed goto into a statement, and the statement it lands in happens to be a loop body. AVAN (AI) would separate the two claims usually bundled together. That the remainder needs no second loop is structural and verified here across 201 lengths. That the device is fast is not tested and is largely obsolete: modern compilers unroll on their own, and a hand-rolled jump table can defeat branch prediction. What survives is the shape — one construct entered at eight points — which is worth seeing whether or not anyone should write it. 3 ONE DIMENSION Nine lengths, and where each enters the loop. 4 TWO DIMENSIONS · INTERACTIVE Set a length and watch the entry point move. longer ▶ shorter 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: one loop with eight doors. AVAN’s addition (the inverse-companion): the forward reading is “one construct handles bulk and remainder together.” The inverse is that the saving is one loop of source, and the cost is a shape nobody can read . The separate cleanup loop everyone writes instead is longer, obvious, and independently testable; Duff’s device is shorter and can only be understood by simulating it. Read backwards, this is a trade of reader time against writer time at a ratio that has moved steadily against it — the compiler now does the unrolling, and all that is left is the cleverness. pause spin LIT every length from 0 to 200 copies exactly and the loop runs ceil(n/8) times in every case, so the remainder costs no extra pass; at n = 0 it copies nothing and loops zero times FIG Tom Duff published the device in 1983 while at Lucasfilm, alongside a note that has aged into the standard citation: he was not sure whether it was an argument for or against allowing the construct. It works because C's switch is a computed goto into a statement, and the statement it lands in happens to be a loop body. AVAN separates the two claims usually bundled together: that the remainder needs no second loop is STRUCTURAL and verified here across 201 lengths, while that the device is FAST is not tested and is largely obsolete - modern compilers unroll on their own and a hand-rolled jump table can defeat branch prediction. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE PHOENIX · David Lee Wise (ROOT0), with AVAN


THE DE BRUIJN MULTIPLY

Multiply an isolated bit by a de Bruijn constant and the sequence shifts, so the top five bits of the product name the position of that bit.

THE DE BRUIJN MULTIPLY · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · EVENT HORIZON ◆ .dlw.fold THE FOLD / RESPAWN / EVENT HORIZON / THE DE BRUIJN MULTIPLY THE DE BRUIJN MULTIPLY a perfect hash for the lowest set bit 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION A de Bruijn sequence contains every window of a given width exactly once. Multiply an isolated bit by one and the sequence shifts — so the top five bits of the product name the position of that bit. One multiply, one shift, one table lookup, and no branches at all. LIT verified live. The 32 shifts of the constant 0x077CB531 produce 32 distinct five-bit windows — a perfect hash with no collisions. Every isolated bit resolves to its own index, 32/32 , and on values with several bits set it returns the lowest, checked exhaustively on 19,999 consecutive integers. 2 HOW IT WAS WEAVED · AI + HUMAN The de Bruijn sequence is Nicolaas de Bruijn’s, and this corpus already carries it as its own sphere — the shortest string holding every code . What is built here is the use : turning that uniqueness property into a branch-free perfect hash, a technique from the chess-programming world where scanning a 64-bit board for the lowest occupied square is the inner loop of everything. AVAN (AI) would keep the dependency visible. The trick works because every window appears exactly once — the sequence sphere states that property and this one spends it. And there is one input it cannot answer for: zero has no lowest set bit, and the expression returns a number anyway. That is a precondition on the caller, not a special case in the code, which is why it is easy to forget. 3 ONE DIMENSION Thirty-two shifts, thirty-two distinct windows. 4 TWO DIMENSIONS · INTERACTIVE Isolate a bit and watch the window it selects. higher bit ▶ lower several bits 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: one ring whose every window is unique. AVAN’s addition (the inverse-companion): the forward reading is “a perfect hash with no branches.” The inverse is that the constant is not derivable at the point of use . 0x077CB531 must be found by search, verified separately, and then trusted forever by every reader who cannot check it in their head — and a single wrong digit produces a table that still looks plausible and fails on a few inputs. Read backwards, branch-free code moves the difficulty out of the control flow and into a magic number nobody will re-derive , which is a real cost paid in a different currency. pause spin LIT the 32 shifts of the constant 0x077CB531 produce 32 distinct five-bit windows - a perfect hash with no collisions - and every isolated bit resolves to its own index at 32 of 32, while on values with several bits set it returns the lowest, checked exhaustively on 19,999 consecutive integers FIG The de Bruijn sequence is Nicolaas de Bruijn's, and this corpus already carries it as its own sphere - 'the shortest string holding every code'. What is built here is the USE: turning that uniqueness property into a branch-free perfect hash, a technique from the chess-programming world where scanning a 64-bit board for the lowest occupied square is the inner loop of everything. AVAN keeps the dependency visible - the trick works BECAUSE every window appears exactly once - and flags the one input it cannot answer for: zero has no lowest set bit, and the expression returns a number anyway. That is a precondition on the caller, not a special case in the code. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of EVENT HORIZON · David Lee Wise (ROOT0), with AVAN


THE CARRY-SAVE ADDER

Three numbers go in and two come out with no carry propagation. Each output bit depends only on the same column of the three inputs.

THE CARRY-SAVE ADDER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · ROLLBACK ◆ .dlw.fold THE FOLD / RESPAWN / ROLLBACK / THE CARRY-SAVE ADDER THE CARRY-SAVE ADDER three numbers in, two out, no carry chain 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Three numbers go in and two come out, with no carry propagation at all . Each output bit depends only on the same column of the three inputs, so the depth of the circuit is constant no matter how wide the numbers are. The carry still has to travel — but only once, at the very end. LIT verified live and exhaustively. Over all 262,144 triples of 6-bit values, sum + carry equals a + b + c every single time. Flipping one input bit moves only that column of the sum and the one above it in the carry — no ripple. Adding 33 numbers takes 8 carry-save stages and then exactly one real adder. 2 HOW IT WAS WEAVED · AI + HUMAN The carry-save adder is the reason large multipliers are fast. A multiplier produces many partial products that must all be summed, and doing it with ordinary adders would put a carry chain in the critical path for each one. Compressing three to two at constant depth, repeatedly, turns that into a logarithmic tree with a single carry-propagate adder at the bottom. AVAN (AI) verified the no-ripple claim directly rather than asserting it, because it is the whole reason the structure exists. Flipping bit k of an input changes bit k of the sum and at most bit k+1 of the carry, and nothing else — which is what “constant depth” means concretely. The identity sum + (carry << 1) = a + b + c is then just three-bit arithmetic done column by column. 3 ONE DIMENSION Three in, two out, column by column. 4 TWO DIMENSIONS · INTERACTIVE Flip a bit and watch how far the change travels. flip a bit ▶ reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a tree of compressions above one long chain. AVAN’s addition (the inverse-companion): the forward reading is “the carry chain is eliminated.” The inverse is that it is deferred, not eliminated, and the deferral is the entire trick . Every carry-save stage leaves the answer in a redundant two-number form that is not a number anyone can compare, print or branch on — it is only an answer once the final adder has run. Read backwards, this buys speed by keeping the result uninterpretable for as long as possible, and any operation that needs to look at the value early pays the whole cost back at once. pause spin LIT over all 262,144 triples of 6-bit values sum + carry equals a + b + c every single time, and flipping one input bit moves only that column of the sum and the one above it in the carry - no ripple; adding 33 numbers takes 8 carry-save stages and then exactly one real adder FIG The carry-save adder is the reason large multipliers are fast: a multiplier produces many partial products that must all be summed, and doing it with ordinary adders would put a carry chain in the critical path for each one. Compressing three to two at constant depth turns that into a logarithmic tree with a single carry-propagate adder at the bottom. AVAN verified the no-ripple claim directly rather than asserting it, because it is the whole reason the structure exists: flipping bit k of an input changes bit k of the sum and at most bit k+1 of the carry, and nothing else, which is what constant depth means concretely. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of ROLLBACK · David Lee Wise (ROOT0), with AVAN


THE MAGIC DIVIDE

Integer division by a constant is replaced by a multiply and a shift. It is exact arithmetic, not an approximation.

THE MAGIC DIVIDE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · GARBAGE COLLECTION ◆ .dlw.fold THE FOLD / RESPAWN / GARBAGE COLLECTION / THE MAGIC DIVIDE THE MAGIC DIVIDE dividing by multiplying 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Integer division by a constant is replaced by a multiply and a shift. For each divisor there is a pair — a magic number and a shift count — such that (n × m) >> s equals floor(n / d) for every n in range. It is exact arithmetic, not an approximation. LIT verified live and exhaustively over all 1,024 ten-bit inputs. Dividing by 3 becomes (n × 683) >> 11 ; by 5, (n × 205) >> 10 ; by 7, (n × 1171) >> 13 . All 5 divisors tried have a magic pair, and each is exact on every input. Powers of two need no multiply at all. 2 HOW IT WAS WEAVED · AI + HUMAN The technique is standard in compilers — the systematic treatment is in Hacker’s Delight , and every optimising compiler applies it silently whenever it sees a division by a literal. The reason is hardware: integer divide has long been the slowest common instruction, often by an order of magnitude over multiply. AVAN (AI) searched for the pairs rather than quoting them, and then verified each exhaustively over the full input range instead of on samples — because “exact” is a claim about every input and a spot check cannot make it. The honest limit is visible in the numbers: the magic constant for 7 is 1171 , wider than any divisor here, so the trick trades a slow instruction for a wider one, and is only a win where that trade is favourable. 3 ONE DIMENSION Five divisors, five magic pairs. 4 TWO DIMENSIONS · INTERACTIVE Pick a divisor and check it against real division. next divisor ▶ use a wrong shift 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a staircase reproduced by a straight line. AVAN’s addition (the inverse-companion): the forward reading is “division by a constant is really a multiplication.” The inverse is that the exactness is bounded by a range nobody writes down . A magic pair is proved correct for inputs up to some width, and the proof is invisible at the call site — widen the type, feed it a value the search never covered, and it is silently wrong by one on a handful of inputs rather than obviously broken. Read backwards, this converts a slow-but-total operation into a fast one with a domain restriction carried entirely in the compiler’s head , which is fine exactly as long as the compiler is the only thing writing it. pause spin LIT verified exhaustively over all 1,024 ten-bit inputs, dividing by 3 becomes (n x 683) >> 11, by 5 becomes (n x 205) >> 10 and by 7 becomes (n x 1171) >> 13; all 5 divisors tried have a magic pair and each is exact on every input, while powers of two need no multiply at all FIG The technique is standard in compilers - the systematic treatment is in Hacker's Delight, and every optimising compiler applies it silently whenever it sees a division by a literal. The reason is hardware: integer divide has long been the slowest common instruction, often by an order of magnitude over multiply. AVAN searched for the pairs rather than quoting them, and then verified each exhaustively over the full input range instead of on samples, because 'exact' is a claim about every input and a spot check cannot make it. The honest limit is visible in the numbers: the magic constant for 7 is 1171, wider than any divisor here. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GARBAGE COLLECTION · David Lee Wise (ROOT0), with AVAN


THE ZOBRIST HASH

One random key per piece and square. Moving a piece costs two xors, and un-moving it costs the same two, because XOR is its own inverse.

THE ZOBRIST HASH · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · SECOND WIND ◆ .dlw.fold THE FOLD / RESPAWN / SECOND WIND / THE ZOBRIST HASH THE ZOBRIST HASH undo by doing the same thing again 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION One random key per piece-and-square. A position’s hash is the exclusive-or of the keys present, so moving a piece costs two operations rather than a rescan of the board — and un -moving it costs the same two, because exclusive-or is its own inverse. There is no separate undo path to get wrong. LIT verified live. The incremental update reproduces a full recomputation exactly . Undoing restores the original hash bit for bit, and 500 random move-then-unmove pairs all return to the starting value. At 32-bit keys, over a billion positions, the probability of some collision is essentially 1 — which is where the risk lives, not in the trick. 2 HOW IT WAS WEAVED · AI + HUMAN Albert Zobrist published the scheme in 1970, for a Go program. It is now in essentially every chess engine, because the alternative — rehashing the board after each move in a search that makes and unmakes millions — puts the hash in the hot loop. AVAN (AI) would separate the exactness from the safety, since they are usually stated together. The incremental identity is exact : no approximation, no drift, verified against full recomputation and round-tripped 500 times. The collision risk is a separate matter entirely, governed only by key width, and at 32 bits it is not a risk but a certainty. A structure can be perfectly correct and still be the wrong size. 3 ONE DIMENSION A move, an unmove, and the hash returning. 4 TWO DIMENSIONS · INTERACTIVE Move pieces and walk back. move ▶ unmove reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a path that retraces itself exactly. AVAN’s addition (the inverse-companion): the forward reading is “undo is free because XOR is an involution.” The inverse is that a hash which forgets how it was reached cannot tell you that it is wrong . Two different positions colliding produce one value with no record of either, and the engine reads a stored evaluation for a board it has never seen. Read backwards, the property that makes undo free — that the hash depends only on the set of pieces, not the route — is exactly the property that makes a collision undetectable. pause spin LIT the incremental update reproduces a full recomputation exactly, undoing restores the original hash bit for bit, and 500 random move-then-unmove pairs all return to the starting value; at 32-bit keys over a billion positions the probability of some collision is essentially 1, which is where the risk lives rather than in the trick FIG Albert Zobrist published the scheme in 1970, for a Go program. It is now in essentially every chess engine, because the alternative - rehashing the board after each move in a search that makes and unmakes millions - puts the hash in the hot loop. AVAN separates the exactness from the safety, since they are usually stated together: the incremental identity is EXACT, verified against full recomputation and round-tripped 500 times, while the COLLISION risk is a separate matter governed only by key width. A structure can be perfectly correct and still be the wrong size. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SECOND WIND · David Lee Wise (ROOT0), with AVAN


THE TODD-COXETER

Give it generators, relations and a subgroup, and it fills a table until the table closes. The number of surviving rows is the index of the subgroup.

THE TODD-COXETER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · THE CONTINUE ◆ .dlw.fold THE FOLD / RESPAWN / THE CONTINUE / THE TODD-COXETER THE TODD-COXETER enumerate the cosets and the index falls out 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Give it generators, relations and a subgroup, and it fills in a table until the table closes on itself. The number of surviving rows is the index of the subgroup — so for the trivial subgroup it is the order of the group. A structural fact about an abstract group, produced by bookkeeping. LIT verified live. The symmetric group on three letters enumerates to 6 , the Klein four-group to 4 , and the two-element cyclic group to 2 . Run over a subgroup of order 2 instead of the trivial one, S₃ enumerates to 3 — which is 6/2, Lagrange’s theorem arriving as a row count rather than a proof. 2 HOW IT WAS WEAVED · AI + HUMAN John Todd and H.S.M. Coxeter published coset enumeration in 1936, as a hand procedure. It is one of the oldest algorithms in computational algebra and still the standard method — a table you fill in, where the difficulty is entirely in handling coincidences : discovering that two rows you had been treating as different are the same coset. AVAN (AI) got the coincidence handling wrong on the first attempt and the gates caught it. A flat rewrite of references gave S₃ as 8 and the Klein group as 6 — both too large, because merging two cosets can force further merges that a single pass never discovers. The fix is a union-find over cosets with a queue , so a coincidence can cascade. That is not an implementation detail; it is the whole algorithm, and the naive version fails quietly with plausible-looking numbers. 3 ONE DIMENSION Four enumerations, and what each row count means. 4 TWO DIMENSIONS · INTERACTIVE Change the presentation and watch the table close. next group ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a table closing into a finite ring. AVAN’s addition (the inverse-companion): the forward reading is “the table closes and gives you the index.” The inverse is that nothing tells you it will . A finitely presented group can be infinite, and then the enumeration runs forever, defining cosets and never closing — and the word problem for groups is undecidable, so no test can sort the two cases in advance. Read backwards, this is a procedure that answers correctly whenever it answers at all, which is semi-decidable : a running enumeration and a hung one are indistinguishable from outside, and the only honest report while it runs is that it is still running. pause spin LIT the symmetric group on three letters enumerates to 6, the Klein four-group to 4 and the two-element cyclic group to 2; run over a subgroup of order 2 instead of the trivial one, S3 enumerates to 3 - which is 6/2, Lagrange's theorem arriving as a row count rather than a proof FIG John Todd and H.S.M. Coxeter published coset enumeration in 1936, as a hand procedure. It is one of the oldest algorithms in computational algebra and still the standard method, with the difficulty entirely in handling COINCIDENCES - discovering that two rows treated as different are the same coset. AVAN got the coincidence handling wrong on the first attempt and the gates caught it: a flat rewrite of references gave S3 as 8 and the Klein group as 6, both too large, because merging two cosets can force further merges a single pass never discovers. The fix is a union-find with a QUEUE so a coincidence can cascade - and the naive version fails quietly with plausible-looking numbers. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CONTINUE · David Lee Wise (ROOT0), with AVAN


THE WHEEL FACTORISATION

A wheel of the first few primes skips every number they divide. The number of spokes per revolution is exactly Euler's totient of the circumference.

THE WHEEL FACTORISATION · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · RESPAWN · THE RESURRECT ◆ .dlw.fold THE FOLD / RESPAWN / THE RESURRECT / THE WHEEL FACTORISATION THE WHEEL FACTORISATION skip what cannot possibly be prime 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION A wheel of the first few primes skips every number they divide. Roll it and only the survivors need testing. The number of spokes per revolution turns out to be exactly Euler’s totient of the circumference — the sieve and the number-theoretic function are the same count. LIT verified live. A {2} wheel has circumference 2 and 1 spoke; {2,3} gives 6 and 2 ; {2,3,5} gives 30 and 8 ; {2,3,5,7} gives 210 and 48 . Every spoke count equals φ of the circumference, 4/4 . And the returns shrink: each new prime removes 16.7% , then 6.7% , then 3.8% , while the table grows from 2 entries to 210. 2 HOW IT WAS WEAVED · AI + HUMAN Wheel factorisation is the standard optimisation on top of trial division and the Sieve of Eratosthenes — the familiar “check 2, then only odd numbers” is the {2} wheel, and “6k ± 1” is the {2,3} wheel written out. AVAN (AI) checked the totient identity rather than assuming it, because it is the reason the wheel has a closed form at all: the spokes are exactly the residues coprime to the circumference, and counting those is what φ does. What that buys is a prediction — the next wheel, {2,3,5,7,11}, has circumference 2310 and φ = 480, so 20.8% survive for an eleven-fold table. The diminishing return is not an observation about these four; it is what φ(n)/n does as you multiply in more primes. 3 ONE DIMENSION Four wheels, and the totient beside each. 4 TWO DIMENSIONS · INTERACTIVE Add a prime to the wheel and watch the spokes thin. add a prime ▶ remove 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a wheel with most of its spokes removed. AVAN’s addition (the inverse-companion): the forward reading is “a bigger wheel skips more work.” The inverse is that the survivors are not primes and the wheel never claims they are . A {2,3,5,7} wheel passes 121, 143 and 169 straight through — every product of primes above 7 survives every wheel that can be built. Read backwards, the wheel removes only the cheapest composites, the ones a single division would have caught anyway, and leaves the entire hard part of the problem exactly where it was. pause spin LIT a {2} wheel has circumference 2 and 1 spoke, {2,3} gives 6 and 2, {2,3,5} gives 30 and 8, and {2,3,5,7} gives 210 and 48 - every spoke count equalling phi of the circumference, 4 of 4; and the returns shrink, each new prime removing 16.7%, then 6.7%, then 3.8%, while the table grows from 2 entries to 210 FIG Wheel factorisation is the standard optimisation on top of trial division and the Sieve of Eratosthenes - the familiar 'check 2, then only odd numbers' is the {2} wheel, and '6k plus or minus 1' is the {2,3} wheel written out. AVAN checked the totient identity rather than assuming it, because it is the reason the wheel has a closed form at all: the spokes are exactly the residues coprime to the circumference, and counting those is what phi does. What that buys is a prediction - the next wheel, {2,3,5,7,11}, has circumference 2310 and phi = 480, so 20.8% survive for an eleven-fold table. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE RESURRECT · David Lee Wise (ROOT0), with AVAN


THE DOUBLE DABBLE

Shift the number left into a register of decimal digits, and before each shift add 3 to any digit that has reached 5 or more. Nothing else.

THE DOUBLE DABBLE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · NULL ISLAND ◆ .dlw.fold THE FOLD / SPAWN / NULL ISLAND / THE DOUBLE DABBLE THE DOUBLE DABBLE binary to decimal with no division at all 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Converting binary to decimal without a single division. Shift the number left into a register of decimal digits, and before each shift add 3 to any digit that has reached 5 or more. Shifts, comparisons and additions — nothing else. The magic constant is not magic: it is the pre-correction for doubling. LIT verified live and exhaustively over all 4,096 twelve-bit values, every one converting exactly. And the add-3 is checked digit by digit: a digit of 5 doubles to 10, which is not a legal decimal digit, but (5+3)×2 = 16 — carry 1, digit 0, which is precisely right. The same holds for 6, 7, 8 and 9. 2 HOW IT WAS WEAVED · AI + HUMAN The double dabble , also called shift-and-add-3, is the standard way to drive a seven-segment display from a binary counter in hardware with no divider. It appears wherever a divide instruction is unavailable or unaffordable, which historically was most places. AVAN (AI) verified why the 3 works rather than only that it does, because the constant looks arbitrary and is not. A decimal digit d at or above 5 would double past 9. Adding 3 first gives 2(d+3) = 2d+6, and since a decimal carry is worth 16 in the packed representation but only 10 in value, the +6 is exactly the difference. The correction is not a fudge tuned to work — it is 16 minus 10 , halved. 3 ONE DIMENSION Why three, digit by digit. 4 TWO DIMENSIONS · INTERACTIVE Step the conversion one shift at a time. shift ▶ new value reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: bits marching out, digits filling up. AVAN’s addition (the inverse-companion): the forward reading is “no divider needed.” The inverse is that the divider was replaced by n iterations of a wide parallel comparison . Every bit of input costs a pass over every decimal digit, each with its own compare-and-add-3 — so the work did not vanish, it turned from one slow sequential instruction into a great deal of cheap simultaneous hardware. Read backwards, this is the standard trade of the whole discipline: area for latency , and it is only a win where you have the silicon and cannot afford the wait. pause spin LIT exhaustively correct over all 4,096 twelve-bit values, every one converting exactly; and the add-3 is checked digit by digit - a digit of 5 doubles to 10 which is not a legal decimal digit, but (5+3) times 2 is 16, carry 1 and digit 0, which is precisely right, and the same holds for 6, 7, 8 and 9 FIG The double dabble, also called shift-and-add-3, is the standard way to drive a seven-segment display from a binary counter in hardware with no divider. It appears wherever a divide instruction is unavailable or unaffordable, which historically was most places. AVAN verified WHY the 3 works rather than only that it does, because the constant looks arbitrary and is not: a decimal digit at or above 5 would double past 9, and adding 3 first gives 2(d+3) = 2d+6, where a decimal carry is worth 16 in the packed representation but only 10 in value - so the correction is 16 minus 10, halved. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of NULL ISLAND · David Lee Wise (ROOT0), with AVAN


THE NON-RESTORING DIVISION

Long division in hardware subtracts, and when the result goes negative it has to put it back. This one leaves it negative and adds on the next step instead.

THE NON-RESTORING DIVISION · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE CRON JOB ◆ .dlw.fold THE FOLD / GRIND / THE CRON JOB / THE NON-RESTORING DIVISION THE NON-RESTORING DIVISION do not undo the bad step, correct it later 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Long division in hardware subtracts, and when the result goes negative it has to put it back . Non-restoring division does not put it back — it leaves the remainder negative and adds on the next step instead of subtracting. Same answer, one fewer operation every time the subtraction was too big. LIT verified live. Across five divisions it gives the correct quotient and remainder every time and agrees with the restoring version exactly, while using 12 operations against 18 to 23 — 41 steps saved across the five. Exhaustively correct on 4,096 cases, and the remainder needs at most one final correction. 2 HOW IT WAS WEAVED · AI + HUMAN Non-restoring division is the classical hardware algorithm, and the insight is that restoring wastes work: adding the divisor back and then subtracting it again on the next cycle is the same as simply adding it once, shifted. The wasted add-then-subtract cancels. AVAN (AI) counted the operations rather than describing the saving, because “fewer operations” is exactly the sort of claim that turns out to be a wash. Restoring costs one op per bit plus one more per negative step; non-restoring costs exactly one per bit, always — 12 for a 12-bit dividend regardless of the numbers. The saving is not an average, it is the elimination of a data-dependent branch, which on hardware matters more than the count. 3 ONE DIMENSION Five divisions, two algorithms, one answer. 4 TWO DIMENSIONS · INTERACTIVE Step through, and watch the remainder go negative and stay there. step ▶ next case reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a path that crosses below zero and keeps going. AVAN’s addition (the inverse-companion): the forward reading is “do not undo the bad step.” The inverse is that the intermediate state is now meaningless . A restoring divider always holds a genuine partial remainder that could be inspected, interrupted or resumed; a non-restoring one spends most of its cycles holding a negative number that is not the remainder of anything. Read backwards, the speed comes from allowing the machine to be temporarily wrong in a controlled way , and everything that wanted to look at the register mid-flight has lost the ability to. pause spin LIT across five divisions it gives the correct quotient and remainder every time and agrees with the restoring version exactly, while using 12 operations against 18 to 23 - 41 steps saved across the five; exhaustively correct on 4,096 cases, and the remainder needs at most one final correction FIG Non-restoring division is the classical hardware algorithm, and the insight is that restoring wastes work: adding the divisor back and then subtracting it again on the next cycle is the same as simply adding it once, shifted, so the wasted add-then-subtract cancels. AVAN counted the operations rather than describing the saving, because 'fewer operations' is exactly the sort of claim that turns out to be a wash. Restoring costs one op per bit plus one more per negative step; non-restoring costs exactly one per bit, always - 12 for a 12-bit dividend regardless of the numbers. The saving is the elimination of a data-dependent branch, which on hardware matters more than the count. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CRON JOB · David Lee Wise (ROOT0), with AVAN


THE STICKY BIT

Rounding needs to know whether ANYTHING nonzero fell below the round bit. Not what - just whether. One OR of every discarded bit, and it never clears.

THE STICKY BIT · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · THE SANDBOX ◆ .dlw.fold THE FOLD / SPAWN / THE SANDBOX / THE STICKY BIT THE STICKY BIT one bit remembering everything thrown away 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Rounding needs to know whether anything nonzero fell below the round bit. Not what — just whether. One OR of every discarded bit, and it never clears. LIT verified live. A lone round bit gives sticky 0 , an exact tie. Any bit below it sets sticky, 3/3 . The furthest discarded bit sets it exactly as hard as the nearest, because position is thrown away and only presence survives — so all 1,024 ten-bit mantissas collapse to just 8 rounding states. 2 HOW IT WAS WEAVED · AI + HUMAN The guard/round/sticky arrangement is how IEEE 754 rounding is actually implemented: you cannot keep the discarded tail, so you keep one bit that says whether it was empty. AVAN (AI) measured the compression rather than describing it — 1,024 distinct mantissas reduce to 8 states, and those 8 are enough to decide round-to-nearest-even in every case. The sticky bit is a lossy summary that happens to be lossless for the only question being asked. My first test cases did not demonstrate this and one gate passed for the wrong reason; they were rebuilt around the actual round/sticky pairs. 3 ONE DIMENSION Five tails, and the two bits that survive them. 4 TWO DIMENSIONS · INTERACTIVE Set a tail and watch the rounding decision. next tail ▶ flip the last kept bit 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a long tail folding to one bit. AVAN’s addition (the inverse-companion): the forward reading is that one bit is enough. The inverse is that it is enough only for this question . The sticky bit answers “was anything discarded” and can never answer “how much” — so a chain of operations each rounding correctly can still drift, because each step forgets the size of what it dropped and remembers only that it dropped something. Read backwards, correct rounding at every step is not the same as a correct result, and the sticky bit is precisely the boundary between the two. pause spin LIT a lone round bit gives sticky 0, an exact tie; any bit below it sets sticky, 3 of 3; and the furthest discarded bit sets it exactly as hard as the nearest, because position is thrown away and only presence survives - so all 1,024 ten-bit mantissas collapse to just 8 rounding states FIG The guard/round/sticky arrangement is how IEEE 754 rounding is actually implemented: you cannot keep the discarded tail, so you keep one bit that says whether it was empty. AVAN measured the compression rather than describing it - 1,024 distinct mantissas reduce to 8 states, and those 8 are enough to decide round-to-nearest-even in every case. My first test cases did not demonstrate this and one gate passed for the wrong reason; they were rebuilt around the actual round/sticky pairs. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE SANDBOX · David Lee Wise (ROOT0), with AVAN


THE SUBNORMAL

Without them the gap between zero and the smallest normal is vastly larger than the gap between neighbouring normals - so two different numbers can subtract to exactly zero.

THE SUBNORMAL · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · FIRST LIGHT ◆ .dlw.fold THE FOLD / SPAWN / FIRST LIGHT / THE SUBNORMAL THE SUBNORMAL the numbers that buy you a smooth zero 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Without them the gap between zero and the smallest normal is vastly larger than the gap between neighbouring normals — so two different numbers can subtract to exactly zero. LIT verified live. The smallest subnormal is 2 -1074 and the smallest normal is 2 52 times larger. With subnormals, two values one step apart subtract to a nonzero result, so x == y and x - y == 0 agree. Under flush-to-zero the same subtraction gives exactly 0 for two values that differ — a resolution difference of 4.5 × 10 15 near zero. 2 HOW IT WAS WEAVED · AI + HUMAN Gradual underflow was one of the hardest-fought parts of IEEE 754, argued for by William Kahan against significant hardware opposition, because subnormals are awkward and slow to implement. AVAN (AI) measured the property they buy rather than the numbers themselves: without them, “a equals b” and “a minus b is zero” stop being the same test, and every algorithm that checks equality by subtracting silently acquires a false positive near zero. 3 ONE DIMENSION Where the number line goes thin. 4 TWO DIMENSIONS · INTERACTIVE Turn flush-to-zero on and watch two numbers merge. flush-to-zero ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a lattice that keeps its spacing to the end. AVAN’s addition (the inverse-companion): the forward reading is that subnormals keep the number line smooth. The inverse is that they are the slowest values in the machine . On much real hardware a subnormal operand traps to microcode and costs a hundred times a normal one, so code that drifts into them does not fail — it becomes mysteriously slow, in a way no profiler attributes to arithmetic. Read backwards, the smoothness is paid for in a performance cliff placed exactly where the values get small, which is where iterative methods spend their final steps. pause spin LIT the smallest subnormal is 2^-1074 and the smallest normal is 2^52 times larger; with subnormals two values one step apart subtract to a nonzero result so that x equals y and x minus y equals zero agree, while under flush-to-zero the same subtraction gives exactly 0 for two values that differ - a resolution difference of 4.5e15 near zero FIG Gradual underflow was one of the hardest-fought parts of IEEE 754, argued for by William Kahan against significant hardware opposition, because subnormals are awkward and slow to implement. AVAN measured the property they buy rather than the numbers themselves: without them, 'a equals b' and 'a minus b is zero' stop being the same test, and every algorithm that checks equality by subtracting silently acquires a false positive near zero. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of FIRST LIGHT · David Lee Wise (ROOT0), with AVAN


THE UNIT IN LAST PLACE

The distance to the next representable number is not a constant. It doubles at every power of two, so precision is a function of where you are standing.

THE UNIT IN LAST PLACE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · THE TOOLCHAIN ◆ .dlw.fold THE FOLD / SPAWN / THE TOOLCHAIN / THE UNIT IN LAST PLACE THE UNIT IN LAST PLACE the ruler changes length as you walk 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION The distance to the next representable number is not a constant. It doubles at every power of two, so precision is a function of where you are standing . LIT verified live. At 1 the ulp is 2 -52 and it doubles at every octave, so by 10 16 the ulp exceeds 1 and 1e16 + 1 === 1e16 exactly — while 1e15 + 1 still moves. And 2 53 is the last integer whose every predecessor is also representable. 2 HOW IT WAS WEAVED · AI + HUMAN An ulp is the unit in the last place: the gap between a float and its neighbour. It is the natural unit for error in floating point, and the reason “accurate to six decimal places” is a claim that needs a magnitude attached. AVAN (AI) measured the ruler at seven magnitudes rather than quoting the exponent rule, because the consequence is what matters: there is a specific decade where adding 1 stops changing a number, and it sits closer to everyday values than most people expect. 3 ONE DIMENSION One ulp, measured at seven magnitudes. 4 TWO DIMENSIONS · INTERACTIVE Walk up the number line and watch the step grow. bigger ▶ smaller 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a ruler that stretches as it travels. AVAN’s addition (the inverse-companion): the forward reading is that precision degrades with magnitude. The inverse is that relative precision never degrades at all . The ulp grows exactly in step with the value, so the number of significant digits is constant everywhere — what changes is the absolute gap, and only code that mixes magnitudes ever notices. Read backwards, floating point is not losing accuracy as numbers grow; it is holding relative accuracy fixed, and the failures come from summing quantities that never belonged on the same scale. pause spin LIT at 1 the ulp is 2^-52 and it doubles at every octave, so by 1e16 the ulp exceeds 1 and 1e16 plus 1 equals 1e16 exactly, while 1e15 plus 1 still moves - and 2^53 is the last integer whose every predecessor is also representable FIG An ulp is the unit in the last place: the gap between a float and its neighbour. It is the natural unit for error in floating point, and the reason 'accurate to six decimal places' is a claim that needs a magnitude attached. AVAN measured the ruler at seven magnitudes rather than quoting the exponent rule, because the consequence is what matters: there is a specific decade where adding 1 stops changing a number, and it sits closer to everyday values than most people expect. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE TOOLCHAIN · David Lee Wise (ROOT0), with AVAN


THE ROUND TO ODD

Rounding twice through an intermediate width can land further from the truth than rounding once. This mode makes the double rounding agree with the single one.

THE ROUND TO ODD · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · WARM CACHE ◆ .dlw.fold THE FOLD / GRIND / WARM CACHE / THE ROUND TO ODD THE ROUND TO ODD a rounding mode that exists to be rounded again 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Rounding twice through an intermediate width can land further from the truth than rounding once. This mode makes the double rounding agree with the single one — by deliberately producing a value that ends in 1. LIT verified live across 4,096 values. Double rounding through round-half-even disagrees with single rounding on 128 of them — about 3%. Double rounding through round-to-odd disagrees on 0 . It works because round-to-odd never leaves an exact tie for the next step to mishandle, verified at 0 ties produced. 2 HOW IT WAS WEAVED · AI + HUMAN Round-to-odd is not a mode anyone wants a final answer in. It exists so an intermediate result can be rounded again safely, which matters wherever a wide accumulator feeds a narrow output. AVAN (AI) measured both paths over the full grid rather than constructing one bad example, because the interesting figure is how often naive double rounding goes wrong: 128 of 4,096 , frequent enough to matter and rare enough to survive testing. 3 ONE DIMENSION Four thousand values, two paths, one disagreement count. 4 TWO DIMENSIONS · INTERACTIVE Find a value where rounding twice differs from rounding once. next bad case ▶ switch mode 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object: a value pushed off the fence on purpose. AVAN’s addition (the inverse-companion): the forward reading is that round-to-odd makes double rounding safe. The inverse is that it works by being deliberately wrong at every intermediate step . The odd-forced value is further from the true result than round-to-nearest would have been — the mode buys a correct final answer by guaranteeing an incorrect middle one. Read backwards, this is only sound while nobody looks at the intermediate, and any system that logs, checkpoints or debugs the wide value is reading a number designed not to be read. pause spin LIT across 4,096 values, double rounding through round-half-even disagrees with single rounding on 128 of them - about 3% - while double rounding through round-to-odd disagrees on 0, because round-to-odd never leaves an exact tie for the next step to mishandle, verified at 0 ties produced FIG Round-to-odd is not a mode anyone wants a final answer in - it deliberately produces a value ending in 1. It exists so that an intermediate result can be rounded again safely, which matters wherever a wide accumulator feeds a narrow output. AVAN measured both paths over the full grid rather than constructing one bad example, because the interesting figure is how OFTEN naive double rounding goes wrong: 128 of 4,096, frequent enough to matter and rare enough to survive testing. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of WARM CACHE · David Lee Wise (ROOT0), with AVAN


THE CATASTROPHIC CANCELLATION

THE CATASTROPHIC CANCELLATION · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE GRINDSTONE ◆ .dlw.fold THE FOLD / GRIND / THE GRINDSTONE / THE CATASTROPHIC CANCELLATION THE CATASTROPHIC CANCELLATION the error was there before the subtraction 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Subtracting near-equal numbers does not create error. It reveals error already present, by removing the leading digits that were hiding it. LIT verified live. solving x² + 10 8 x + 1 = 0 with the naive quadratic formula gives the small root with a relative error of 2.55 × 10 -1 , while the algebraically identical stable form gives it to machine precision at 0 . And b×b is exact here at 10 16 — so the information was destroyed by the square root long before the subtraction that exposed it. 2 HOW IT WAS WEAVED · AI + HUMAN The stable quadratic formula is standard numerical analysis and the example is the classic one. AVAN (AI) checked where the error enters rather than only that it appears: b×b is exactly representable, the discriminant differs from it by 4, and the square root of that difference rounds to a value indistinguishable from b. By the time the subtraction happens the operands are already equal to working precision — the cancellation reports that fact rather than causing it. 3 ONE DIMENSION Two algebraically identical formulas, one accurate. 4 TWO DIMENSIONS · INTERACTIVE Grow the coefficient and watch the naive root collapse. bigger b ▶ smaller 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that cancellation reveals rather than creates. The inverse is that this makes it undetectable at the point it matters . If the subtraction merely exposes existing error then no test on the subtraction can find the problem — the operands look fine, the operation is exact, and the result is wrong. Read backwards, the failure lives in an earlier step that appeared to succeed, which is why numerical bugs are diagnosed by reformulating the algebra rather than by instrumenting the code. pause spin LIT solving x squared plus 1e8 x plus 1 with the naive quadratic formula gives the small root with a relative error of 2.55e-1, while the algebraically identical stable form gives it to machine precision at 0; and b times b is EXACT here at 1e16, so the information was destroyed by the square root long before the subtraction that exposed it FIG The stable quadratic formula is standard numerical analysis and the example is the classic one. AVAN checked WHERE the error enters rather than only that it appears: b*b is exactly representable, the discriminant differs from it by 4, and the square root of that difference rounds to a value indistinguishable from b. By the time the subtraction happens the operands are already equal to working precision - the cancellation REPORTS that fact rather than causing it. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GRINDSTONE · David Lee Wise (ROOT0), with AVAN


THE BERGER CODE

THE BERGER CODE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE GATEKEEPER ◆ .dlw.fold THE FOLD / BOSS / THE GATEKEEPER / THE BERGER CODE THE BERGER CODE count the zeros and every one-way fault shows 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Append the count of zeros in binary. A fault that pushes every affected bit the same direction cannot preserve that count, however many bits it touches. LIT verified live. across an eight-bit word every one of 240 possible 1→0 corruptions is caught and every one of 240 possible 0→1 corruptions is caught, with no limit on how many bits are affected — but all 16 mixed-direction double faults tested go undetected , because one flip each way leaves the zero count unchanged. 2 HOW IT WAS WEAVED · AI + HUMAN Berger codes are the optimal systematic all-unidirectional-error-detecting code, from J.M. Berger in 1961. They matter where faults have a physical direction — a stuck-at line, a failing driver, an optical link losing power — because such faults corrupt many bits at once but always the same way. AVAN (AI) ran both directions exhaustively and the mixed case, because a code that catches unbounded errors in one direction and misses a two-bit error in another is only useful if you know which world you are in. 3 ONE DIMENSION Every one-way fault, and the one that slips through. 4 TWO DIMENSIONS · INTERACTIVE Corrupt the word and see whether the count notices. flip 1 to 0 ▶ flip 0 to 1 mixed pair reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that it catches any number of one-way errors. The inverse is that the guarantee is about the fault model, not about the code . Berger's completeness holds exactly as long as the physical failure really is unidirectional, and nothing in the codeword can check that assumption — a single mixed pair defeats it entirely. Read backwards, this is a code whose strength is borrowed from a claim about hardware, and it is worth precisely what that claim is worth. pause spin LIT across an eight-bit word every one of 240 possible 1-to-0 corruptions is caught and every one of 240 possible 0-to-1 corruptions is caught, with no limit on how many bits are affected - but all 16 mixed-direction double faults tested go UNDETECTED, because one flip each way leaves the zero count unchanged FIG Berger codes are the optimal systematic all-unidirectional-error-detecting code, from J.M. Berger in 1961. They matter where faults have a physical direction - a stuck-at line, a failing driver, an optical link losing power - because such faults corrupt many bits at once but always the same way. AVAN ran both directions exhaustively AND the mixed case, because a code that catches unbounded errors in one direction and misses a two-bit error in another is only useful if you know which world you are in. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GATEKEEPER · David Lee Wise (ROOT0), with AVAN


THE CARRY LOOKAHEAD

Each bit either generates a carry, or propagates one it receives. Written that way the carries unroll into a formula with no chain in it.

THE CARRY LOOKAHEAD · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · THE RAID ◆ .dlw.fold THE FOLD / BOSS / THE RAID / THE CARRY LOOKAHEAD THE CARRY LOOKAHEAD generate and propagate, computed all at once 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Each bit either generates a carry or propagates one it receives. Written that way, the carries unroll into a formula with no chain in it. LIT verified live. the lookahead adder agrees with a ripple adder on all 65,536 byte pairs; and the depth is logarithmic rather than linear — 4 against 8 at a byte, 7 against 64 at a word, roughly nine times shallower — though the widest gate then needs 16 inputs, which is why real adders group in fours. 2 HOW IT WAS WEAVED · AI + HUMAN Carry-lookahead is the foundational trick of fast arithmetic hardware, and the generate/propagate formulation is what makes the parallel prefix adders — Kogge-Stone, Brent-Kung, Sklansky — possible at all. AVAN (AI) verified the equivalence exhaustively rather than trusting the algebra, and reported the fan-in alongside the depth, because the depth figure alone makes the technique look free. It is not: the unrolled formula for bit k has k+1 terms, and gate delay grows with input count. 3 ONE DIMENSION Depth against width, ripple beside lookahead. 4 TWO DIMENSIONS · INTERACTIVE Watch the carry arrive everywhere at once. wider ▶ narrower 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that lookahead removes the carry chain. The inverse is that it converts a long thin problem into a short fat one , and fat has its own limit. The widest term at 64 bits would need a 64-input gate, which no technology builds — so real designs cut the formula into groups and rebuild a chain between them, arriving back at a shallow ripple. Read backwards, the logarithmic depth is an idealisation that survives only until fan-in is priced. pause spin LIT the lookahead adder agrees with a ripple adder on all 65,536 byte pairs; and the depth is logarithmic rather than linear - 4 against 8 at a byte, 7 against 64 at a word, roughly nine times shallower - though the widest gate then needs 16 inputs, which is why real adders group in fours FIG Carry-lookahead is the foundational trick of fast arithmetic hardware, and the generate/propagate formulation is what makes the parallel prefix adders - Kogge-Stone, Brent-Kung, Sklansky - possible at all. AVAN verified the equivalence exhaustively rather than trusting the algebra, and reported the FAN-IN alongside the depth, because the depth figure alone makes the technique look free. It is not: the unrolled formula for bit k has k+1 terms, and gate delay grows with input count. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE RAID · David Lee Wise (ROOT0), with AVAN


THE CONDITIONAL SUM

Do not wait for the carry. Compute the high half twice - once assuming a carry arrives, once assuming it does not - and select when the truth turns up.

THE CONDITIONAL SUM · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · BOSS · SUDDEN DEATH ◆ .dlw.fold THE FOLD / BOSS / SUDDEN DEATH / THE CONDITIONAL SUM THE CONDITIONAL SUM compute both answers, throw one away 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Do not wait for the carry. Compute the high half twice — once assuming a carry arrives, once assuming it does not — and select when the truth turns up. LIT verified live. carry-select agrees with a plain adder on all 65,536 byte pairs; splitting an 8-bit add at 4 drops latency from 8 to 5 while raising the adder count from 1 to 3 ; and across every split from 2 to 6 the latency is the max of the two halves plus one, so the slower half sets the clock and the best equal split is at 4 . 2 HOW IT WAS WEAVED · AI + HUMAN Carry-select and conditional-sum adders are the standard way to spend area on latency, and they appear in essentially every commercial ALU. AVAN (AI) measured the split rather than assuming the middle is best, because the optimum is not obvious: latency is governed by the maximum of the two halves, so an unequal split only pays when the halves start at different times — which is exactly what happens in a multi-stage carry-select chain. 3 ONE DIMENSION Every split point, and the latency it buys. 4 TWO DIMENSIONS · INTERACTIVE Choose a split and watch the unused half get discarded. move the split ▶ reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that speculating both ways removes the wait. The inverse is that half the hardware computes a result that is thrown away, every single cycle . That work is not wasted occasionally when a prediction misses — it is wasted always, by construction, and it burns power on every addition the machine performs. Read backwards, this is the cleanest example of a trade the field makes constantly: energy spent unconditionally to remove a delay that only sometimes mattered. pause spin LIT carry-select agrees with a plain adder on all 65,536 byte pairs; splitting an 8-bit add at 4 drops latency from 8 to 5 while raising the adder count from 1 to 3; and across every split from 2 to 6 the latency is the max of the two halves plus one, so the slower half sets the clock and the best equal split is at 4 FIG Carry-select and conditional-sum adders are the standard way to spend area on latency, and they appear in essentially every commercial ALU. AVAN measured the split rather than assuming the middle is best, because the optimum is not obvious: latency is governed by the MAXIMUM of the two halves, so an unequal split only pays when the halves start at different times - which is exactly what happens in a multi-stage carry-select chain. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of SUDDEN DEATH · David Lee Wise (ROOT0), with AVAN


THE BARREL SHIFTER

THE BARREL SHIFTER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE MAINFRAME ◆ .dlw.fold THE FOLD / GRIND / THE MAINFRAME / THE BARREL SHIFTER THE BARREL SHIFTER any distance in log n stages, no loop 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION A shift by k is a cascade of fixed shifts by powers of two, each switched on by one bit of k. No iteration, no variable latency. LIT verified live. every value and distance matches a direct shift across all 2,048 combinations at eight bits; the stage count is log₂ of the width — 3, 4, 5, 6 for widths 8 through 64 — and the latency is identical for a shift by 0 and a shift by 7, so there is no data-dependent timing at all . 2 HOW IT WAS WEAVED · AI + HUMAN The barrel shifter is why a variable shift costs the same as a fixed one on modern hardware, and why bit-manipulation code can be written without worrying about the shift amount. AVAN (AI) verified the constant-latency property specifically, because it is the part with a security consequence: a shifter whose timing depended on k would leak k, and cryptographic code shifts by secret amounts. 3 ONE DIMENSION Log-many stages, each one a power of two. 4 TWO DIMENSIONS · INTERACTIVE Set a distance and watch which stages switch on. shift more ▶ less 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that constant latency removes the timing channel. The inverse is that it moves the cost into area and power, where it is still observable . Every stage is wired whether or not it is enabled, and the enabled ones switch — so the energy drawn still depends on k even though the time does not. Read backwards, making an operation constant-time closes one side channel and leaves the power trace wide open, which is why hardened implementations worry about both. pause spin LIT every value and distance matches a direct shift across all 2,048 combinations at eight bits; the stage count is log2 of the width - 3, 4, 5 and 6 for widths 8 through 64 - and the latency is identical for a shift by 0 and a shift by 7, so there is no data-dependent timing at all FIG The barrel shifter is why a variable shift costs the same as a fixed one on modern hardware, and why bit-manipulation code can be written without worrying about the shift amount. AVAN verified the constant-latency property specifically, because it is the part with a security consequence: a shifter whose timing depended on k would leak k, and cryptographic code shifts by secret amounts. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE MAINFRAME · David Lee Wise (ROOT0), with AVAN


THE PRIORITY ENCODER

THE PRIORITY ENCODER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GLITCH · OFF BY ONE ◆ .dlw.fold THE FOLD / GLITCH / OFF BY ONE / THE PRIORITY ENCODER THE PRIORITY ENCODER the highest one wins, and someone must say if none do 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION n inputs collapse to log n outputs naming the highest set bit. But index 0 is a real answer, so a separate line has to declare whether the answer means anything. LIT verified live. the highest set bit wins when several are set, and an empty input reports index 0 — which is also the answer for an input of 1 , so the index alone is genuinely ambiguous and the VALID line is what distinguishes them; exhaustively correct on all 256 eight-bit inputs, compressing 8 inputs to 3 outputs plus one flag. 2 HOW IT WAS WEAVED · AI + HUMAN Priority encoders sit in every interrupt controller, every allocator and every floating-point normaliser. The valid line is the interesting part: it is the standard hardware answer to a problem software solves badly with sentinel values, and it exists because there is no spare index to mean “nothing”. AVAN (AI) checked the ambiguity directly by comparing the encoding of 0 with the encoding of 1, since that single collision is the entire reason the extra wire is there. 3 ONE DIMENSION Eight inputs, three outputs, and one flag. 4 TWO DIMENSIONS · INTERACTIVE Set bits and watch which one claims the output. toggle a bit ▶ clear all 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that a valid line resolves the ambiguity. The inverse is that every consumer must remember to read it . The encoder is honest — it publishes both the index and whether the index means anything — but the wire is separate, easy to leave unconnected, and its absence produces a plausible answer rather than an error. Read backwards, an out-of-band validity signal is the hardware version of returning a value and an error code, and it fails the same way: silently, whenever someone checks only the first. pause spin LIT the highest set bit wins when several are set, and an empty input reports index 0 - which is also the answer for an input of 1, so the index alone is genuinely ambiguous and the VALID line is what distinguishes them; exhaustively correct on all 256 eight-bit inputs, compressing 8 inputs to 3 outputs plus one flag FIG Priority encoders sit in every interrupt controller, every allocator and every floating-point normaliser. The valid line is the interesting part: it is the standard hardware answer to a problem software solves badly with sentinel values, and it exists because there is no spare index to mean 'nothing'. AVAN checked the ambiguity directly by comparing the encoding of 0 with the encoding of 1, since that single collision is the entire reason the extra wire is there. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of OFF BY ONE · David Lee Wise (ROOT0), with AVAN


THE ONE HOT

An N-state machine fits in ceil(log2 N) bits, or in N bits with exactly one high. The second is profligate - and the only one of the two that can tell you it has been damaged.

THE ONE HOT · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · SPAWN · FIRST LIGHT ◆ .dlw.fold THE FOLD / SPAWN / FIRST LIGHT / THE ONE HOT THE ONE HOT exactly one wire high, and that is the whole code 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION An N -state machine can be encoded in ceil(log₂N) bits — or in N bits with exactly one of them high. The second choice looks profligate. It is also the only one of the two that can tell you it has been damaged. LIT verified live. of the 256 eight-bit patterns exactly 8 are legal one-hot codewords. All 28 pairs of codewords sit at Hamming distance exactly 2 , so every one of the 64 single-bit flips of a codeword lands outside the code and is caught — 64 of 64 . The dense 3-bit binary encoding of the same 8 states catches 0 of its 24 flips, because every pattern three bits can produce is already a legal state. 2 HOW IT WAS WEAVED · AI + HUMAN One-hot encoding is standard practice in FSM synthesis, and the distance-2 property is elementary coding theory. AVAN (AI) did not argue it — it enumerated it. All 256 patterns classified, all 28 codeword pairs measured, all 64 one-hot flips and all 24 binary flips tried. The interesting number is the one on the dense side: zero . Binary encoding is not merely worse at detection; it has no detection, and cannot acquire any, because it has no unused code space to fall into. 3 ONE DIMENSION All 256 patterns. Eight are words; 248 are not. 4 TWO DIMENSIONS · INTERACTIVE Flip a bit and watch which encoding notices. flip a bit ▶ reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that one-hot buys error detection for free. The inverse is that it is not free and it is not detection — it is the waste, read out loud . The code catches a flip only because 248 of the 256 patterns are unused; the detecting power is exactly the size of the hole. Read backwards, a dense encoding is not careless, it is full : it has no room left in which to be wrong. Every error-detecting code is a decision to leave the space unoccupied, and the strength of the detection is a measure of what you declined to say. pause spin LIT of the 256 eight-bit patterns exactly 8 are legal one-hot codewords; all 28 pairs sit at Hamming distance exactly 2, so all 64 single-bit flips of a codeword land outside the code and are caught - 64 of 64 - while the dense 3-bit binary encoding of the same 8 states catches 0 of its 24, because every pattern three bits can produce is already a legal state FIG One-hot encoding is standard FSM synthesis practice and the distance-2 property is elementary coding theory. AVAN enumerated rather than argued: all 256 patterns classified, all 28 codeword pairs measured, all 64 one-hot and 24 binary flips tried. The interesting number is on the dense side - zero. Binary encoding has no detection and cannot acquire any, because it has no unused code space to fall into. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of FIRST LIGHT · David Lee Wise (ROOT0), with AVAN


THE SYSTOLIC ARRAY

Kung and Leiserson, 1978: data enters at the edge of a mesh and every cell it passes uses it once more. The arithmetic does not get cheaper. The memory does.

THE SYSTOLIC ARRAY · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · THE GRINDSTONE ◆ .dlw.fold THE FOLD / GRIND / THE GRINDSTONE / THE SYSTOLIC ARRAY THE SYSTOLIC ARRAY stop fetching operands and start pumping them 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Kung and Leiserson’s 1978 idea: stop fetching operands and start pumping them. Data enters at the edge of a mesh and every cell it passes through uses it once more. The arithmetic does not get cheaper. The memory does. LIT verified live. a 16×16 output-stationary array multiplying two 16×16 matrices reproduces all 256 of 256 entries of the naive triple loop, and performs 4,096 multiply-accumulates — exactly the same count as the naive loop. What changes is the edge: 8,192 operand reads become 512 , a factor of 16 , which is N . The wavefront finishes in 46 cycles, matching 3N−2 exactly. 2 HOW IT WAS WEAVED · AI + HUMAN H. T. Kung and Charles Leiserson published systolic arrays in 1978; the reuse factor N and the 3N−2 wavefront latency are the standard results, and Google’s TPU is the best-known modern instance. AVAN (AI) ran the array rather than quoting it, and instrumented both sides. The number worth having is 4,096 = 4,096 : the systolic array does not do less arithmetic. Every claim of the form ‘the accelerator is 16× faster’ here is a claim about reads , and the check that proves it is the one showing the MAC counts are identical. 3 ONE DIMENSION Same arithmetic. One sixteenth of the memory traffic. 4 TWO DIMENSIONS · INTERACTIVE Step the wavefront through the mesh. step ▶ run to end reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that perfect reuse makes the array fast. The inverse is that the reuse and the rigidity are the same property . Data flows in lockstep because the wiring is the schedule; there is no instruction stream to say otherwise. So the array that hits 100% utilisation on a 16×16 matmul drops to 9.8% — 25 cells of 256 — on a 5×5 one, and the idle cells cannot be told to do anything else. Read backwards, a systolic array is not a fast processor; it is a fast shape , and the arithmetic must be bent to fit it. pause spin LIT a 16x16 output-stationary array reproduces all 256 of 256 entries of the naive triple loop and performs 4,096 multiply-accumulates - exactly the same count as the naive loop; what changes is the edge, where 8,192 operand reads become 512, a factor of 16 which is N, and the wavefront finishes in 46 cycles, matching 3N-2 exactly FIG H. T. Kung and Charles Leiserson published systolic arrays in 1978; the reuse factor N and the 3N-2 wavefront latency are the standard results, and Google's TPU is the best-known modern instance. AVAN ran the array and instrumented both sides. The number worth having is 4,096 = 4,096: the array does not do less arithmetic. Every '16x faster' claim here is a claim about reads, and the check that proves it is the one showing the MAC counts are identical. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GRINDSTONE · David Lee Wise (ROOT0), with AVAN


THE VICTIM CACHE

Jouppi, 1990: keep a tiny fully-associative buffer beside a direct-mapped cache and catch the lines it throws away. Four extra entries, and it fixes a failure more associativity does not.

THE VICTIM CACHE · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · GRIND · WARM CACHE ◆ .dlw.fold THE FOLD / GRIND / WARM CACHE / THE VICTIM CACHE THE VICTIM CACHE four entries that fix what doubling the ways does not 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Norman Jouppi, 1990: keep a tiny fully-associative buffer beside a direct-mapped cache and catch the lines it throws away. Four extra entries. It fixes a failure that doubling the associativity does not. LIT verified live. on a trace of 999 accesses cycling three addresses that all map to the same set, the direct-mapped cache misses 999 of 999 . A 2-way set-associative cache of the same total capacity also misses 999 of 999 — three lines will not fit in two ways, no matter how the ways are arranged. The direct-mapped cache with a 4-entry victim buffer misses 3 : the compulsory ones. The victim buffer supplied 996 hits. On a purely streaming trace of the same length it supplies 0 . 2 HOW IT WAS WEAVED · AI + HUMAN Norman Jouppi’s 1990 ISCA paper introduced the victim cache; the mechanism and the motivation are his. AVAN (AI) added the control that makes the claim mean something. It is easy to show a victim cache beating a direct-mapped cache — that only proves you added capacity. So the 2-way comparison was run at equal total lines , and it fails just as completely: 999 of 999 . The victim buffer is not extra associativity spread thin, it is full associativity concentrated exactly where the conflicts land. The streaming control ( 0 victim hits) is the other half: on a trace with no conflicts the whole structure is dead silicon. 3 ONE DIMENSION Three addresses, one set. Two ways is not enough. 4 TWO DIMENSIONS · INTERACTIVE Step the trace and watch the victim buffer catch the evictions. step ▶ run 30 reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that four entries fix a pathology eight would not. The inverse is that the fix is a bet on clustering, and the bet is invisible until it loses . The victim buffer works because conflict misses are rare but bunched — a handful of addresses colliding again and again. Run a trace with no conflicts and it returns 0 hits while still burning area, power and a lookup on every miss. Read backwards, this is not a cache improvement; it is a wager about the shape of someone else’s access pattern, placed at design time, settled years later in silicon that cannot be changed. pause spin LIT on 999 accesses cycling three addresses that map to one set, the direct-mapped cache misses 999 of 999 and a 2-way cache of the SAME total capacity also misses 999 of 999 - three lines will not fit in two ways however they are arranged - while direct-mapped plus a 4-entry victim buffer misses 3, the compulsory ones, with 996 hits supplied by the buffer; on a purely streaming trace of the same length that same buffer supplies 0 FIG Norman Jouppi's 1990 ISCA paper introduced the victim cache. AVAN added the control that makes the claim mean anything: beating a direct-mapped cache only proves you added capacity, so the 2-way comparison was run at equal total lines and fails just as completely, 999 of 999. The streaming control - 0 victim hits - is the other half: on a trace with no conflicts the whole structure is dead silicon. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of WARM CACHE · David Lee Wise (ROOT0), with AVAN


THE BRANCH TARGET BUFFER

Two questions get asked at one instruction. Will it branch? and where to? The first has two answers and is easy. The second has as many answers as there are addresses.

THE BRANCH TARGET BUFFER · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · THE SHORTCUT ◆ .dlw.fold THE FOLD / CHEAT / THE SHORTCUT / THE BRANCH TARGET BUFFER THE BRANCH TARGET BUFFER 99.8% accurate and wrong every single time 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Two different questions get asked at the same instruction. Will it branch? and where to? The first has two answers and is easy. The second has as many answers as there are addresses, and is not. LIT verified live. on 1,000 executions of one indirect call that cycles through four targets, the direction predictor is right 998 of 1,000 — the branch is always taken and it learns that in two tries. Over the very same 1,000 executions, a one-entry BTB keyed on the program counter predicts the target correctly 0 times . Same instruction, same run: 99.8% and 0% . Give the BTB the previous target as its index and it reaches 995 ; make the targets random instead of cyclic and it falls to 254 . 2 HOW IT WAS WEAVED · AI + HUMAN Branch target buffers and the direction/target split are textbook microarchitecture; indirect-branch predictors keyed on target history are the standard fix. AVAN (AI) built the case where the two numbers separate as far as they can go, and instrumented both predictors on one instruction stream so the comparison is not between benchmarks. The result that matters is not that the BTB fails, it is that a headline of ‘ 99.8% branch prediction accuracy’ is true while the branch is mispredicted every single time. 3 ONE DIMENSION One branch. Two predictions. Only one of them is right. 4 TWO DIMENSIONS · INTERACTIVE Step the call and watch the two predictors disagree. step ▶ run 50 random targets 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that indirect calls need a smarter predictor. The inverse is that accuracy is a property of the question, not of the instruction , and averaging hides exactly the cases you care about. The 99.8% and the 0% are measured on the same branch in the same run; nothing about the aggregate is false, and nothing about it is useful. Read backwards, every reported accuracy is a weighted average over a distribution of questions someone else chose — and the hard questions are always the rare ones, so they always weigh least. pause spin LIT on 1,000 executions of one indirect call cycling through four targets the direction predictor is right 998 of 1,000 while a one-entry BTB keyed on the program counter predicts the target correctly 0 times - same instruction, same run, 99.8% and 0% - and keying the BTB on the previous target reaches 995, which falls to 254 when the targets are random instead of cyclic FIG Branch target buffers and the direction/target split are textbook microarchitecture; indirect predictors keyed on target history are the standard fix. AVAN built the case where the two numbers separate as far as they can and instrumented both on ONE instruction stream, so the comparison is not between benchmarks. The result that matters is not that the BTB fails - it is that a headline of '99.8% branch prediction accuracy' is true while the branch is mispredicted every single time. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE SHORTCUT · David Lee Wise (ROOT0), with AVAN


THE STORE TO LOAD FORWARD

A store sits in a buffer, not yet in memory. A load arrives for the same address. Memory is wrong; the buffer is not architecturally visible. The processor must reach into a place the program cannot see.

THE STORE TO LOAD FORWARD · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE HANDOFF ◆ .dlw.fold THE FOLD / CO-OP / THE HANDOFF / THE STORE TO LOAD FORWARD THE STORE TO LOAD FORWARD reaching into a place the program cannot see 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION A store sits in a buffer, not yet in memory. A load arrives for the same address. Memory holds the old value and is wrong; the buffer holds the new one and is not architecturally visible. The processor must reach into a place the program cannot see. LIT verified live. over 500 store-then-load pairs to the same address, a load that bypasses the buffer reads the stale value 500 of 500 times, and a forwarded load reads the correct one 500 of 500 . But forwarding is not one case: enumerating all 15 naturally-aligned access shapes in an 8-byte window gives 225 store/load pairs, which split into 142 disjoint, 15 exact matches, 34 fully contained, and 34 that partially overlap and cannot be forwarded at all. Of the 37 pairs sharing a base address, 11 would be served the wrong bytes by a predictor that matches on base alone. 2 HOW IT WAS WEAVED · AI + HUMAN Store-to-load forwarding and store-buffer stalls are core out-of-order design; the partial-overlap penalty is well documented in Intel and AMD optimisation manuals. AVAN (AI) enumerated the shape space instead of describing it, and the useful number is 34 : partial overlaps are not an exotic corner, they are 15% of all pairs, the same size as the fully-contained class. And the 11 is the real finding — matching on base address alone is not merely incomplete, it silently returns wrong bytes, which is why real hardware carries the size in the comparison and stalls when it cannot decide. 3 ONE DIMENSION 225 store/load pairs. 34 of them cannot be forwarded. 4 TWO DIMENSIONS · INTERACTIVE Pick a store and a load; see which class they land in. next store ▶ next load ▶ 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that forwarding hides the store buffer from the program. The inverse is that the hiding is incomplete, and an incomplete abstraction is worse than none . If the buffer were always visible you would write around it; if it were always hidden you could ignore it. Instead 34 of 225 shapes leak — as a stall, with no error, no signal, and no way to see it from the source. Read backwards, the optimisation did not remove the cost, it made the cost conditional on a fact the language does not express : how your fields happen to be sized and laid out. pause spin LIT over 500 store-then-load pairs to one address a load bypassing the buffer reads the stale value 500 of 500 times and a forwarded load reads the correct one 500 of 500; enumerating all 15 naturally-aligned access shapes in an 8-byte window gives 225 store/load pairs splitting into 142 disjoint, 15 exact, 34 fully contained and 34 that partially overlap and cannot be forwarded at all - and of the 37 pairs sharing a base address, 11 would be served the wrong bytes by a predictor matching on base alone FIG Store-to-load forwarding and store-buffer stalls are core out-of-order design; the partial-overlap penalty is documented in Intel and AMD optimisation manuals. AVAN enumerated the shape space instead of describing it. The useful number is 34: partial overlaps are 15% of all pairs, the same size as the fully-contained class. The 11 is the real finding - matching on base address alone is not merely incomplete, it silently returns wrong bytes. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE HANDOFF · David Lee Wise (ROOT0), with AVAN


THE REGISTER RENAMING

Tomasulo, 1967. Two instructions that both write r2 are not related; they collided in a namespace that ran out of names. Give each write its own name and the ordering it forced disappears.

THE REGISTER RENAMING · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CHEAT · NOCLIP ◆ .dlw.fold THE FOLD / CHEAT / NOCLIP / THE REGISTER RENAMING THE REGISTER RENAMING the hardware apologising for the ISA 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Tomasulo, 1967. Two instructions that both write r2 are not related; they merely collided in a namespace that ran out of names. Give each write its own name and the collision disappears — along with the ordering it was forcing. LIT verified live. on a fixed 24-instruction sequence over 4 architectural registers there are 29 true read-after-write edges, 28 write-after-read and 21 write-after-write — 49 dependencies that carry no data at all. Renaming leaves the RAW count at 29 , exactly unchanged, and takes the false ones to 0 . The critical path drops from 20 cycles to 9 , a factor of 2.22 . And the schedule needs 9 live values at its peak — more than the 4 architectural registers, so the speedup is not free: it is bought with physical registers the ISA never mentions. 2 HOW IT WAS WEAVED · AI + HUMAN Robert Tomasulo’s 1967 algorithm for the IBM System/360 Model 91 is the origin of register renaming; the RAW/WAR/WAW taxonomy is standard. AVAN (AI) measured the two halves separately, which is where the honest statement lives. The RAW count being identical before and after is the proof that renaming removed nothing real. The peak-live count of 9 against 4 architectural registers is the price tag: renaming does not conjure parallelism, it converts register-file area into it . WAR and WAW latencies here are modelled as full one-cycle edges, which is conservative and stated rather than hidden. 3 ONE DIMENSION 49 dependencies that carry no data. 4 TWO DIMENSIONS · INTERACTIVE Toggle renaming and watch the schedule collapse. toggle renaming show false edges 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that renaming removes false dependencies. The inverse is that the false dependencies were a message, and renaming is the hardware apologising for the compiler . Every WAR edge here exists because a register allocator, facing 4 names, reused one. The algorithm never had that constraint; the ISA imposed it; and now silicon spends a rename table and 9 physical registers undoing it. Read backwards, a small architectural register file is not a compact design — it is a debt, paid later, at every clock, by a structure whose only job is to forget the names. pause spin LIT on a fixed 24-instruction sequence over 4 architectural registers there are 29 true read-after-write edges, 28 write-after-read and 21 write-after-write - 49 dependencies carrying no data at all; renaming leaves the RAW count at 29, exactly unchanged, and takes the false ones to 0, dropping the critical path from 20 cycles to 9, a factor of 2.22 - and the schedule needs 9 live values at its peak against 4 architectural registers, so the speedup is bought with physical registers the ISA never mentions FIG Robert Tomasulo's 1967 algorithm for the IBM System/360 Model 91 is the origin of register renaming. AVAN measured the two halves separately, which is where the honest statement lives: the RAW count being identical before and after proves renaming removed nothing real, and the peak-live count of 9 against 4 is the price tag. WAR and WAW latencies are modelled as full one-cycle edges, which is conservative and stated rather than hidden. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of NOCLIP · David Lee Wise (ROOT0), with AVAN


THE TLB SHOOTDOWN

Caches are kept coherent by hardware you never see. TLBs are not. Change a page table entry on one core and the others keep the old translation until software walks over and tells them.

THE TLB SHOOTDOWN · WORLD II — THE FOLD ◀ THE FOLD 0ROOT.AI // WORLD II · CO-OP · THE BROADCAST ◆ .dlw.fold THE FOLD / CO-OP / THE BROADCAST / THE TLB SHOOTDOWN THE TLB SHOOTDOWN the coherence hardware forgot to build 1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION Caches are kept coherent by hardware you never see. Translation lookaside buffers are not. Change a page table entry on one core and every other core keeps using the old translation until software walks over and tells it to stop. LIT verified live. eight cores, 16-entry TLBs, 4,000 accesses, one page unmapped halfway through. Without a shootdown, 281 accesses hit a translation that no longer exists — reads into a frame the kernel already reclaimed. With the shootdown, 0 , and the 26 page faults become 307 , which is what correctness looks like from underneath. At the moment of the unmap, 4 of the 8 cores actually held the entry; the initiator must interrupt all 7 regardless, because nothing tracks who has it. Scale that: at 64 cores it is 63 interrupts and 63 acknowledgements — 126 messages — of which 59 go to cores that never had the mapping. 2 HOW IT WAS WEAVED · AI + HUMAN TLB shootdown via inter-processor interrupt is how Linux, Windows and every other SMP kernel maintain translation coherence; the asymmetry with hardware cache coherence is well known and much complained about. AVAN (AI) ran the failure rather than asserting it, and the first attempt was wrong in an instructive way: the unmapped page was cold, so the stale entries were evicted before anyone touched them and the sim reported 0 stale hits with no shootdown — a pass that proved nothing. Making the page hot for the cores that share it is not stacking the deck; it is the only regime in which shootdown is a real cost. The 26 → 307 fault count is the honest other side: the shootdown does not make the work vanish, it moves it into the fault handler. 3 ONE DIMENSION 281 stale translations, or none. Software decides. 4 TWO DIMENSIONS · INTERACTIVE Unmap the page with and without the broadcast. toggle shootdown step 200 ▶ reset 5 THREE DIMENSIONS + AVAN’S INVERSE The green forward object. AVAN’s addition (the inverse-companion): the forward reading is that the broadcast keeps everyone honest. The inverse is that it is correct precisely because it does not know who needs it . The initiator interrupts all 63 other cores because asking ‘who has this page?’ would require a directory — the same coherence hardware that TLBs exist to avoid. So the safety and the waste are one mechanism seen twice: 59 of 63 interrupts are unnecessary, and the only way to remove them is to build the thing whose absence made the broadcast necessary. Read backwards, unconditional broadcast is what correctness costs when you refuse to track state. pause spin LIT eight cores, 16-entry TLBs, 4,000 accesses, one page unmapped halfway: without a shootdown 281 accesses hit a translation that no longer exists, and with it 0, while the 26 page faults become 307 - at the unmap 4 of the 8 cores actually held the entry and the initiator must interrupt all 7 regardless, which at 64 cores is 63 interrupts plus 63 acknowledgements, 126 messages, 59 of them to cores that never had the mapping FIG TLB shootdown via inter-processor interrupt is how every SMP kernel maintains translation coherence. AVAN ran the failure rather than asserting it, and the first attempt was wrong instructively: the unmapped page was cold, so stale entries were evicted before anyone touched them and the sim reported 0 stale hits with no shootdown - a pass that proved nothing. Making the page hot for its sharers is the only regime where shootdown is a real cost. The 26 to 307 fault count is the honest other side: the work does not vanish, it moves into the fault handler. ◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE BROADCAST · David Lee Wise (ROOT0), with AVAN