From ed28ecec2062ba19cd63d2d34454d78ccb7ceb55 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Tue, 6 Oct 2026 04:00:12 +0100 Subject: Batch executor stage 5 (024): a recurrence (a local a round reads before it sets it, every set of it x = e of x, numbers, fields, states, the loop's value and locals the block does not set, in no branch's way; its sets planned PLAN_RECUR) runs ahead of the batch round by round as steps decoded once a batch, as the executor computes them (a round's fault gives the batch back), leaving its value at each other read in each lane; the batch's pass skips its sets. matmul's, knapsack's and join's table loops batch: matmul 50 to 46 ms. module_tier makes loops with a recurrence (x1) ahead of appends, sets and sums (seeds 1, 2, 3, 5, 23 alike); RECUR_SOURCE: two updates a round, a division by 0 and a product past the numbers at some round, under work and memory budgets --- tests/check.py | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 5 deletions(-) (limited to 'tests/check.py') diff --git a/tests/check.py b/tests/check.py index 8cf82b0..08cf547 100644 --- a/tests/check.py +++ b/tests/check.py @@ -1287,6 +1287,49 @@ on go { """ +# Recurrences a batch runs ahead of its rounds (RECUR_SOURCE): two updates +# of x a round, read between them, items added at keys and appended; a +# division by 0 at round q (a fault in the run ahead: the executor's at +# that round); a product past the numbers (not finite at some round); a +# recurrence of the loop's value and a field. +RECUR_SOURCE = """record Cell { + at = 0 + v = 0 +} +state first = 0 +state last = 0 +state far = 0 +state sum = 0 +input go = message { + n: u32 + q: u32 +} +on go { + let a: list of Cell by at + let b: list of Cell + let x = 1 + for i in 0 .. go.n { + x = x * 48271 - floor(x * 48271 / 2147483647) * 2147483647 + a.add(Cell { at: i, v: x - floor(x / 100) * 100 }) + x = x * 48271 - floor(x * 48271 / 2147483647) * 2147483647 + b.append(Cell { at: x - floor(x / 7) * 7, v: x / (i - go.q) }) + } + let y = 3 + for i in 0 .. go.n { + y = y * 1000 + i + } + let z = 0.5 + for i in 0 .. go.n { + z = z + i * go.q + } + first = a[0].v + last = x + far = y + sum = z +} +""" + + def module_assumptions(aup, pure, work): """The compiled code's integers (Pure docs/design/022) where they stop holding: a loop whose columns hold small whole numbers until, halfway, @@ -1338,6 +1381,18 @@ def module_assumptions(aup, pure, work): assert outputs[name] == outputs['batches'], ('batch', name, next((a, b) for a, b in zip(outputs[name].splitlines(), outputs['batches'].splitlines()) if a != b)) faults = [json.loads(line)['fault'] for line in outputs['batches'].splitlines() if line.startswith('{"states"')] assert 'divide' in faults and 'none' in faults and 'work' in faults, faults + source, program = work / 'recur.aup', work / 'recur.pmod' # recurrences ahead, against the rounds one by one + source.write_text(RECUR_SOURCE) + compile_module(aup, source, program) + given = ''.join(f'message go {struct.pack("