portable_parallel_tuning.h#

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::BitShift, onnx_light::onnx_kernels::kernel::BitwiseAnd, onnx_light::onnx_kernels::kernel::BitwiseOr, onnx_light::onnx_kernels::kernel::BitwiseXor, onnx_light::onnx_kernels::kernel::Div, onnx_light::onnx_kernels::kernel::Equal, onnx_light::onnx_kernels::kernel::Greater, onnx_light::onnx_kernels::kernel::GreaterOrEqual, onnx_light::onnx_kernels::kernel::Less, onnx_light::onnx_kernels::kernel::LessOrEqual, onnx_light::onnx_kernels::kernel::Mod, onnx_light::onnx_kernels::kernel::Or, onnx_light::onnx_kernels::kernel::PRelu, onnx_light::onnx_kernels::kernel::Pow, onnx_light::onnx_kernels::kernel::StringConcat, onnx_light::onnx_kernels::kernel::Sub, onnx_light::onnx_kernels::kernel::SwiGLU, 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#