Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
374 commits
Select commit Hold shift + click to select a range
b6fab95
whole-scope executor: single aux batch loop + the build-once CSE win …
evaleev Aug 10, 2026
1e7fe3c
whole-scope executor: hold the backend scope guard across the K loop …
evaleev Aug 10, 2026
6d75495
whole-scope executor: nested aux+occ scope tree recursion (Task 4)
evaleev Aug 10, 2026
f3b7dcb
doc: add Task 5 (weighted use-count lifetimes / remove ensure_hoist_s…
evaleev Aug 10, 2026
6b3fc3e
whole-scope executor: map contracted mode to each member's own axis (…
evaleev Aug 10, 2026
baa5fd3
whole-scope executor: restore grouped nested recursion (Task 4 fix ro…
evaleev Aug 10, 2026
f9eae84
whole-scope executor: add weighted_use_count in-block lifetime (Task …
evaleev Aug 10, 2026
5e234b1
whole-scope executor: weighted-life homed values, drop ensure_hoist_s…
evaleev Aug 10, 2026
592a86f
whole-scope executor: refresh walk_scope doc for weighted-life homing
evaleev Aug 10, 2026
693f663
doc: Task 5 Step 6 -- retain ensure_hoist_slot for forest descent (ow…
evaleev Aug 10, 2026
f9f1f74
whole-scope executor: coexistence flag + cost-model peak selection (T…
evaleev Aug 10, 2026
0ba1d53
doc: add Task 8 (MPQC runtime validation -- CSV-CCk energies, forest-…
evaleev Aug 10, 2026
c250d71
whole-scope executor: water-20 + C60 whole-branch validation witnesse…
evaleev Aug 10, 2026
9118a3c
whole-scope executor: witness fix round 1 -- water-20 structural comp…
evaleev Aug 10, 2026
67e8ba2
eval: whole-scope driver seam on CacheManager + forest-evaluate dispatch
evaleev Aug 10, 2026
20a69db
eval: guard last_type_is_cache_manager against empty pack
evaleev Aug 11, 2026
e89a9b4
eval: exclude the cache-appending forwarder when any arg is a cache
evaleev Aug 11, 2026
ef79b4e
eval: emit BatchGroup/BatchMember/BatchAxes loop markers from the who…
evaleev Aug 11, 2026
2d3bd1c
eval trace: uniform per-op sliced-mode + loop-scope annotations (fore…
evaleev Aug 11, 2026
139db04
eval: drop trailing comma in scope_annot list (scope={i,i,K} not {i,i…
evaleev Aug 11, 2026
49d54d5
add remat home + use DAG-scope to the per-op trace annotation
evaleev Aug 11, 2026
18a9a7a
add PeakMonitor and wire hierarchy-wide co-resident high-water into C…
evaleev Aug 11, 2026
44380a2
meter: per-node exec tally and MeterReport assembly (peak, persistent…
evaleev Aug 11, 2026
b078c35
meter: strengthen [meter] test to cover exec/cost split, persistent b…
evaleev Aug 11, 2026
c98f5c7
meter: dry-run driver running the real policy-selected executor with …
evaleev Aug 11, 2026
7f305fd
witness: meter both executors and report Kappa-free home={} rebuilds …
evaleev Aug 11, 2026
9ef658e
meter: install the batched custom evaluator on the forest-descent path
evaleev Aug 11, 2026
cca0086
legality: value build-site derivation over the contraction DAG
evaleev Aug 12, 2026
cd49f61
test_legality: include io/shorthands.hpp for deserialize
evaleev Aug 12, 2026
7cf9640
legality: four-way per-axis classifier (loop-local/reduction/loop-car…
evaleev Aug 12, 2026
04fb946
legality: require LoopLocal coverage in the water-20 test; assert for…
evaleev Aug 12, 2026
67d53fe
legality: home-floor computation from per-axis roles
evaleev Aug 12, 2026
3c8146f
legality: forced loop splits and the monotone classification fixpoint
evaleev Aug 12, 2026
976ed2f
legality: SP1 acceptance test for all four LoopRole values
evaleev Aug 12, 2026
290e8ce
legality: SP2-facing notes on implicit LoopInvariant, per-instance sp…
evaleev Aug 12, 2026
9599b11
legality: Q2b compares all same-type slots; per-type split grouping; …
evaleev Aug 12, 2026
cf690de
ordered-schedule: the OrderedSchedule IR (ScopeBlock tree with ordina…
evaleev Aug 12, 2026
cc7edaa
ordered-schedule: restore whole-schedule single-producer (SSA-like) i…
evaleev Aug 12, 2026
6b3d494
ordered-schedule: deterministic sequencer for the non-split case (hom…
evaleev Aug 12, 2026
b8a5b08
ordered-schedule: replace the scalar-key sort with a real per-step to…
evaleev Aug 12, 2026
3b508cc
ordered-schedule: forced loop splits + grown demotion fixpoint (LoopL…
evaleev Aug 12, 2026
090e152
ordered-schedule: single-sided forced-split demotion trigger (fix asy…
evaleev Aug 12, 2026
879b1bd
ordered-schedule: water-20 + cross-iteration acceptance and executor-…
evaleev Aug 12, 2026
1af1a6c
ordered-schedule: fail-safe assert for non-innermost forced split + S…
evaleev Aug 12, 2026
bf39b82
ordered-executor: skeleton, gating flag, and root-block BuildStep int…
evaleev Aug 12, 2026
aa03a5e
ordered-executor: extract shared forest-root combine into forest_comb…
evaleev Aug 12, 2026
927c248
ordered-executor: Contracted loop blocks with AccumulateSum reduction…
evaleev Aug 12, 2026
5c3ded4
ordered-executor: assert against silent multi-physical-label axis mis…
evaleev Aug 12, 2026
4a6d17a
ordered-executor: AccumulateScatter outputs and forced-split producer…
evaleev Aug 12, 2026
16502a9
ordered-executor: water-20 numerical-equivalence and home={} build-on…
evaleev Aug 12, 2026
3ce140f
ordered-executor: peak monitoring, run-completeness assertion, and un…
evaleev Aug 12, 2026
dcf15af
diagnostics: co-resident peak live-set introspection + w20 peak-compo…
evaleev Aug 12, 2026
1e2b20d
scope_executor: drop dead `perm` local left by the root-combine extra…
evaleev Aug 12, 2026
3ceb5cc
diagnostics: access-clock last-use timeline for eager-release reclaim…
evaleev Aug 12, 2026
2fda7de
cache_manager: bounded/persistent ensure_home_slot overload
evaleev Aug 12, 2026
8a14c38
cache_manager: test ensure_home_slot upgrade-existing-entry branch
evaleev Aug 12, 2026
37572b2
ordered-executor: n_blocks block-count function over OrderedSchedule
evaleev Aug 12, 2026
d321187
ordered-executor: thread lifted is_volatile node predicate
evaleev Aug 12, 2026
1ce782b
ordered-executor: read-from-home access discipline with exact static …
evaleev Aug 13, 2026
6535ed5
ordered-executor: reuse resident persistent loop outputs instead of r…
evaleev Aug 13, 2026
1aabb62
ordered-executor: emit BatchGroup / ORDERED_RUN_BLOCK batch-execution…
evaleev Aug 13, 2026
30f28c9
batch: single BatchScheduler enum replacing execution bools; fix mete…
evaleev Aug 13, 2026
040e7c8
eval: DP-sourced build-site + no-batching self-revert, plus investiga…
evaleev Aug 15, 2026
778f2bb
eval: EvalExpr::accumulate_in_place flag; binarize marks chain Sum nodes
evaleev Aug 15, 2026
d24bd63
eval: marked Sum nodes accumulate in place
evaleev Aug 15, 2026
c35f3fc
eval: make in-place Sum accumulation safe against shared accumulators
evaleev Aug 16, 2026
1efa146
eval: materialize Sum-node prefix hashes so hash is sensitive to ever…
evaleev Aug 16, 2026
7a12668
eval: chain_holds_shared treats persistent entries as shared
evaleev Aug 16, 2026
df414ae
eval: per-root layouts for evaluate_multiroot / evaluate_ordered_mult…
evaleev Aug 16, 2026
fc08936
eval: assert a non-persistent cache entry is not re-stored within one…
evaleev Aug 16, 2026
c2a3317
eval: remove life-sequence tracing and cell-check diagnostics (keep g…
evaleev Aug 16, 2026
6ecb6d5
eval: dedup commutative Product nodes with swapped operands
evaleev Aug 17, 2026
94fded7
eval: make deep Sum-tree node comparison and size() stack-safe
evaleev Aug 17, 2026
159ec84
eval: ordered executor — single-holder roots, correct persistence, sk…
evaleev Aug 18, 2026
bd6f728
test: re-baseline [dryrun-occ-veto] C60 witness to the current gate-o…
evaleev Aug 19, 2026
15eda10
core: make is_valid's Sum external-index check proto-index aware (fix…
evaleev Aug 19, 2026
d5064ad
optimize: re-key batch annotations onto the reassembled Sum (fix drop…
evaleev Aug 19, 2026
3a80dab
optimize: serialize the term_batch_axes insert (data race under paral…
evaleev Aug 19, 2026
818173b
test: include <domain/mbpt/space_qns.hpp> where mbpt::Spin is used (f…
evaleev Aug 19, 2026
e27cf6c
optimize: emit node_axes for <3-factor products (fix CSV-CCk binarize…
evaleev Aug 19, 2026
9f84317
eval/occurrence_key, TNv3: a Sum is not a tensor network
evaleev Aug 20, 2026
6f1ddd0
batched eval: run CSV-CCk residuals through the ordered executor over…
evaleev Aug 20, 2026
951afc3
tests: make strict-braket fixtures particle-conserving
evaleev Aug 20, 2026
96beeb1
eval/CacheManager: clear the re-store tripwire when a value is released
evaleev Aug 20, 2026
5b08149
optimize: perf-first peak_threshold gates flops-neutral slicing
evaleev Aug 20, 2026
58d9475
eval/ordered: cache-halt batch-block Transients via needed_build
evaleev Aug 20, 2026
3032a4a
optimize: perf-first over-budget fallback picks min-peak, not min-nsl
evaleev Aug 20, 2026
c34d1b0
tests/ordered: env-driven 2-iteration dry-run cost report + peak-liveset
evaleev Aug 21, 2026
8b473f5
tests/ordered: add PAO (μ̃) batch lever to the dry-run report
evaleev Aug 21, 2026
7018713
ordered: add fork_subchain helper for non-innermost loop split (SP2, …
evaleev Aug 21, 2026
6d3635d
ordered: multi-level escape chain for non-innermost split (SP2, phase 2)
evaleev Aug 21, 2026
00cf6b8
tests/ordered: 2-axis occ-outer/aux-inner fixture (SP2 phase-3 gate)
evaleev Aug 21, 2026
f834625
ordered: non-innermost forced loop split emission (SP2 phase 3)
evaleev Aug 22, 2026
f6be0a2
eval: slice-on-use honors the stamp, not the space (external-occ over…
evaleev Aug 22, 2026
67d3825
eval: replace the batching "carrier" with backend-provided array ops
evaleev Aug 23, 2026
ba41d15
eval: drop dead helpers left by the carrier removal
evaleev Aug 23, 2026
0a5b6ff
eval: add DagScopeLevel + ModeToLevel scaffolding
evaleev Aug 23, 2026
59f264c
eval: mode_to_level_from_signature -- the one mode<->loop zip
evaleev Aug 23, 2026
9ae2e65
eval: ScopeBlock carries its DAG-scope level; ValueCell gains mode_to…
evaleev Aug 23, 2026
9296dda
eval: populate ValueCell::mode_to_level from the ScopeBlock nest
evaleev Aug 23, 2026
67ef002
eval: BatchContext entry carries its DAG-scope level; add node->mode_…
evaleev Aug 23, 2026
8cb5482
eval: populate mode_to_level for every sliced value (leaves + escapes…
evaleev Aug 23, 2026
7c8e7e7
eval: equivalence gate -- mode_to_level agrees with exact matches
evaleev Aug 23, 2026
2d02e48
eval: slice_to_use resolves ordered path by DAG-scope level
evaleev Aug 23, 2026
ddc360e
eval: populate mode_to_level from each cell's own participant labels …
evaleev Aug 23, 2026
451c043
eval: revert mode_to_level WIP; add sliced-canonical-layout probe
evaleev Aug 23, 2026
ca68101
tensor_network: loop-color sliced slots in canonicalize_slots
evaleev Aug 23, 2026
ee134f1
ordered: emit per-(value,sliced-mode)->loop assignment
evaleev Aug 23, 2026
560bf22
eval: confirm/strengthen store-canonical/serve-permuted read path
evaleev Aug 23, 2026
39195eb
eval: produce the loop-colored value-id
evaleev Aug 23, 2026
bcf0432
eval: store per-occurrence permutation onto the canonical layout
evaleev Aug 24, 2026
16bde45
eval: assert modes-agree-modulo-permutation invariant in populate_occ…
evaleev Aug 24, 2026
fce027f
eval: slice_to_use resolves via the loop-colored canonical layout
evaleev Aug 24, 2026
47b75f8
eval: consumer-aware slice_to_use binds each occurrence's mode via th…
evaleev Aug 24, 2026
63cc4bb
eval: delete the superseded per-cell mode_to_level map and its plumbing
evaleev Aug 24, 2026
79a3d4f
eval: frame-correct position-based slice seam (fixes non-sibling-loop…
evaleev Aug 24, 2026
d41a23f
test: guard obsolete label-seam cases (pending loop-open Task 4 rewrite)
evaleev Aug 25, 2026
b8e00a8
feat(eval): batch_loops_opened_here annotation + binarize wiring
evaleev Aug 25, 2026
1e7a9ff
feat(optimize): emit batch-loop-open sites (once per physical loop)
evaleev Aug 25, 2026
4d134aa
fix(eval): build ectx from loop-opens, not the per-node sliced mask
evaleev Aug 25, 2026
0bdb709
fix(eval): per-occurrence positional slice seam (breaks w8 occ+aux de…
evaleev Aug 25, 2026
f66629a
test: stamp batch_loops_opened_here in ectx-driven fixtures; guard DF…
evaleev Aug 25, 2026
6fc1f2e
fix(eval): fail loud on an incomplete sliced-mode assignment (occ_fac…
evaleev Aug 25, 2026
de09a53
chore(eval): drop w8-specific SMA sliced-mode-assignment diagnostics
evaleev Aug 25, 2026
5cebf7d
refactor(eval): rename batched_here -> node_slice_mask
evaleev Aug 25, 2026
744cda1
test(eval): pin the colored occurrence_key as the value-id substrate
evaleev Aug 25, 2026
4373ef5
feat(eval): record home_mode_depth at home placement; value_id coloring
evaleev Aug 25, 2026
23e54e2
feat(eval): coloring-aware TreeNodeHasher/Comparator (K1); null == id…
evaleev Aug 25, 2026
8f1140b
feat(eval): CachedValue key + value-id hasher/comparator
evaleev Aug 26, 2026
1952567
refactor(eval): CacheManager key/node split -- key by CachedValue (em…
evaleev Aug 26, 2026
6e83fb0
refactor(eval): extract apply_one_op single-op kernel (no behavior ch…
evaleev Aug 26, 2026
012ddfa
feat(eval): persist operand_vids (value/occurrence DAG edges) on Orde…
evaleev Aug 26, 2026
b9607b0
feat(eval): home-colored cache keys via a value-keyed scratch (Pillar 1)
evaleev Aug 26, 2026
c499362
chore(eval): revert the K1 hasher/comparator injection (subsumed by C…
evaleev Aug 26, 2026
bb8183d
chore(eval): retire the dead test-only by_value canonical-layout path
evaleev Aug 26, 2026
5bc17ef
doc: frame-correct use-induced sliced-mode spec + implementation plan
evaleev Aug 28, 2026
7f18f9d
doc: re-scope sliced-mode spec against measured w8 ground truth
evaleev Aug 28, 2026
69be92f
doc: confirm w20 crash is the section 5 occ-external collapse
evaleev Aug 28, 2026
656da1c
doc: fresh spec for batched-DAG loop identity (depth/altitude/latitude)
evaleev Aug 28, 2026
23e43f2
doc: split loop identity (depth, loop_slot) from layout (altitude, la…
evaleev Aug 28, 2026
077c739
doc: define value-id and occurrence-id both on loop identity
evaleev Aug 28, 2026
4242d34
doc: pin loop_slot stability across remat; supersede stale plan
evaleev Aug 28, 2026
fda08e9
doc: implementation plan for batched-DAG loop identity
evaleev Aug 28, 2026
6737bba
eval: land loop-identity vocabulary (Task 1, no behavior change)
evaleev Aug 28, 2026
e8bcee7
eval: de-collapse same-space loop group into per-instance loops (WIP)
evaleev Aug 29, 2026
1c39fbe
eval: assign per-occurrence loop_slot at fusion (Task 2)
evaleev Aug 30, 2026
2d41b7e
eval: un-fuse same-space loop groups into separate nests (Task 3, WIP)
evaleev Aug 31, 2026
0301aca
eval: aux+occ ordered-DAG batched CCSD — w8 lossless, w20 schedule bu…
evaleev Aug 31, 2026
1bb3553
eval: fix sliced_modes over-homing (meet dedup + retire proto-expansi…
evaleev Sep 1, 2026
85903d0
eval: fix dry-run cost_profile array-ops regression + retire stale pr…
evaleev Sep 1, 2026
28d5af7
eval tests: stamp loop-opens for the opens-based ectx; hide stale rou…
evaleev Sep 1, 2026
772ea6a
eval tests: green the default suite -- fix opens/stamp staleness, hid…
evaleev Sep 1, 2026
5cacfba
eval: derive sliced_modes from batch_loops_opened_here (retire the me…
evaleev Sep 1, 2026
e36d2a6
test: SEQUANT_UT_SCHED_TREE dumps sliced_modes per output (Layer 1 di…
evaleev Sep 1, 2026
aaede7e
eval/ordered: home escape outputs at their residency home, guarded by…
evaleev Sep 1, 2026
d56a643
test: w20-auxocc-walk residency diagnostics (consistency check + traces)
evaleev Sep 2, 2026
0048120
eval/ordered: home single-truth (coloring/lifetime/store) + non-decre…
evaleev Sep 2, 2026
3701a84
eval/ordered: route lat_homes through the consumer-aware home too
evaleev Sep 2, 2026
860b70e
ordered executor: per-occurrence slice seam + per-level scatter (w20 …
evaleev Sep 2, 2026
10d717e
ordered schedule: per-occurrence loop slot + reduction-consumer facts…
evaleev Sep 2, 2026
0748859
eval: per-level residency slicing + frame-canonical sliced-value keys…
evaleev Sep 2, 2026
9e2ba91
eval: identity-based home walks + strict dry-run schedule test-drive
evaleev Sep 2, 2026
20be08c
legality: loop-instance-aware LoopLocal (escape a value read from a s…
evaleev Sep 3, 2026
64078c7
eval: explicit value-cell table types (Cell, Read, CellScope)
evaleev Sep 3, 2026
419aa6f
eval: cell table -- rename Cell to TableCell, restore schedule includes
evaleev Sep 3, 2026
56b15ae
eval: static cell-table validator (visibility, form, chain, life, uni…
evaleev Sep 3, 2026
e4b383c
eval: cell-table validator: residency-aware visibility, precise form …
evaleev Sep 3, 2026
8c8dad4
eval: derive cells (Build, Assemble, Leaf) from an ordered schedule
evaleev Sep 3, 2026
26f08f5
eval: cell table: implicit per-batch Build cells for escaping values,…
evaleev Sep 3, 2026
5d5eda8
eval: cell table: shared Build-cell emission, non-vacuous derivation …
evaleev Sep 3, 2026
28dd80a
eval: cell-table reads (per DAG edge, declared slices) and lives
evaleev Sep 3, 2026
7879d7a
eval: cell table: explicit invariant reads in the form rule
evaleev Sep 3, 2026
065ea5b
eval: cell table: kind-based residency, multiplicity against residenc…
evaleev Sep 3, 2026
8aac33d
tests: gate the w20 walk on a valid cell table; characterize the inpu…
evaleev Sep 3, 2026
f943c7f
eval: split cell table builder from types and validator
evaleev Sep 3, 2026
b7bb991
eval: cell table: per-leg reads, form rule over bound instances, chai…
evaleev Sep 3, 2026
56ab70b
tests: include <memory> and document the per-leg operand helper's cap…
evaleev Sep 3, 2026
cd3bfc1
tests: hidden characterization dump for mixed-pass members of a force…
evaleev Sep 3, 2026
d4ca798
eval: cell table: an escape chain may skip an invariant level (source…
evaleev Sep 3, 2026
e27ec25
eval: materialize a mixed-pass member across a forced split (build an…
evaleev Sep 3, 2026
dfdde0a
eval: forced-split materialization: guards, complete chain, loud clos…
evaleev Sep 3, 2026
aaade1f
eval: ordered executor builds and asserts the cell table before evalu…
evaleev Sep 3, 2026
5cc9cdc
eval: cell registry and table-driven operand reads in the ordered exe…
evaleev Sep 3, 2026
5f3752a
eval: cell registry: residency lookup, persistent seeding, strict rea…
evaleev Sep 3, 2026
607d4da
eval: delete the loop-colored slice seam and consumer oracle; reads c…
evaleev Sep 3, 2026
965e420
eval: a table read that spends a cell's last life hands over sole own…
evaleev Sep 3, 2026
6137675
eval: mark the nested-array sum defect, pin the release-at wiring, ti…
evaleev Sep 3, 2026
df50ef4
eval: serve a leaf's first touch through its read; spend table lives …
evaleev Sep 3, 2026
e6c00dc
eval: execute the mirrored configuration in the suite; tidy the read …
evaleev Sep 3, 2026
6f5d478
eval: persistent value store on the cache handle (survives reset, key…
evaleev Sep 4, 2026
1ad59b7
eval: cell registry owns results (bytes, fill-once, persistent store …
evaleev Sep 4, 2026
57a1aa2
eval: in-place eligibility from table lives; registry bytes in the pe…
evaleev Sep 4, 2026
6f5e184
eval: build and root steps on cells; cache-halt from the persistent s…
evaleev Sep 4, 2026
437c0ec
eval: assemble steps over cells replace block outputs, home walk and …
evaleev Sep 4, 2026
8a0bf94
eval: cells hold the canonical orientation; skipped consumers forgo t…
evaleev Sep 4, 2026
7d2a47c
eval: re-seed the produce-if-absent skip per batch; root residency by…
evaleev Sep 4, 2026
9c48892
eval: delete the value-keyed cache machinery from the batched path (h…
evaleev Sep 4, 2026
ec70629
eval: root results never alias the persistent store; persistence is t…
evaleev Sep 4, 2026
4866084
eval: delete the unreachable read-from-home path; tidy comments, asse…
evaleev Sep 4, 2026
44644fc
eval: clone only the first forest root at the combine read
evaleev Sep 4, 2026
6cd3b44
eval: delete the dead home-reads bookkeeping, cache seeding probes an…
evaleev Sep 4, 2026
5446857
eval: the cache key is the node; delete the value-id slice coloring
evaleev Sep 4, 2026
feca577
eval: cache_manager comment: the cache map holds node-keyed identity
evaleev Sep 4, 2026
ef29f67
eval: final-review fixes for stage 4: per-manager fill-once strictnes…
evaleev Sep 4, 2026
26c930d
eval: dump-only diagnostic for an incomplete escape chain at a forced…
evaleev Sep 4, 2026
bae2c39
eval: forced_split_levels: pass levels from the dependency graph
evaleev Sep 8, 2026
443eb80
eval: forced_split_levels: gate the equivalence case on real w20 aux+…
evaleev Sep 8, 2026
c6fd0d9
eval: forced_split_levels: extract shared water-20 aux+occ fixture he…
evaleev Sep 8, 2026
f390ad2
eval: forced split realized per nest with pass levels; rule 4 measure…
evaleev Sep 8, 2026
d11b3a4
eval: fix round 1 for per-nest forced split (root-level pass meta, ge…
evaleev Sep 8, 2026
1841fbf
eval tests: per-nest split fixtures: two nests, three passes, the two…
evaleev Sep 8, 2026
d2bc08c
eval tests: derive and validate a cell table for the two-nest per-nes…
evaleev Sep 8, 2026
024ffaa
eval: rule-4 reader test uses production site, not LoopLocal-only hom…
evaleev Sep 8, 2026
3adc649
eval: delete the two-set split partition and the demotion hook; pass-…
evaleev Sep 8, 2026
0f0cbb9
eval tests: the invariant-escape case pins fill-once, not a vestigial…
evaleev Sep 8, 2026
1d7acb9
eval: final-review fixes: unresolved slots never guessed, loud cycle …
evaleev Sep 8, 2026
6f930aa
eval tests: retarget the outside-nest fixture, use the cache handle's…
evaleev Sep 8, 2026
7509b0d
external: bump TiledArray to 55795e180 (arena ToT in-place add keeps …
evaleev Sep 8, 2026
2410895
tiledarray backend: the nested-array sum's known-defect note is retir…
evaleev Sep 8, 2026
156bbaf
external: bump TiledArray to fa932c076 (arena ToT follow-ups; scaled …
evaleev Sep 8, 2026
a1d26c5
ordered executor: reject a table with several persistent cells of one…
evaleev Sep 8, 2026
ec9022d
eval: a mixed-pass member escapes at the instances it is sliced by; r…
evaleev Sep 8, 2026
d51099f
tests: hidden dot-dump utility: the residual forest and its value DAG…
evaleev Sep 8, 2026
a61f5e5
eval: fix round 1 -- restore rule-4 scatter dominance and the tripwir…
evaleev Sep 8, 2026
9e47b8d
tests: dot-dump: label the roots, collapse only Sum-under-Sum links, …
evaleev Sep 8, 2026
898652a
eval: scope the outside-nest tripwire's exemption to the unescaped lo…
evaleev Sep 8, 2026
860e08d
ordered schedule: reject a same-pass reader of a reduction inside its…
evaleev Sep 8, 2026
89f30eb
cell registry: SEQUANT_UT_READ_DIAG prints every table-driven read (c…
evaleev Sep 8, 2026
7530aa3
eval: a reduction read inside its own loop forces a later pass; level…
evaleev Sep 8, 2026
e72797f
eval: a batched reduction always owns a loop identity; escape placeme…
evaleev Sep 8, 2026
ee0440b
eval: scope reduction-node seeding to true Reduction axes; pin the th…
evaleev Sep 8, 2026
9ec272a
eval: batch-scope caches inherit the shaped-product hook; shaped emis…
evaleev Sep 9, 2026
40d8506
bump TiledArray pin to 15b0ad705 (arena scale fast paths serve both o…
evaleev Sep 9, 2026
ff2a6e6
tests: dry-run 2-iteration report slices at the policy's per-axis tar…
evaleev Sep 9, 2026
2e126c8
diag: [READ] names the consumer (value, kind, depth); report dumps va…
evaleev Sep 9, 2026
d0e8919
tests: dry-run report can declare the occupied space contracted-batch…
evaleev Sep 9, 2026
82fa90d
eval: contracted occupied loops in the ordered schedule -- per-axis r…
evaleev Sep 10, 2026
b6ebcfd
eval: value identity = node id + home-sliced positions over the produ…
evaleev Sep 10, 2026
0e5bf48
eval: a value escapes through loops it is invariant on (explicit-cell…
evaleev Sep 10, 2026
7c83488
eval: loop identity from occurrences, value identity from loop identi…
evaleev Sep 10, 2026
994716c
eval: legality reads batched-ness off the occurrence's own home; read…
evaleev Sep 10, 2026
d0301a6
eval: SEQUANT_DUMP_SCHEDULE also dumps the built block tree (depth, a…
evaleev Sep 10, 2026
166fc77
eval: an external loop instance and a contracted one never fold (comp…
evaleev Sep 10, 2026
392b140
eval: nesting order is a fold constraint (compute_dag_boulevard inner…
evaleev Sep 10, 2026
bb06763
bump TiledArray pin to 58acda635 (master: conversions sub-world fence…
evaleev Sep 10, 2026
751d5e0
tests: dry-run report prints the realized roofline exec cost and exec…
evaleev Sep 11, 2026
a8d3100
optimize: batched DP charges a loop-bound persistent subtree as often…
evaleev Sep 11, 2026
3b9e4e5
eval: ordered executor applies the backend scope guard per block; K-b…
evaleev Sep 12, 2026
442c419
optimize: the batched DP opens external loops per node on the ordered…
evaleev Sep 12, 2026
12b29c1
tests: TA fixtures derive array modes from canon_indices(); yield lay…
evaleev Sep 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ set(SeQuant_eval_src
SeQuant/core/eval/eval_expr.hpp
SeQuant/core/eval/eval_node.hpp
SeQuant/core/eval/eval_node_compare.hpp
SeQuant/core/eval/node_batch_annotation.hpp
SeQuant/core/eval/result.cpp
SeQuant/core/eval/result.hpp
SeQuant/core/eval/fwd.hpp
Expand Down
Binary file added SeQuant/.DS_Store
Binary file not shown.
115 changes: 114 additions & 1 deletion SeQuant/core/batch_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,64 @@

#include <cstddef>
#include <functional>
#include <limits>

namespace sequant {

class Index;
class Tensor;

/// The three RUNTIME EXECUTION MODELS for batched evaluation (Task 6 of the
/// whole-scope batched DAG execution design, `doc/dev/specs/2026-08-10-
/// whole-scope-batched-dag-execution-design.md`, plus its SP3 follow-on
/// `doc/dev/specs/2026-08-05-dryrun-wetrun-schedule-equivalence-design.md`,
/// the ordered-scope batched-eval design):
/// - \c forest_descent (default): one tree at a time,
/// `sequant::evaluate(Nodes const&, ...)`, unchanged.
/// - \c whole_scope: one fused scope-tree walk over the whole forest,
/// `sequant::eval::evaluate_whole_scope`, so a value shared across trees
/// is built once per home block and reused, rather than rebuilt per tree.
/// - \c ordered: driven by the SP2 `eval::OrderedSchedule` IR rather than
/// the narrow `ScopeSchedule` scope tree,
/// `sequant::eval::evaluate_ordered_schedule`.
enum class BatchScheduler { forest_descent, whole_scope, ordered };

/// One batchability policy shared by the single-term optimizer and the runtime
/// batched evaluator (make_evaluator, Task A3). All predicates default empty.
struct BatchPolicy {
std::function<bool(Index const&)> is_batchable_index = {};
/// Spaces batchable in the CONTRACTED role: a mode of such a space is
/// batchable where it is summed. Companion to \ref
/// is_batchable_external_index (the EXTERNAL role). Splitting batchability by
/// role lets a caller admit a space only where batching it is meaningful --
/// e.g. a space batchable only as an external spectator contributes none of
/// its contracted occurrences to the optimizer's 2^m search. Building block;
/// the derived "batchable in any role" query is \ref is_batchable_index().
/// Defaults to decline every index; a caller opts spaces in explicitly.
std::function<bool(Index const&)> is_batchable_contracted_index =
[](Index const&) { return false; };
/// Spaces batchable in the EXTERNAL role: a mode of such a space is batchable
/// where it is open on the term root (a spectator carried to the result), not
/// where it is contracted. Building block; declared adjacent to its
/// contracted companion. Defaults to decline every index; a caller that wants
/// external batching sets this predicate explicitly (there is no fallback to
/// the contracted role).
std::function<bool(Index const&)> is_batchable_external_index =
[](Index const&) { return false; };

/// Derived "batchable in ANY role": the union of the two building-block
/// predicates. This is NEVER a settable field -- it is computed from
/// \ref is_batchable_contracted_index and \ref is_batchable_external_index.
/// The runtime batched evaluator's accept predicate is this union (a mode is
/// accepted at runtime if it is batchable in either role); the factorizer's
/// role filters instead consume the individual building blocks. The building
/// blocks default-decline, so both are always callable here.
std::function<bool(Index const&)> is_batchable_index() const {
auto contracted = is_batchable_contracted_index;
auto external = is_batchable_external_index;
return [contracted, external](Index const& ix) {
return contracted(ix) || external(ix);
};
}
/// Per-index per-batch slice size (in elements) for a batchable index -- an
/// UPPER BOUND, not a goal. Both the single-term optimizer and the runtime
/// batched evaluator treat it as a ceiling: the realized whole-tile batch is
Expand All @@ -21,6 +69,41 @@ struct BatchPolicy {
std::function<std::size_t(Index const&)> batch_target_size = {};
std::function<bool(Tensor const&)> is_volatile_leaf = {};

/// If true, an external/spectator index -- open on the whole network's result
/// yet contracted at no node -- is eligible for batching; its per-slice size
/// comes from \c batch_target_size(ix) like any batchable index. Default
/// false = no spectator batching (byte-identical to non-spectator behavior).
/// Necessary but not sufficient: spectator axes are emitted only under a
/// TIME-FIRST objective (DenseTimeSpaceBatched) and only when the selected
/// root's modeled peak exceeds \c peak_threshold. Spectator batching is
/// therefore currently unavailable under the space-first objectives.
bool batch_spectator_indices = false;

/// Enable the order-aware multilevel recompute cost model (resident-scan peak
/// + ordered-key flops recompute). SELECTION knob ONLY: it makes the DP
/// charge recompute realistically and thus pick a different (better-batching)
/// factorization. It does NOT control external-mode EMISSION -- that is the
/// independent \ref node_level_placement. Consulted only by the batched
/// objectives (threaded via CostParams). Default TRUE: the recompute-aware
/// model is the more realistic cost for selection. This is SAFE precisely
/// because it is now selection-only -- the node-level emission it used to
/// force is separately gated by \ref node_level_placement (default off), so
/// the emission stays the correct, cheap root-level forest seed. (Before the
/// decouple, defaulting this true forced the node-level runtime regression.)
bool order_aware_recompute = true;

/// Emission-placement knob for external (spectator) modes, INDEPENDENT of the
/// order-aware cost model. Only meaningful with \ref batch_spectator_indices.
/// If true, the emit uses node-level placement (per-node External stamps); if
/// false (default) it uses the root-level forest seed (one global spectator
/// loop). Node-level placement is currently a net runtime REGRESSION -- ~6x
/// wall time and ~8x batch scopes on water-8, and it produces a wrong
/// residual on water-20 -- because it nests a batch scope at every carrying
/// node and the batched evaluator replays each. It stays OFF by default until
/// that is fixed; the root-seed emission is correct and cheap regardless of
/// order_aware_recompute.
bool node_level_placement = false;

/// If true, restrict batching to persistent (amplitude-independent) subtrees,
/// declining to batch any subtree that contains a volatile leaf. If false
/// (the default), batch ACROSS THE BOARD: slicing the batch axis shrinks any
Expand All @@ -40,6 +123,36 @@ struct BatchPolicy {
/// accumulator + contribution co-residency of a node that contracts a
/// batchable index.
double accumulation_factor = 0.0;

/// Selects among the three runtime execution models (\ref BatchScheduler
/// above). Consulted by the
/// `sequant::evaluate(Nodes const&, BatchPolicy const&, ...)` driver
/// overload (`scope_executor.hpp`) to select the driver, and by
/// `sequant::eval::dryrun::cost_profile()` to select the matching peak
/// model: the co-residency oracle (`peak_profile_sweep` over `home_modes`)
/// for \c whole_scope, since that model is what predicts the whole-scope
/// realized peak, vs the batched-scratch replay high-watermark (models
/// forest descent) for \c forest_descent. Default \c forest_descent
/// reproduces today's behavior on every existing call site byte-for-byte.
BatchScheduler scheduler = BatchScheduler::forest_descent;

/// Peak-memory budget in BYTES for the batched objectives. Its meaning
/// DIFFERS between them:
///
/// - SPACE-FIRST (DenseSpaceTimeBatched): a hard feasibility gate. The
/// single-term optimizer minimizes flops among schedules whose modeled peak
/// is <= peak_threshold, falling back to min-peak (best effort) when none
/// fit. Default +infinity => every schedule feasible => min flops => no
/// batching, i.e. here a finite value is the *enable* trigger for batching.
///
/// - TIME-FIRST (DenseTimeSpaceBatched): NOT a feasibility gate. Root
/// selection ignores it entirely (peak breaks exact flop ties only), so it
/// can neither constrain the schedule's peak nor enable CONTRACTED-axis
/// batching (which is emitted regardless). Its ONLY effect is to trigger
/// EXTERNAL (spectator) axis emission, together with
/// \c batch_spectator_indices: axes are emitted iff the selected root's
/// modeled peak exceeds this threshold.
double peak_threshold = std::numeric_limits<double>::infinity();
};

} // namespace sequant
Expand Down
20 changes: 16 additions & 4 deletions SeQuant/core/binary_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,23 @@ class FullBinaryNode {
/// \return Size of the tree rooted at this node
///
[[nodiscard]] std::size_t size() const {
if (leaf()) {
return 1;
// Iterative (explicit stack) node count: recursing left().size() +
// right().size() would descend to the tree's depth and overflow the C++
// call stack on a deep tree -- e.g. the left-folded Sum-tree binarize
// builds for a Sum with thousands of summands (mirrors the iterative
// destructor / deep_copy above; the recursive form also made this an
// O(N)-deep call on every use, e.g. each equality comparison's size check).
std::size_t n = 0;
std::vector<FullBinaryNode const*> stk;
stk.push_back(this);
while (!stk.empty()) {
FullBinaryNode const* cur = stk.back();
stk.pop_back();
++n;
if (cur->left_) stk.push_back(cur->left_.get());
if (cur->right_) stk.push_back(cur->right_.get());
}

return left().size() + right().size() + 1;
return n;
}

///
Expand Down
56 changes: 56 additions & 0 deletions SeQuant/core/eval/backend_array_ops.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef SEQUANT_EVAL_BACKEND_ARRAY_OPS_HPP
#define SEQUANT_EVAL_BACKEND_ARRAY_OPS_HPP

#include <SeQuant/core/container.hpp>
#include <SeQuant/core/eval/result.hpp>
#include <SeQuant/core/index.hpp>

#include <cstddef>
#include <functional>
#include <utility>

namespace sequant {

/// \brief Backend-provided realizations of the two operations external-axis
/// batching needs but that are backend-specific: constructing a zero
/// destination array and chunking an axis into batches.
///
/// \details The neutral eval layer names only INDICES (which carry their
/// spaces); the backend (the "user", e.g. mpqc) supplies these closures, so no
/// backend artifact -- a TiledArray tiling has no meaning for, say, an on-disk
/// backend -- ever leaks into the eval layer.
///
/// This replaces the old "carrier" model, in which the batched executor
/// borrowed an axis's tiling from whichever array in the DAG happened to carry
/// it (\c Result::pre_sized_zeros_over_mode / \c Result::mode_batches) and then
/// had to reconcile that array's Result TYPE and mode ordinal against the
/// scatter destination's. Tiling is a property of the space, not of any one
/// array, so it is sourced once, backend-side, from the index alone.
struct BackendArrayOps {
/// Construct a sufficiently-initialized ZERO result shaped by \p descriptor
/// -- a FULL (unsliced) index list, e.g. a node's \c canon_indices(). The
/// backend maps each index's space to its own artifact and applies its own
/// outer/inner split for proto-bearing (nested) indices, so flat-vs-nested
/// is decided by the descriptor, not by any type reconciliation here.
/// "Sufficiently initialized" is backend-defined (TA: a World + TiledRange,
/// zero-filled; a nested result gets empty inner tiles, filled by the
/// subsequent scatter writes).
std::function<ResultPtr(container::vector<Index> const& descriptor)>
make_zeros;

/// Enumerate the half-open [lo,hi) element ranges chunking \p axis at
/// ~\p target_batch_size. The backend owns the chunking rule (TA lands on
/// tile boundaries). Per-space: two indices of one space chunk identically.
std::function<container::svector<std::pair<std::size_t, std::size_t>>(
Index const& axis, std::size_t target_batch_size)>
axis_batches;

/// True iff both closures are installed (a batched run requires them).
explicit operator bool() const noexcept {
return static_cast<bool>(make_zeros) && static_cast<bool>(axis_batches);
}
};

} // namespace sequant

#endif // SEQUANT_EVAL_BACKEND_ARRAY_OPS_HPP
6 changes: 6 additions & 0 deletions SeQuant/core/eval/backends/btas/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,12 @@ class ResultTensorBTAS final : public Result {
return eval_result<ResultTensorBTAS<T>>(std::move(pre));
}

/// Deep copy: the backing tensor type owns its elements, so its copy
/// constructor already produces an independently owned buffer.
[[nodiscard]] ResultPtr clone() const override {
return eval_result<ResultTensorBTAS<T>>(get<T>());
}

[[nodiscard]] ResultPtr permute(
std::array<std::any, 2> const& ann) const override {
auto const pre_annot = std::any_cast<annot_t>(ann[0]);
Expand Down
Loading
Loading