portable_parallel_tuning.h#

Defines

ONNX_LIGHT_REGISTER_PARALLEL_TUNING_SCHEMA(ClassName)#

Defines ClassName::RegisterTuningSchemas() for one ParallelTunableKernel subclass.

Expects kSupportedElementTypes, kPortableParallelMinimum, and kTuningAbi to be in scope at the point of invocation (typically declared in the kernel’s anonymous namespace, right above the macro invocation), and registers ClassName (stringified) as the schema name so it always matches the kernel’s class name.

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
namespace tuning

Functions

core::runtime::KernelTuningKey MakePortableTuningKey(std::string_view kernel, int32_t element_type, uint32_t tuning_abi = 1)#

Returns the tuning key for one portable onnx-light kernel implementation.

Returns: The exact key for kernel and element_type.

bool IsSupportedElementType(int32_t element_type, std::span<const int32_t> supported_element_types)#

Returns whether an element type is supported by a kernel.

Returns: true when element_type appears in supported_element_types.

void RegisterParallelTuningSchemas(std::string_view kernel, std::span<const int32_t> supported_element_types, int64_t portable_minimum_elements, uint32_t tuning_abi = 1)#

Registers one parallel tuning schema for every supported element type.

void ConfigureParallelTuning(std::string_view kernel, const core::runtime::KernelTuningParameters &parameters, ParallelTuning &tuning, uint32_t tuning_abi = 1)#

Validates and copies resolved parallel parameters into a typed configuration.

Variables

constexpr std::string_view kParallelMinimumElements = "parallel.minimum_elements"#
class ParallelTunableKernel : public onnx_light::core::runtime::KernelBase#
#include <portable_parallel_tuning.h>

Implements the shared runtime contract for one parallel-tunable kernel.

Subclassed by onnx_light::onnx_kernels::kernel::Acos, onnx_light::onnx_kernels::kernel::Acosh, onnx_light::onnx_kernels::kernel::AffineGrid, onnx_light::onnx_kernels::kernel::Asin, onnx_light::onnx_kernels::kernel::Asinh, onnx_light::onnx_kernels::kernel::Atan, onnx_light::onnx_kernels::kernel::Atanh, onnx_light::onnx_kernels::kernel::Attention, onnx_light::onnx_kernels::kernel::BatchNormalization, onnx_light::onnx_kernels::kernel::BitShift, onnx_light::onnx_kernels::kernel::BitwiseAnd, onnx_light::onnx_kernels::kernel::BitwiseOr, onnx_light::onnx_kernels::kernel::BitwiseXor, onnx_light::onnx_kernels::kernel::Cast, onnx_light::onnx_kernels::kernel::Ceil, onnx_light::onnx_kernels::kernel::Conv, onnx_light::onnx_kernels::kernel::ConvInteger, onnx_light::onnx_kernels::kernel::ConvTranspose, onnx_light::onnx_kernels::kernel::Cos, onnx_light::onnx_kernels::kernel::Cosh, onnx_light::onnx_kernels::kernel::DFT, onnx_light::onnx_kernels::kernel::Div, onnx_light::onnx_kernels::kernel::Equal, onnx_light::onnx_kernels::kernel::Erf, onnx_light::onnx_kernels::kernel::FlexAttention, onnx_light::onnx_kernels::kernel::Floor, onnx_light::onnx_kernels::kernel::GlobalAveragePool, onnx_light::onnx_kernels::kernel::GlobalLpPool, onnx_light::onnx_kernels::kernel::GlobalMaxPool, onnx_light::onnx_kernels::kernel::Greater, onnx_light::onnx_kernels::kernel::GreaterOrEqual, onnx_light::onnx_kernels::kernel::GroupNormalization, onnx_light::onnx_kernels::kernel::HardSwish, onnx_light::onnx_kernels::kernel::InstanceNormalization, onnx_light::onnx_kernels::kernel::LayerNormalization, onnx_light::onnx_kernels::kernel::Less, onnx_light::onnx_kernels::kernel::LessOrEqual, onnx_light::onnx_kernels::kernel::LinearAttention, onnx_light::onnx_kernels::kernel::Log, onnx_light::onnx_kernels::kernel::LogSoftmax, onnx_light::onnx_kernels::kernel::LpNormalization, onnx_light::onnx_kernels::kernel::MatMul, onnx_light::onnx_kernels::kernel::MeanVarianceNormalization, onnx_light::onnx_kernels::kernel::Mish, onnx_light::onnx_kernels::kernel::Mod, onnx_light::onnx_kernels::kernel::Neg, onnx_light::onnx_kernels::kernel::Or, onnx_light::onnx_kernels::kernel::PRelu, onnx_light::onnx_kernels::kernel::Pow, onnx_light::onnx_kernels::kernel::QLinearConv, onnx_light::onnx_kernels::kernel::RMSNormalization, onnx_light::onnx_kernels::kernel::Reciprocal, onnx_light::onnx_kernels::kernel::ReduceMean, onnx_light::onnx_kernels::kernel::ReduceSum, onnx_light::onnx_kernels::kernel::Relu, onnx_light::onnx_kernels::kernel::Round, onnx_light::onnx_kernels::kernel::STFT, onnx_light::onnx_kernels::kernel::Sigmoid, onnx_light::onnx_kernels::kernel::Sign, onnx_light::onnx_kernels::kernel::Sin, onnx_light::onnx_kernels::kernel::Sinh, onnx_light::onnx_kernels::kernel::Softmax, onnx_light::onnx_kernels::kernel::Softplus, onnx_light::onnx_kernels::kernel::Softsign, onnx_light::onnx_kernels::kernel::Sqrt, onnx_light::onnx_kernels::kernel::StringConcat, onnx_light::onnx_kernels::kernel::Sub, onnx_light::onnx_kernels::kernel::SwiGLU, onnx_light::onnx_kernels::kernel::Tan, onnx_light::onnx_kernels::kernel::Tanh, onnx_light::onnx_kernels::kernel::Transpose, onnx_light::onnx_kernels::kernel::Where, onnx_light::onnx_kernels::kernel::Xor

Public Functions

ParallelTunableKernel(const core::runtime::KernelContext &ctx, std::string_view kernel, std::span<const int32_t> supported_element_types, int64_t portable_minimum_elements, uint32_t tuning_abi = 1)#
virtual core::runtime::KernelTuningKey TuningKey(int32_t element_type) const override#

Returns the tuning key for this implementation and element_type.

The default returns an undefined key, indicating that the kernel has no tuning schema. Tunable kernels override this together with :cpp:func:Configure.

virtual void Configure(const core::runtime::KernelTuningParameters &parameters) override#

Validates and copies resolved parameters into this kernel’s typed, immutable configuration.

Called at most once, while a :cpp:class:RuntimeSession initializes the kernel and before its first :cpp:func:Run.

inline const ParallelTuning &tuning() const noexcept#

Returns the immutable configuration used by the execution path.

Private Members

std::string_view kernel_#
std::span<const int32_t> supported_element_types_#
ParallelTuning tuning_#
uint32_t tuning_abi_#
struct ParallelTuning#
#include <portable_parallel_tuning.h>

Stores the portable parallel configuration copied into one kernel instance.

Public Functions

inline explicit ParallelTuning(int64_t minimum_elements)#

Public Members

int64_t parallel_minimum_elements#