kernel_dispatch_table.h#

onnx_extensions/kernels/kernel_dispatch_table.h declares onnx_light::onnx_kernels::RegisterKernelFunctions(), which populates onnx_core’s dispatch table (see ../../onnx_core/runtime/kernels/kernel_dispatch_table) with every built-in operator kernel and the SequenceMap output-packing callback.

Registers every onnx_kernels operator kernel (the built-in ai.onnx/ai.onnx.ml/ai.rt/… operator set) with the generic kernel dispatch table owned by onnx_core (:cpp:func:core::runtime::KernelDispatchTable).

The kernel implementations themselves stay in onnx_kernels, one per onnx_kernels/kernels/<domain>/kernel_<name>.cc file (except the control-flow kernels If/Loop/Scan, which live in onnx_core/runtime/kernels/controlflow since the runtime dispatcher needs to invoke them directly while recursively evaluating sub-graphs), and this translation unit is the single place that wires all of them into the shared registry via :cpp:func:RegisterKernelFunctions. Keeping the registration here (instead of in onnx_core) preserves the onnx_kernels -> onnx_core dependency direction: onnx_core never needs to know about onnx_kernels’s operator implementations.

namespace onnx_light

Alias that makes onnx-light headers compatible with code that references ONNX_LIGHT_NAMESPACE (the macro used in the standard onnx package).

Set to ONNX_LIGHT_NAMESPACE so both names resolve to the same namespace.

Symbol-visibility attribute for the public onnx-light C++ API.

Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when lib_onnx_proto uses hidden visibility by default.

Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal onnx namespace — rather than the ONNX_NAMESPACE macro — resolves to the onnx-light namespace. The standard onnx package lives in namespace onnx; onnx-light uses onnx_light (via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs from onnx.

namespace onnx_kernels#

Functions

void RegisterKernelFunctions()#

Registers every built-in onnx_kernels operator kernel with :cpp:func:core::runtime::RegisterKernelFn, and registers kernel::SequenceMap as the core::runtime SequenceMap output-packing callback (see :cpp:func:core::runtime::RegisterSequenceMapPackFn). Idempotent and cheap to call more than once (the actual registration work only happens once, guarded by a function-local static).

Unlike onnx_lib’s OpSchemaRegistry::map() (which can lazily self-register because both the accessor and the registration functions live in the same library), core::runtime::KernelDispatchTable() cannot do this: onnx_core must not depend on or call into onnx_kernels. lib_onnx_kernels is also a plain static archive, so a file-scope static object with no externally-referenced symbol is not reliably linked in either. Every entry point that runs a model (Python bindings, C++ unit tests, examples, fuzzers, …) must therefore call this function explicitly before calling :cpp:func:core::runtime::RunNode / running a :cpp:class:core::runtime::RuntimeSession.