aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check.py
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-06 03:50:03 +0100
committereunhhu <[email protected]>2026-10-06 03:50:03 +0100
commit41544624575aba6ed7c0712442ae0ecd587d9ad6 (patch)
treeed72a7eeb6227213fac8711ae5febd43da4b026b /tests/check.py
parente1c8812473c89b96e9c1a09f3a46f8f392945b64 (diff)
downloadpure-41544624575aba6ed7c0712442ae0ecd587d9ad6.tar.gz
pure-41544624575aba6ed7c0712442ae0ecd587d9ad6.zip
Batch executor stage 4, first part (024): an item of numbers and bools appended in a batch's block (to a list the block reads nowhere else, no index into it, no nested loop) is made at the batch's end round by round through the executor's own step: keys there already, the memory budget, its undo log as the executor's; a fault there is the executor's at that round (the event undone: its kind, its instruction and the work so far tell), pure_batch_run's third way out. module_tier's handlers append (e, d) in rounds apart and run under a memory budget too (seeds 1, 2, 3, 5, 23 alike); knapsack's table loop batched (13.8 to 13.7 ms: the appends cost as the executor's)
Diffstat (limited to 'tests/check.py')
-rw-r--r--tests/check.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/check.py b/tests/check.py
index ff04e09..8cf82b0 100644
--- a/tests/check.py
+++ b/tests/check.py
@@ -1360,7 +1360,7 @@ def tier_program(rng):
whose keys came out of order read by key alone (HASHED), one of small
keys read by key alone (full, or not where keys are left out), ifs and
breaks, loops whose rounds are apart (a batch's, 024), some with a loop
- run in each and reductions (ra, rb, rc), with what fails
+ run in each and reductions (ra, rb, rc), some appending (e, d), with what fails
(a key not there, not whole, 0 divided by, a cell past its column's
width) as likely as not."""
names = iter('jklpqrxyz')
@@ -1458,7 +1458,12 @@ def tier_program(rng):
lines.append(f'{pad}for {name} in {low} .. {high} {{')
lines.append(f'{pad} let w{name} = {number(1, loops + [name])}')
for _ in range(rng.randint(1, 3)):
- if rng.random() < 0.5:
+ pick = rng.random()
+ if pick < 0.15: # appended round by round (a key there already: EXISTS; past the memory: MEMORY)
+ lines.append(f'{pad} e.append(Cell {{ at: {at()}, v: {number(1, inner)} }})')
+ elif pick < 0.3:
+ lines.append(f'{pad} d.add(Cell {{ at: {rng.choice([name, f"{name} * 3", key(2, inner)])}, v: {number(1, inner)} }})')
+ elif pick < 0.6:
lines.append(f'{pad} t[{at()}].v = {number(1, inner)}')
else:
lines.append(f'{pad} if {cond(1, inner)} {{ t[{at()}].v = {number(1, inner)} }}' +
@@ -1498,12 +1503,13 @@ def tier_program(rng):
'record Cell {', ' at = 0', ' v = 0', '}', 'state out = 0', 'state acc = 0',
'input go = message {', ' n: u32', ' m: u32', ' q: u32', '}',
'on go {', ' let t: list of Cell by at', ' let f: list of Cell', ' let h: list of Cell by at', ' let g: list of Cell by at',
+ ' let e: list of Cell', ' let d: list of Cell by at',
' for i in 0 .. go.n {', f' t.add(Cell {{ at: i, v: {rng.choice(["i", "0", "(i * 3)", "1"])} }})',
' f.append(Cell { at: i * 2, v: i })', ' h.add(Cell { at: i * 7919 - floor(i * 7919 / 1009) * 1009 + 5000000, v: i * 5 })',
f' g.add(Cell {{ at: {rng.choice(["i", "i", "i + floor(i / 40)"])}, v: i * 3 }})', ' }',
' let s = 0', ' let u = 1', ' let ra = 0', ' let rb = 0', ' let rc = 0',
' for i in 0 .. go.m {', *body, ' }',
- ' out = s + ra + rb + rc', ' acc = acc + u', '}', ''])
+ ' out = s + ra + rb + rc + e.count + d.count', ' acc = acc + u', '}', ''])
def module_tier(aup, pure, work, programs=150):
@@ -1522,7 +1528,8 @@ def module_tier(aup, pure, work, programs=150):
rng = random.Random(23)
runs = [(0, 0, 0), (5, 3, 1), (70, 40, 3), (130, 25, 2), (300, 7, 299), (70, 70, 64)]
messages = ''.join(f'message go {struct.pack("<III", n, m, q).hex()}\nwork\n' for n, m, q in runs)
- commands = messages + ''.join(f'budget {b}\n' + messages for b in (61, 389, 1201, 4099)) + 'budget 0\n' + messages
+ commands = (messages + ''.join(f'budget {b}\n' + messages for b in (61, 389, 1201, 4099)) + 'budget 0\n' + messages +
+ 'memory 6000\n' + messages + 'memory 0\n')
checked = failed = 0
for i in range(programs):
source, module = work / f'tier-{i}.aup', work / f'tier-{i}.pmod'