Kernel registration#
When onnx-light-cpu is built with -DONNX_LIGHT_CPU_WITH_ONNX_LIGHT=ON
(which requires the onnx-light C++
package), it produces lib_onnx_light_cpu_kernels. Its runtime inventory is
available from CollectRegisteredKernels() and the generated
ByOp catalogue.
The integration links onnx_light::lib_onnx_kernels for Cast’s built-in
compatibility conversions, even when backend tests are disabled. Source
runtime builds find this library next to the selected core library;
ONNX_LIGHT_CPU_ONNX_LIGHT_KERNELS_LIBRARY can select it explicitly.
-
void onnx_light_cpu::RegisterAbsKernel()#
Registers the onnx-light-cpu
Abskernel into onnx-light’s sharedKernelDispatchTablefor the CPU device.After this call, every
Absnode dispatched by onnx-light’s runtime (RunNode/RuntimeSession, and therefore any model executed throughReferenceEvaluator) resolves to :cpp:class:AbsKernel, so any ONNX model usingAbsruns the SIMD-accelerated kernel. Registering under the default ONNX domain replaces the built-inAbsentry.
-
void onnx_light_cpu::RegisterExpKernel()#
Registers the onnx-light-cpu
Expkernel into onnx-light’s sharedKernelDispatchTablefor the CPU device.After this call, every
Expnode dispatched by onnx-light’s runtime (RunNode/RuntimeSession, and therefore any model executed throughReferenceEvaluator) resolves to :cpp:class:ExpKernel. Registering under the default ONNX domain replaces the built-inExpentry.
-
void onnx_light_cpu::RegisterLogKernel()#
Registers the onnx-light-cpu
Logkernel into onnx-light’s sharedKernelDispatchTablefor the CPU device, replacing the built-inLogentry with :cpp:class:LogKernel.
-
void onnx_light_cpu::RegisterGemmKernel()#
Registers the onnx-light-cpu
Gemmkernel into onnx-light’s sharedKernelDispatchTablefor the CPU device.After this call, every
Gemmnode dispatched by onnx-light’s runtime (RunNode/RuntimeSession, and therefore any model executed throughReferenceEvaluator) resolves to :cpp:class:GemmKernel, so any ONNX model usingGemmruns the SIMD-accelerated kernel. Registering under the default ONNX domain replaces the built-inGemmentry.
-
void onnx_light_cpu::RegisterGatherKernel()#
-
void onnx_light_cpu::RegisterCastKernel()#
-
void onnx_light_cpu::RegisterSliceKernel()#
-
void onnx_light_cpu::RegisterConcatKernel()#
-
void onnx_light_cpu::RegisterSplitKernel()#
-
void onnx_light_cpu::RegisterNotKernel()#
Registers the onnx-light-cpu
Notkernel into onnx-light’s sharedKernelDispatchTablefor the CPU device.After this call, every
Notnode dispatched by onnx-light’s runtime (RunNode/RuntimeSession, and therefore any model executed throughReferenceEvaluator) resolves to :cpp:class:NotKernel. Registering under the default ONNX domain replaces the built-inNotentry.
-
void onnx_light_cpu::RegisterAllKernels()#
Registers every shipped operator into onnx-light’s process-wide
KernelDispatchTablefor the CPU device.See :ref:
l-register-all-kernels-inventoryfor the complete family, domain, and operator table, validated againstCollectRegisteredKernels. The inventory coversai.onnx(also accepted as the empty domain),ai.onnx.ml, andcom.microsoft.Existing global entries are replaced. Register before nodes are resolved: already-resolved sessions retain cached factories, and session-local overrides take precedence. Use
RegisterAllKernelsForSessionto install the same operator set on oneRuntimeContextwithout changing global state, orRegisterAllKernelsGlobalfor explicit replacement control.This overload selects
MicrosoftKernelImplementation::OPTIMIZED. The policy overload can instead select the completeNAIVEMicrosoft reference family; it does not change the ONNX or ONNX-ML registrations. Optimized kernels may still use scalar fallbacks depending on types, shapes, build options, and available CPU instructions.
-
void onnx_light_cpu::RegisterAllKernels(MicrosoftKernelImplementation implementation)#
Registers all kernels, selecting the complete
com.microsoftfamily explicitly.The no-argument overload is equivalent to
OPTIMIZED.
-
bool onnx_light_cpu::RegisterKernelGlobal(const std::string &domain, const std::string &op_type, bool replace = true, MicrosoftKernelImplementation implementation = MicrosoftKernelImplementation::OPTIMIZED)#
Registers one shipped kernel in the process-wide dispatch table.
The empty domain and
"ai.onnx"are equivalent. Ifreplaceis false, an existing registration is retained and this function returns false. Unknown domain/operator pairs throwstd::invalid_argument.
-
std::size_t onnx_light_cpu::RegisterAllKernelsGlobal(bool replace = true, MicrosoftKernelImplementation implementation = MicrosoftKernelImplementation::OPTIMIZED)#
Registers every shipped kernel in the process-wide dispatch table.
Returns the number of factories installed. With
replacefalse, repeated calls are idempotent and return zero once all entries exist.
-
bool onnx_light_cpu::RegisterKernelForSession(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &session, const std::string &domain, const std::string &op_type, bool replace = true, MicrosoftKernelImplementation implementation = MicrosoftKernelImplementation::OPTIMIZED)#
Registers one shipped kernel only on
session.The session’s
RuntimeContextowns the registration. It takes precedence over global and built-in kernels for that session and is destroyed with the context. Ifreplaceis false, an existing session-local registration is retained and this function returns false. Native factories participate in RuntimeSession’s preparation and tuning lifecycle. The runtime retains the configured instances across runs; already-prepared sessions retain their instances after replacement.
-
std::size_t onnx_light_cpu::RegisterAllKernelsForSession(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &session, bool replace = true, MicrosoftKernelImplementation implementation = MicrosoftKernelImplementation::OPTIMIZED)#
Registers every shipped kernel only on
session.Returns the number of session-local registrations installed.
-
void onnx_light_cpu::RegisterMicrosoftKernels(MicrosoftKernelImplementation implementation)#
Registers exactly one implementation for every
com.microsoftoperator.