Repository navigation
Kernel compilation details
Implementation reference checked against f5e786f. Fundamental explanations remain in docs/arch.
TGeneratedKernel and TKernelSlot are declared in
generated.h. Generation records the AST, named
entrypoints, referenced payload storage, execution-stage identity, and a slot.
Slot function order matches Entrypoints; the slot retains the runner and,
on the cached path, a separate JIT lifetime owner.
TKernelCompiler::EmitKernel appends to the configured sink. With BindNow
it binds immediately; normal lowering sets it false and finalizes the collected
query programs later. Stage is diagnostic, while ExecStageId is the identity.
Sort key and aggregate output-layout metadata accompany the generated program.
JitFinalizeKernels deduplicates AST/entrypoint
specifications, builds a fused program, binds entries, and retains payloads and
external runtime ownership. QDB_JIT_CACHE_DIR enables the native object cache.
Referenced external modules currently bypass that cache path. A warm cache
still leaves frontend and query-specific compilation/linking work.
The browser finalizer in plan_export.cpp exports a query-level wasm64 artifact and stage entrypoint map. It uses Memory64, without a wasm32 ABI fallback. Export does not execute the native graph.
- Physical graph JSON attaches kernel artifacts to semantic task groups by
ExecStageId. Scheduler-only plumbing has separate monotonically assignedtask:<id>groups; debug strings are display-only. -
BuildExecPlancollapses physical lanes and contracts plumbing using stable stage/input IDs, producing an exporter-neutral typed DAG. - The exec JSON codec indexes kernels by
ExecStageId; stage entrypoints and physical graph artifacts therefore refer to kernels emitted by the same scheduler lowering. Sort stages takeradixKeysdirectly from retained kernel metadata. Nothing is lowered or compiled twice.