Module kernel_audit

Module kernel_audit 

Source
Expand description

2026-09-26: The kernel-resolution audit: every lookup the CUDA backend’s GpuBackend::kernel(module, func) makes, whether it resolved, and the call site that issued it; plus the boot gate’s seal.

A failed optional lookup (try_kernel returns handle 0) raises no error by itself; the audit records it. The boot gate (serve_phases::kernel_gate::audit_and_gate) prints render_kernel_table and then calls seal. After the seal a failed lookup aborts the process or, with --dangerously-allow-unresolved-kernel-lookups, warns once per seal.

Owner: telemetry. Invariants: between seal and unseal, every failed lookup passed to record adds 1 to unresolved_lookups before anything else happens.

Structs§

AuditRow
2026-09-26: One deduped kernel-resolution row.
FailureSplit
2026-09-26: The failed lookups, split by whether the operator must act. The boot gate, its log table and the TUI kernel table all split through split_failures.

Functions§

audit_rows
2026-09-26: The resolution rows: one per (module, func), sorted, loaded true if any lookup of that pair resolved.
classify_failures
2026-09-26: Split audit_rows’s failures against a target’s [expected_absent] declaration (TargetPtxSet::expected_absent).
record
2026-09-26: Record one kernel lookup; the CUDA backend’s GpuBackend::kernel calls it.
render_kernel_table
2026-09-26: Render the embedded kernel set (embedded, the loaded target’s TargetPtxSet::modules) with each module’s resolution. set_hash is metrale_kernels::KERNEL_SET_HASH, shadowed_dropped fills the SHADOWED column, and expected_absent selects the failures listed as expected (via super::split_failures).
seal
2026-09-26: Seal the audit for this run. unresolved is the gate’s count of failed lookups not declared expected-absent; allow is --dangerously-allow-unresolved-kernel-lookups.
split_failures
2026-09-26: classify_failures over rows the caller already has.
unresolved_lookups
2026-09-26: Unresolved kernel lookups for the live model. /metrics exports it as metrale_kernel_lookups_unresolved.
unresolved_report
2026-09-26: The unresolved-lookup report: the numbered list of split.required, then the remediation paragraph once. allowed selects the closing paragraph: the offer to pass the allow flag, or, when it is already set, only the consequence.
unseal
2026-09-26: Re-open the audit for a new model load. Called from crate::run_metrics::reset_for_new_run.