Kernel classes#
-
class AbsKernel : public ONNX_LIGHT_NAMESPACE::core::runtime::KernelBase#
SIMD-accelerated onnx-light kernel for the ONNX
Absoperator.AbsKernelderives from onnx-light’s :cpp:class:onnx_light::core::runtime::KernelBaseso it plugs into the runtime exactly like a built-in kernel: the dispatch table constructs it once per node and calls :cpp:func:Runon every execution. The computation uses private SIMD dispatch for every supported numeric type. Float16 and bfloat16 share the exact sign bit clearing path, while signed integers use width-specific SIMD absolute value operations.Public Functions
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
Reads the node’s single input, computes the elementwise absolute value and stores the single output back into
rt.
-
ONNX_LIGHT_NAMESPACE::core::runtime::Tensor operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext *rt = nullptr) const#
Allocates a fresh output tensor and writes
|x|into it.When
rtis non-null its allocator backs the output buffer.
-
void operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &output) const#
Writes
|x|into the caller-suppliedoutputtensor, whosedata_type,shapeand buffer size must already matchx.
Public Static Attributes
-
static constexpr const char *kName = "onnx_light_cpu::Abs"#
Library-qualified name identifying this kernel, recorded through :cpp:func:
RecordKernelUsageon every :cpp:func:Runso callers can tell the onnx-light-cpu kernel apart from onnx-light’s built-inAbs.
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
-
class ExpKernel : public ONNX_LIGHT_NAMESPACE::core::runtime::KernelBase#
SIMD-accelerated onnx-light kernel for the ONNX
Expoperator.ExpKernelderives from onnx-light’s :cpp:class:onnx_light::core::runtime::KernelBaseso it plugs into the runtime exactly like a built-in kernel: the dispatch table constructs it once per node and calls :cpp:func:Runon every execution. The computation uses private SIMD dispatch forfloat32/float64directly;float16andbfloat16use vector conversion blocks around the same float32 approximation.Public Functions
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
Reads the node’s single input, computes the elementwise exponential and stores the single output back into
rt.
-
ONNX_LIGHT_NAMESPACE::core::runtime::Tensor operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext *rt = nullptr) const#
Allocates a fresh output tensor and writes
exp(x)into it.When
rtis non-null its allocator backs the output buffer.
-
void operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &output) const#
Writes
exp(x)into the caller-suppliedoutputtensor, whosedata_type,shapeand buffer size must already matchx.
Public Static Attributes
-
static constexpr const char *kName = "onnx_light_cpu::Exp"#
Library-qualified name identifying this kernel, recorded through :cpp:func:
RecordKernelUsageon every :cpp:func:Runso callers can tell the onnx-light-cpu kernel apart from onnx-light’s built-inExp.
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
-
class LogKernel : public ONNX_LIGHT_NAMESPACE::core::runtime::KernelBase#
SIMD-accelerated onnx-light kernel for the ONNX
Logoperator.LogKernelmirrors :cpp:class:ExpKernel, using private SIMD dispatch forfloat32/float64, a scalar exact FP16 path, and vector conversion blocks forbfloat16.Public Functions
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
Reads the node’s single input, computes the elementwise natural logarithm and stores the single output back into
rt.
-
ONNX_LIGHT_NAMESPACE::core::runtime::Tensor operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext *rt = nullptr) const#
Allocates a fresh output tensor and writes
log(x)into it.When
rtis non-null its allocator backs the output buffer.
-
void operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &output) const#
Writes
log(x)into the caller-suppliedoutputtensor, whosedata_type,shapeand buffer size must already matchx.
Public Static Attributes
-
static constexpr const char *kName = "onnx_light_cpu::Log"#
Library-qualified name identifying this kernel, recorded through :cpp:func:
RecordKernelUsageon every :cpp:func:Runso callers can tell the onnx-light-cpu kernel apart from onnx-light’s built-inLog.
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
-
class GemmKernel : public ONNX_LIGHT_NAMESPACE::core::runtime::KernelBase#
SIMD-accelerated onnx-light kernel for the ONNX
Gemmoperator.GemmKernelderives from onnx-light’s :cpp:class:onnx_light::core::runtime::KernelBaseso it plugs into the runtime exactly like a built-in kernel: the dispatch table constructs it once per node and calls :cpp:func:Runon every execution. The computation(whereY = alpha * op(A) @ op(B) + beta * C
op(X)transposesXwhen the correspondingtransA/transBattribute is set) uses private register-blocked SIMD dispatch forfloat32andfloat64.float16andbfloat16inputs are accumulated infloat32and rounded back down for the output, matching common fp16/bf16 GEMM backend conventions. The optional biasCis consumed directly as a scalar, row, column, or matrix view without materializing an expandedM x Ntensor. FP16/BF16 narrowing is combined with the bias epilogue.Public Functions
-
explicit GemmKernel(const ONNX_LIGHT_NAMESPACE::core::runtime::KernelContext &ctx)#
Constructs the kernel and eagerly allocates the immutable-plan cache so no per-run lazy initialization (and its data race) is needed.
-
~GemmKernel() override#
Declared so the
std::unique_ptrto the incomplete plan cache can be destroyed where the cache type is complete (in the translation unit).
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
Reads the node’s
A,Band optionalCinputs together with thealpha,beta,transAandtransBattributes, computes the general matrix multiplication and stores the single output back intort.
-
ONNX_LIGHT_NAMESPACE::core::runtime::Tensor operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &a, const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &b, const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &c, float alpha, float beta, bool trans_a, bool trans_b, ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext *rt = nullptr) const#
Allocates a fresh output tensor and writes
alpha * op(A) @ op(B) + beta * Cinto it, broadcasting the biascto theM x Noutput shape.When
rtis non-null its allocator backs the output buffer.
-
ONNX_LIGHT_NAMESPACE::core::runtime::Tensor operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &a, const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &b, float alpha, bool trans_a, bool trans_b, ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext *rt = nullptr) const#
Same as above but for a
Gemmnode without a bias input: allocates a fresh output tensor and writesalpha * op(A) @ op(B)into it.
Public Static Functions
-
static std::int64_t ActiveInstanceCountForTesting() noexcept#
Returns the number of live instances in this library.
Intended for lifecycle regression tests that verify lazy backend-test registration.
Public Static Attributes
-
static constexpr const char *kName = "onnx_light_cpu::Gemm"#
Library-qualified name identifying this kernel, recorded through :cpp:func:
RecordKernelUsageon every :cpp:func:Runso callers can tell the onnx-light-cpu kernel apart from onnx-light’s built-inGemm.
-
explicit GemmKernel(const ONNX_LIGHT_NAMESPACE::core::runtime::KernelContext &ctx)#
-
class NotKernel : public ONNX_LIGHT_NAMESPACE::core::runtime::KernelBase#
SIMD-accelerated onnx-light kernel for the ONNX
Notoperator.NotKernelderives from onnx-light’s :cpp:class:onnx_light::core::runtime::KernelBaseso it plugs into the runtime exactly like a built-in kernel: the dispatch table constructs it once per node and calls :cpp:func:Runon every execution. The computation uses private SIMD dispatch. ONNXNotonly acceptsboolinputs, so the kernel is a full drop-in replacement for the built-in one.Public Functions
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#
Reads the node’s single input, computes the elementwise logical negation and stores the single output back into
rt.
-
ONNX_LIGHT_NAMESPACE::core::runtime::Tensor operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext *rt = nullptr) const#
Allocates a fresh output tensor and writes
!xinto it.When
rtis non-null its allocator backs the output buffer.
-
void operator()(const ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &x, ONNX_LIGHT_NAMESPACE::core::runtime::Tensor &output) const#
Writes
!xinto the caller-suppliedoutputtensor, whosedata_type,shapeand buffer size must already matchx.
Public Static Attributes
-
static constexpr const char *kName = "onnx_light_cpu::Not"#
Library-qualified name identifying this kernel, recorded through :cpp:func:
RecordKernelUsageon every :cpp:func:Runso callers can tell the onnx-light-cpu kernel apart from onnx-light’s built-inNot.
-
void Run(ONNX_LIGHT_NAMESPACE::core::runtime::RuntimeContext &rt) override#