Skip to main content

Module persistent_kernel_policy

Module persistent_kernel_policy 

Source
Expand description

Persistent-kernel-mode decision policy (ROADMAP D1). Decides whether to replace N small kernel launches with one persistent kernel that polls a device-side work queue, based on measured per-launch overhead and persistent-setup cost. Pure decision, no Program walk. D1 substrate: persistent-kernel-mode decision policy.

When a workload submits many small kernel launches with the same pipeline, the launch overhead dominates execution time (~5 µs per native launch, ~10–50 µs per portable queue submit). Replacing the N launches with ONE persistent kernel that polls a device-side work queue eliminates the per-launch cost entirely - a 100× speedup on workloads where kernel duration < 50 µs.

Persistent mode has a one-time setup cost (allocate the work queue, launch the persistent kernel, signal shutdown at the end). This amortises only when the batch is large enough. The decision policy here owns the threshold: given the measured per-launch overhead and per-item kernel duration, should the dispatcher run N standard launches or one persistent kernel?

Pure decision - no kernel launch, no Program walk. Caller passes the measurements; the substrate produces a verdict.

Structs§

PersistentKernelInputs
Inputs to the persistent-kernel decision.

Enums§

PersistentKernelDecision
Verdict returned by decide_persistent_kernel.

Functions§

decide_persistent_kernel
Decide whether to use persistent kernel mode for this batch.