Skip to content

Register parent-reduce rules with the session kernels - #11092

Merged
robert3005 merged 6 commits into
developfrom
rk/session-parent-rules
Nov 9, 2026
Merged

robert3005 merged 6 commits into
developfrom
rk/session-parent-rules

Conversation

@robert3005

@robert3005 robert3005 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Parent-reduce rules move from static PARENT_RULES sets on the vtables into the session kernel registry, so the session controls all rules, as it already does for execute-parent kernels.

Changes

  • Each encoding registers its parent-reduce rules in its initialize function, through ArrayKernels::register_reduce_parent_rule. The registry keys the rules by the parent and child encoding ids. Rules for any scalar function use AnyScalarFn::id.
  • The optimizer reads only the registry. It skips the children of a parent for which no rule is registered.
  • ExecutionCtx takes a snapshot of the parent-reduce kernels when it is created, so optimizing with the context does not read the session again.

@robert3005
robert3005 added this pull request to stack #11093 November 2, 2026 12:06
@robert3005 robert3005 added the changelog/break A breaking API change label Nov 2, 2026
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch 2 times, most recently from 1364ff7 to 99ee78b Compare November 2, 2026 12:28
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch 2 times, most recently from be6bdae to 951db46 Compare November 2, 2026 15:11
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch 2 times, most recently from f6a5894 to a564054 Compare November 2, 2026 19:18
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from a564054 to cc7b45d Compare November 3, 2026 13:16
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from cc7b45d to 1d85ea1 Compare November 4, 2026 14:31
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from 1d85ea1 to d493f1f Compare November 4, 2026 15:29
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from d493f1f to aa27450 Compare November 4, 2026 18:30
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from aa27450 to 0adc708 Compare November 4, 2026 18:42
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from 0adc708 to 3894fcb Compare November 4, 2026 19:36
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from 3894fcb to 5402a3c Compare November 4, 2026 20:06
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/kernels.rs Resolved
Comment thread vortex-array/src/optimizer/mod.rs Resolved
Comment thread vortex-array/src/optimizer/mod.rs Resolved
Comment thread vortex-array/src/optimizer/mod.rs Resolved

@myrrc myrrc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can we please remove extra comments and make the function take an impl ScalarFnVtable instead of an Id so we'd have typecheck

Comment thread vortex-array/src/optimizer/kernels.rs Resolved
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from 0b47bf4 to eff0c36 Compare November 8, 2026 23:16
Base automatically changed from rk/deprecate-sessionless-optimize to develop November 9, 2026 00:03
robert3005 and others added 5 commits November 9, 2026 00:03
Each encoding now registers its parent-reduce rules with the session's
ArrayKernels through register_reduce_parent_rule, keyed by the parent and
child encoding ids, in place of a static PARENT_RULES set on its vtable.
Rules for any scalar function are keyed by AnyScalarFn::id. The vtable
reduce_parent hook and ParentRuleSet are removed.

The optimizer consults only the registry and skips the children of a
parent that no rule is registered for. An ExecutionCtx snapshots the
parent-reduce kernels when it is created, so optimizing with the context
does not read the session again.

The shared dictionary values of a chunked array are now pulled up by a
chunked reduce rule instead of a dict parent rule.

The deprecated session-less optimize now uses only the rules vortex-array
registers by default, and it does not mark its result as optimized.

Signed-off-by: Robert Kruszewski <[email protected]>
Create one execution context per sample and mark the input arrays as
optimized, so the timed loop measures the slice and its reduction rather
than the session lookup and the walk over the unmarked input.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Robert Kruszewski <[email protected]>
- register_reduce_parent_rule and register_scalar_fn_reduce_parent_rule
  take the parent vtable, such as Cast or Filter, instead of its Id.
- Remove the doc comments on the register_parent_rules functions.
- Keep the parent-reduce and execute-parent kernels each in one
  ArcSwap of a HashMap with boxed slices. Registration replaces the
  value with rcu.

Signed-off-by: Robert Kruszewski <[email protected]>
Callers pass each rule as a const { &rule } block, and the registry keeps a &'static dyn reference to it instead of an Arc.

Signed-off-by: Robert Kruszewski <[email protected]>
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from eff0c36 to 2ad02c8 Compare November 9, 2026 00:03
@robert3005
robert3005 enabled stacked auto-merge (squash) November 9, 2026 00:03
The ALP between rule is now registered with the session, not set on the
vtable. The benchmark session did not register ALP, so between decoded
the ALP array instead of pushing the bounds into the encoded integers.

Signed-off-by: Robert Kruszewski <[email protected]>
@robert3005
robert3005 force-pushed the rk/session-parent-rules branch from e8a9352 to 53a4f97 Compare November 9, 2026 00:09
@robert3005
robert3005 merged commit f39d5f7 into develop Nov 9, 2026
70 of 71 checks passed
@robert3005
robert3005 deleted the rk/session-parent-rules branch November 9, 2026 00:19
@connortsui20 connortsui20 mentioned this pull request Nov 12, 2026
12 of 49 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants