vibespatial.runtime.crossover

Attributes

Classes

WorkloadShape

Classification of how left and right geometry arrays relate in size.

DispatchDecision

Enum where members are also (and must be) strings

CrossoverPolicy

Per-kernel crossover thresholds for AUTO dispatch.

Functions

detect_workload_shape(→ WorkloadShape)

Classify the workload shape for a binary operation.

default_crossover_policy(→ CrossoverPolicy)

select_dispatch_for_rows(→ DispatchDecision)

Select CPU or GPU execution based on row count and crossover policy.

Module Contents

class vibespatial.runtime.crossover.WorkloadShape

Classification of how left and right geometry arrays relate in size.

PAIRWISE: left and right have the same length; element-wise ops. BROADCAST_RIGHT: right has length 1, left has length > 1; the single

right geometry is broadcast against every left row.

SCALAR_RIGHT: right is a scalar (not an array); skips pandas index

alignment entirely.

BROADCAST_LEFT is intentionally omitted — no consumer exists today. INDEXED is intentionally omitted — gather-evaluate-scatter is a different computation model, not a workload shape.

PAIRWISE = 'pairwise'
BROADCAST_RIGHT = 'broadcast_right'
SCALAR_RIGHT = 'scalar_right'
vibespatial.runtime.crossover.detect_workload_shape(left_count: int, right_count: int | None) WorkloadShape

Classify the workload shape for a binary operation.

class vibespatial.runtime.crossover.DispatchDecision

Enum where members are also (and must be) strings

CPU = 'cpu'
GPU = 'gpu'
class vibespatial.runtime.crossover.CrossoverPolicy

Per-kernel crossover thresholds for AUTO dispatch.

auto_min_rows is the pairwise threshold (left and right have the same length). broadcast_min_rows is an optional lower threshold for broadcast workload shapes (BROADCAST_RIGHT / SCALAR_RIGHT) where the right-side geometry fits in L1 cache and is reused N times, making GPU profitable at much smaller N.

kernel_name: str
kernel_class: vibespatial.runtime.precision.KernelClass
auto_min_rows: int
reason: str
broadcast_min_rows: int | None = None
vibespatial.runtime.crossover.DEFAULT_CROSSOVER_POLICIES: dict[vibespatial.runtime.precision.KernelClass, int]
vibespatial.runtime.crossover.DEFAULT_BROADCAST_CROSSOVER_POLICIES: dict[vibespatial.runtime.precision.KernelClass, int]
vibespatial.runtime.crossover.default_crossover_policy(kernel_name: str, kernel_class: vibespatial.runtime.precision.KernelClass | str) CrossoverPolicy
vibespatial.runtime.crossover.select_dispatch_for_rows(*, requested_mode: vibespatial.runtime._runtime.ExecutionMode | str, row_count: int, policy: CrossoverPolicy, gpu_available: bool, workload_shape: WorkloadShape | None = None) DispatchDecision

Select CPU or GPU execution based on row count and crossover policy.

When workload_shape is BROADCAST_RIGHT or SCALAR_RIGHT, the effective threshold is policy.broadcast_min_rows (or policy.auto_min_rows // 10 if the policy does not set a broadcast threshold). This reflects the fact that broadcast workloads have perfect right-side data locality and benefit from GPU execution at much smaller N than pairwise workloads.