aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-batch.c
Commit message (Collapse)AuthorAgeFilesLines
* Batch executor, stage 4 of design 025: a four-byte comparison counts its 1s ↵eunhhu12 days1-14/+28
| | | | in its own loop (TEST, a vector add in the same loop) and its value carries the count (ones), so the branch after it in every running lane needs not count them; seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources and the unit tests pass
* Batch executor, stage 4 of design 025: a column read at affine rows in ↵eunhhu12 days1-4/+26
| | | | memory's order in four or eight bytes is a view of the column itself (cells_at), no copy, read only while the pass runs; what outlives the pass (a local, a set's rows and value, an append's cells, a sum's rows and e, a filter's key, a read's rows) copies it (own); knapsack 4.0% fewer instructions, 6.6% fewer cycles; VIEW_SOURCE in check.py (a local holding a field the batch sets, a set from the same column in the order that overwrites what it reads, a set widening the column under a view), which differs and trips ASan's memcpy overlap when the copies are left out; seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources (also sanitized) and the unit tests pass
* Batch executor: a list's cells once a batch (cells_of, the first four lists ↵eunhhu12 days1-11/+27
| | | | its pass reads): no list changes while the pass runs (sets, appends and filters wait for its end, which reads its own); find and item_get read them there; matmul 2.3% fewer instructions (two finds a nested round), knapsack and BFS 0.4%; seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources and the unit tests pass
* Batch executor, stage 3 of design 025: a reduction starts with no lanes: ↵eunhhu12 days1-8/+57
| | | | while every step adds (or takes the least or most of) the same e in every lane, every lane's partial is one number and its count one count, made as each lane would make them; the first step that differs makes the lanes from them; fold takes n times the one number (whole numbers below 2^53, as the lanes' sums) or folds it in the rounds' order; sum0 6.09 to 1.01 ms; seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources and the unit tests pass
* Batch executor: select and deselect named select_arm and deselect_arm ↵eunhhu12 days1-6/+6
| | | | (POSIX's select in a build without -std=c17 refused the file)
* Batch executor, stage 3 of design 025: four-byte MUL (words_op): a product ↵eunhhu12 days1-1/+6
| | | | below 2^32 of whole numbers below it in four-byte lanes, past it the product's high half sends the lanes back to numbers as ADD's sum does (umull and umull2 over four lanes); matmul's products and sums stay in four bytes; seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources and the unit tests pass
* Batch plans: stage 2's check let go (segments run as made); with it gone the ↵eunhhu12 days1-38/+5
| | | | unit tests in three modes and under ASan (executor mode too), the sanitized pure-run's fixed sources and seed 23 (both modes), make check and aup's checks in both modes pass
* Batch plans, stage 2 of design 025: segments, runs of a batch loop's ↵eunhhu12 days1-5/+232
| | | | instructions that make one uniform or affine value (constants, fields, LOADs, a walk's item, locals the block does not set, the loop's value, a nested count loop's, a local a segment set once before; a field at a uniform row; arithmetic and comparisons) and their LOCAL_STORE, planned at load and run at once in scalars by the pass's rules when the batch runs plainly, the pass's own way when a value is not as planned; the check (PURE_BATCH_CHECK) runs each dry and compares with the pass's own: seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources and the unit tests pass, seed 23's programs checking 312,249 segments in 213 of 650 runs
* Batch plans: the check (PURE_BATCH_CHECK) let go, stage 1 made; with it gone ↵eunhhu12 days1-122/+0
| | | | the unit tests in three modes and under ASan (executor mode too), the sanitized pure-run's fixed sources and seed 23 (both modes), make check and aup's checks in both modes pass
* Batch plans: the recurrences read once at load too (design 025, stage 1): ↵eunhhu12 days1-98/+227
| | | | their locals, updates and steps, records and a round's actions in the plan, a number that stays planned by its source (a constant, field, LOAD or local the block does not set: the same source one number, two sources of the same value two) and filled in as a batch opens, the pass finding an update or a record by its instruction's role; the check compares updates, records and whether the batch holds them with the block read again each batch: seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources and the unit tests pass
* Batch plans, stage 1 of design 025: each batch loop's block read once at ↵eunhhu12 days1-30/+140
| | | | load (pure_batch_plans, after its instructions' plans are final): the locals it sets and whether it sets items, its sums into cells, and at each instruction a role (a sum's again, add or set) and how far on a LOCAL_LOAD's x = x op e is; batch_run, pass and local_load read the plan instead of scanning the block each batch; PURE_BATCH_LANES to build other lane counts; PURE_BATCH_CHECK (a build flag, while the stage is made) reads the block again each batch and stops if the plan differs; seeds 1 2 3 5 23 (default and PURE_SELECT=all), the fixed sources and the unit tests pass with it
* Batch: a selection's rows given back affine over the lanes around when they ↵eunhhu13 days1-6/+24
| | | | are (a loop's value gathered: the end's checks know them, where lanes of rows gave the batch back: knapsack 48 to 11.5 ms); a module with no value planned for reuse spares the batch the looks (reuses); local_load inlined again
* Batch: general cuts (docs/research/131). A value computed by the same code ↵eunhhu13 days1-78/+497
| | | | as an earlier one in a line of the block (nothing between setting what it reads: planned at load, reuse_from and reuse_length) is taken from the earlier, kept for it; if !c { ... } one branch the other way, no NOT; an arm whose lanes are a quarter or fewer runs in those lanes alone (a selection: outer values gathered by sel, reductions into their lanes around, locals set given back masked at its end, stores and sums expanded, appends and a filter's kept rounds by sel; PURE_SELECT=all every straight arm, 0 none); a list whose keys are bits asked by them in one loop of lanes, a filter decided by its bits and bits of our own (no hash set; a key with no bit is not there); L.first + i affine while within the list; a slice's two bounds in one call (pure_list_slice); a filter's kept rounds copied from numbers made once. The suite's BFS 211 to 112 instructions an edge (the compiled code 38.5), 41.0 to 23.5 ms; the frontier sum 70 to 56 (35). Seeds 1, 2, 3, 5, 23 alike by default and with every arm selected
* Batch: filters, if !L.has(k) { a line appending } in a batch's block or in a ↵eunhhu2026-10-061-4/+291
| | | | walk's spread items (PLAN_FILTER; L only grown there, one filter a list, none in a nested LOOP): each round asked as the batch opens, its code run in the rounds it said no to, those rounds kept (k and the appends' cells) and asked again at the end in the rounds' order (L as it is and what the kept rounds before add), the rest added at once (pure_list_add_many) once the lists take them and the memory budget all of them (else, or a key added there already, the batch gives its rounds back); a list such a filter grows read in the block only as no earlier round's item would change (its count in the guard, its first, a place when it has no key, a field by key). Keys kept as bits (pure_list_bits) asked by a loop of lanes, fields of a DENSE list found at their keys (pure_list_dense); an outer lane's affine value in four bytes. The suite's BFS batched: PURE_JIT=0 93 to 39.6 ms (the compiled code 7.7, C 10). module_tier's walks filter d (seeds 1, 2, 3, 5, 23 alike: 5,806 filters decided in seed 23's); GRAPH_SOURCE: a graph built by a filter, searched twice, marks whose filter adds another key (EXISTS), under work and memory budgets
* Batch: a count's loop whose block begins if slot >= L.count { break } (L ↵eunhhu2026-10-061-16/+256
| | | | only grown in it) batches to L's count as each batch opens (PLAN_GUARD; fewer than LEAST rounds left there: the executor's, then batches again); a walk in a batch's block (its slice per lane, no where's range) runs each lane's items, its work counted as each opens: together round by round (BREAK as a nested loop's), or spread into lanes in the rounds' order a chunk of up to 1024 at a time when its items' rounds may run apart (PLAN_SPREAD: no break, the locals it sets reductions or its items' own: an outer lane's value read by each item's outer lane, a reduction added into its outer lane's in the items' order, an own local left as the last item that set it); rows in four bytes read and checked by loops of their own. A frontier walk of the suite's graph (each node's edges' to summed) PURE_JIT=0 55.2 to 10.4 ms (the compiled code 6.24). module_tier makes guarded loops with a walk in each (seeds 1, 2, 3, 5, 23 alike: 8,819 spread and 7,651 together in seed 23's); FRONT_SOURCE
* Batch: a round of the recurrences one loop of actions laid out once a batch ↵eunhhu2026-10-061-34/+59
| | | | (steps, x set by an update's last step itself, records), the numbers through a restrict pointer; a record of x where x was not set since an earlier one shares its lanes (join's four reads of x: one store a round). 1,000,000 rounds of MINSTD 25.7 to 21.9 ms, with four reads of x into a sum 50.4 to 36.0 (the compiled code 18.5 and 19.9); PURE_JIT=0 join 131 to 118
* Batch: reductions' ends in any order where the order cannot tell (the least ↵eunhhu2026-10-061-1/+53
| | | | and the most; a sum of whole numbers whose magnitudes together stay below 2^53, four sums at a time), the rounds' order kept for the rest; each lane's least and most step and their fold over the numbers as integers in their order (-0 below +0), loops of vector code; a reduction's lanes cleared by a loop that keeps its count: 1,024,000 rounds of a max 9.80 to 4.00 ms (the compiled code 4.27), of a count 4.51 to 1.61
* Batch: a recurrence's steps each an operation of two numbers a round keeps ↵eunhhu2026-10-061-39/+60
| | | | (a step's result, a recurrence's value, the loop's value, a number that stays) rather than a stack's pushes and pops, an operation computed twice in its statement once (x the same until it is done): 1,000,000 rounds of MINSTD 44.4 to 25.7 ms (the compiled code 18.5, the executor alone 73.0); costs/recur.aup
* Batch: a batch's appends made at once (pure_list_add_many, a call a chunk of ↵eunhhu2026-10-061-14/+156
| | | | 128) when every list takes its items so (an event's list, no index into it, one append to it: FLAT not keyed at its end, DENSE by keys it holds at its count, HASHED by number; never past its arrays' limit) and the memory budget takes them all (each item only grows what it counts): columns grown and widened once, the first key there already the executor's EXISTS at its round; else round by round as before, tried at once again after a round that changed a list's form. 50,000 DENSE adds 5.18 to 0.65 ms (the compiled code 0.28). APPEND_SOURCE: keys there already at rounds q and p, keys past a DENSE list's from round p, two appends to one list, widened columns, under memory budgets (seeds 1, 2, 3, 5, 23 alike: 31,402 batches at once in seed 23's, 292 by the budget round by round)
* Batch: a walk (EACH) whose block has batch forms runs a batch of its items ↵eunhhu2026-10-061-11/+28
| | | | at a time: each lane an item's place (ROW of the walked list affine), its work counted as it opened, its place moved past the batch; no append to the walked list. module_tier makes walks of rounds apart (f, g, h, slices of g; seeds 1, 2, 3, 5, 23 alike: 1,891 walk batches in seed 1); BATCH_SOURCE walks a slice
* Batch: a sum into a cell, L[k].f = L[k].f + e (k computed twice the same and ↵eunhhu2026-10-061-12/+166
| | | | e, neither reading L; the set at k's row as found), keeps its rows and e from the pass (the second k, its find and the cell's read skipped) and adds them at the batch's end round by round as the executor adds and sets (a sum not finite: the executor's fault at its round; a column too narrow widened); a batch reading or setting those cells otherwise gives its rounds back. Recurrence steps one dispatch each. PURE_JIT=0 join 428 to 165 ms (the compiled code 78). module_tier makes sums into cells (seeds 1, 23 alike: 278 batches with them in seed 1); BATCH_SOURCE sums into three cells in turn
* Batch executor stage 5 (024): a recurrence (a local a round reads before it ↵eunhhu2026-10-061-5/+159
| | | | 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
* Batch executor stage 4, first part (024): an item of numbers and bools ↵eunhhu2026-10-061-7/+48
| | | | 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)
* Batch: numbers' results checked finite as they are made (in integers, in the ↵eunhhu2026-10-051-39/+117
| | | | same loop: a pass less each), tests of numbers giving four-byte 1s and 0s (a branch's mask as they are), numbers made of four-byte lanes and affine values by loops of their own, the loop's value as numbers made once a batch, no live lanes to make while none broke out or ran out, a small whole count's sum unchecked: PURE_JIT=0 roots 16.8 to 9.1 ms (the compiled code 9.6, C 6.9), matmul 68 to 50
* Batch executor stage 2 (024): a loop in the batch's block runs its rounds ↵eunhhu2026-10-051-14/+262
| | | | for every lane together (round t for the lanes with more than t rounds that did not break out; BREAK leaves it lane by lane; its slot as each round sets it), and x = x op e (op +, min, max; x read no other way) is a reduction: each lane's own from op's identity (-0 a sum's), folded in the rounds' order at the batch's end (a sum's lanes of several whole numbers only, below 2^53); nested rounds' work counted for each lane and checked before anything changes; lanes and masks no holder keeps freed between nested rounds. Planned at load: a local read before set in its loop's scope, or not a reduction's, keeps the loop round by round. PURE_JIT=0: roots 130.5 to 16.8 ms, matmul 914.7 to 68.2. module_tier makes nested loops with breaks and reductions (seeds 1, 2, 3, 23: 549 programs alike); NESTED_SOURCE
* Batch executor stage 1 (024): a count's loop whose block has batch forms ↵eunhhu2026-10-051-0/+985
(lane forms, locals set before read in every round, ifs, numbers set in items) runs, in the executor, up to 1024 rounds at a time: values uniform, affine or lanes (numbers, or whole numbers in four bytes), branches as masks, cells read by affine rows as strided columns, sets kept to the batch's end and made only when no round reads an earlier round's; a fault, a form it lacks or such a read gives the rounds back to the executor one by one, work counted as written. Planned at load (PURE_BATCH=0: none); the executor of a module without such loops is the same code (run aligned to 64: as many instructions and cycles), with one its own copy. knapsack with PURE_JIT=0: 1,056 to 13.7 ms. module_tier compares batches with the executor alone and makes loops of rounds apart; BATCH_SOURCE: widened columns, -0, a fault mid-batch, rounds reading the last's sets