For contributors — how xlog’s factorized execution routes work internally. This
is not a usage guide.
Design Pattern
Every factorized route follows the same six-step pattern.- Recognize a rule shape that can avoid a large intermediate.
- Prove the needed key, width, and variable-layout constraints.
- Choose a compact representation.
- Run a CUDA route over that representation.
- Install the result only after row-set or aggregate parity is preserved.
- Fall back to the ordinary path (decline) when the contract is not met.
Aggregate-Fused WCOJ
A worst-case-optimal join (WCOJ) computes a multiway join pattern directly, without building the large intermediate table that a chain of binary joins would produce. The aggregate-fused variant handles grouped-aggregate shapes: it reduces values through CUDA kernels while grouping by one planned root variable (the grouping key the aggregate reduces by). The unfused path does three separate steps:- materialize all joined tuples;
- group by the root key;
- reduce values.
Free Join Frontiers
Free Join is a multiway-join method that binds one variable at a time. XLOG represents it as a frontier — a moving set of partial bindings — advancing over sorted range tries (prefix indexes whose nodes cover contiguous ranges of a column).- Relation columns are laid out so prefix probes can advance level by level.
- Each frontier level binds another variable, or proves that a branch has no compatible tuples.
- Identity groups and probe filters avoid unnecessary expansion.
- For variables private to one relation, count-by-root multiplies the remaining trie-range lengths instead of enumerating each full binding.
Recursive Delta Factorization
Recursive rules are evaluated by a semi-naive fixpoint loop: each round joins only the newly derived tuples (the delta) rather than the whole relation. Factorized recursive deltas target rules such as transitive closure — reachability over all chains of edges — where a delta join can produce many witnesses (many distinct derivations) for the same novel tuple.Inside the semi-naive loop, the delta join routes dense, sparse, or legacy based on domain size and byte budget — every route produces the same novel set.
Both factorized routes must produce the same novel set as the legacy recursive
path.
Loss Vetoes
Factorized execution is not always cheaper than the ordinary path. The cost model can veto a route in two cases:- available statistics show that the ordinary binary path should be cheaper; or
- no prefix-key-compatible Free Join order is viable.
Device And Host Boundaries
Control stays host-side. The executor chooses routes, owns the counters, and installs the resulting relation buffers. CUDA kernels own the data-plane work:- frontier expansion,
- grouped accumulation,
- dense bitvector novel-set computation,
- sparse hash-set novel-set computation.
Verification Obligations
Because a correct answer alone does not prove that a factorized CUDA path fired, a route is not considered complete until evidence shows all of the following.- Fallback parity: same result with the route disabled.
- The route’s dispatch counter increments with the route enabled.
- Unsupported shapes decline cleanly.
- Budget and overflow conditions fail closed.
- Recursive routes converge to the same full relation as the legacy path.
- Aggregate routes match the materialize-plus-groupby result.