Expand description
Metadata-only rewrite rules for the optimizer (Layers 1 and 2 of the execution model).
Reduce rules are the cheapest transformations in the execution pipeline: they operate purely on array structure and metadata without reading any data buffers.
There are two kinds of reduce rules:
-
ArrayReduceRule(Layer 1) – a self-rewrite where an array simplifies itself. Example: aFilterArraywith an all-true mask removes the filter wrapper. -
ArrayParentReduceRule(Layer 2) – a child-driven rewrite where a child rewrites its parent. Example: aDictArraychild of aScalarFnArraypushes the scalar function into the dictionary values.
Reduce rules are collected into a ReduceRuleSet per encoding. Parent-reduce rules are
registered with the session’s ArrayKernels for
each (parent, child) pair they apply to. The optimizer evaluates both in a fixpoint loop until
no more rules apply.
Structs§
- Reduce
Rule Set - A collection of
ArrayReduceRules registered for a specific encoding.
Traits§
- Array
Parent Reduce Rule - A metadata-only rewrite rule where a child encoding rewrites its parent (Layer 2).
- Array
Reduce Rule - A metadata-only rewrite rule that transforms an array based on its own structure (Layer 1).