kernel_tuning_cache.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 core
namespace runtime

Enums

enum class KernelTuningCacheUpdateStatus#

Gives the overall result of atomically updating a tuning cache.

Values:

enumerator kUpdated#
enumerator kReadOnly#
enumerator kUnreadable#
enumerator kMalformed#
enumerator kWriteFailed#
enum class KernelTuningCacheLoadStatus#

Gives the overall result of reading a tuning cache.

Values:

enumerator kLoaded#
enumerator kNotFound#
enumerator kUnreadable#
enumerator kMalformed#

Functions

std::filesystem::path DefaultKernelTuningCachePath()#

Returns the platform-specific default tuning cache path.

Returns: A path under the user’s cache directory.

KernelTuningCacheInspectionReport InspectKernelTuningCache(const KernelTuningCacheOptions &options = {})#

Reads every persisted profile without changing the tuning registry.

Parsed profiles retain their recorded processor and effective thread count. Schema compatibility and value validation are intentionally deferred to :cpp:func:LoadKernelTuningCache.

KernelTuningCacheUpdateReport UpdateKernelTuningCache(std::span<const CalibratedKernelProfile> profiles, const KernelTuningCacheOptions &options = {})#

Validates, merges, and atomically persists calibrated profiles.

The complete key consists of the tuning key and execution descriptor. Existing valid entries not replaced or pruned are preserved.

KernelTuningCacheUpdateReport UpdateKernelTuningCache(std::span<const KernelTuningParameters> profiles, const KernelTuningCacheOptions &options = {})#

Updates profiles that all target one execution descriptor.

options.execution selects that descriptor, or the current execution descriptor when it is absent.

KernelTuningCacheLoadReport LoadKernelTuningCache(const KernelCalibrationSelection &selection = {}, const KernelTuningCacheOptions &options = {})#

Loads compatible cache entries and publishes one immutable registry generation.

The versioned text format starts with onnx_light_kernel_tuning_cache 1. Each profile/end block stores one exact key, processor descriptor, effective thread count, and typed value records. Quoted strings use the C++ std::quoted representation.

Missing and unreadable files, malformed input, incompatible entries, and invalid parameter sets are reported without replacing portable defaults.

KernelTuningDeploymentImportReport ImportKernelTuningDeploymentProfiles(const KernelCalibrationSelection &selection, const KernelTuningDeploymentImportOptions &options)#

Imports cache entries under one explicit deployment processor selector.

All selected profiles validate before one immutable registry generation is published. Cached execution descriptors do not widen the supplied selector.

struct CalibratedKernelProfile#
#include <kernel_tuning_cache.h>

Stores one calibrated parameter set with its complete execution identity.

Public Members

KernelTuningParameters parameters#
CpuExecutionDescriptor execution#
struct KernelTuningCacheInspectionReport#
#include <kernel_tuning_cache.h>

Reports cache contents without validating or publishing them.

Public Members

KernelTuningCacheLoadStatus status = KernelTuningCacheLoadStatus::kNotFound#
std::filesystem::path path#
std::vector<CalibratedKernelProfile> profiles#
std::vector<std::string> diagnostics#
struct KernelTuningCacheLoadReport#
#include <kernel_tuning_cache.h>

Reports every cache classification without throwing for file or data errors.

Public Members

KernelTuningCacheLoadStatus status = KernelTuningCacheLoadStatus::kNotFound#
uint64_t published_generation = 0#
std::vector<KernelTuningKey> loaded#
std::vector<KernelTuningKey> incompatible#
std::vector<KernelTuningKey> stale#
std::vector<KernelTuningKey> invalid#
std::vector<KernelTuningKey> missing#
std::vector<std::string> diagnostics#
struct KernelTuningCacheOptions#
#include <kernel_tuning_cache.h>

Controls cache location and execution-descriptor matching.

Public Members

std::filesystem::path path#
std::optional<CpuExecutionDescriptor> execution#
bool read_only = false#
bool replace_existing = true#
bool prune_stale_abis = false#
struct KernelTuningCacheUpdateReport#
#include <kernel_tuning_cache.h>

Reports the merge and atomic replacement performed by a cache update.

Public Members

KernelTuningCacheUpdateStatus status = KernelTuningCacheUpdateStatus::kUpdated#
std::vector<KernelTuningKey> updated#
std::vector<KernelTuningKey> preserved#
std::vector<KernelTuningKey> pruned#
std::vector<std::string> diagnostics#
struct KernelTuningDeploymentImportOptions#
#include <kernel_tuning_cache.h>

Controls import of a cache file as read-only deployment profiles.

Public Members

std::filesystem::path path#
platform::CpuSelector processors#
int priority = 0#
struct KernelTuningDeploymentImportReport#
#include <kernel_tuning_cache.h>

Reports transactional deployment-profile registration.

Public Members

KernelTuningCacheLoadStatus status = KernelTuningCacheLoadStatus::kNotFound#
uint64_t published_generation = 0#
std::vector<KernelTuningKey> imported#
std::vector<KernelTuningKey> incompatible#
std::vector<KernelTuningKey> stale#
std::vector<KernelTuningKey> invalid#
std::vector<std::string> diagnostics#