Function sequant::eval::detail::apply_persistence_frontier¶
Defined in File cell_table_builder.hpp
Function Documentation¶
-
inline void sequant::eval::detail::apply_persistence_frontier(CellTable &table, std::function<bool(std::size_t)> const &volatile_of)¶
Demotes every persistence candidate (
set_residency_flags:no volatile leaf, bound to no enclosing loop) that is not on the frontier of the invariant region, so thatpersistent== carries no volatile leaf and is bound to no enclosing loop instance and (some consumer of it holds a volatile value or it has no consumer at all — a forest root; validator rule 4 admits a zero-consumer cell only at the root scope).The consumers of a cell are the consumer cells of every
Readwhosesourceis it, plus everyAssemblewhoseproduction.sourceis it — the same edge set the runtime’s cache-halt closure walks, by source cell and not by value, so the two cannot disagree about what reads a form.Why the frontier and not the whole invariant region: a persistent cell is held across evaluations and skipped by cache-halt on every later one. A non-volatile cell all of whose consumers are non-volatile is therefore never read again — each such consumer is itself either persistent-and-held (skipped by cache-halt rule 1) or demoted here and, by induction from the roots, skipped by rule 2 because all of its consumers are skipped. Keeping such a cell resident across evaluations buys nothing and costs its bytes in the persistent value store for the life of the cache handle. Only the cells feeding volatile work — and the forest’s own results — have a reader on a later evaluation.
Leaves follow the same rule: an input tensor whose every consumer is non-volatile is re-fetched on the (rare) evaluation that actually needs it rather than held forever.