Processor performance profile#

benchmark_processor_performance(thread_policies=('single', 'physical'), repeats=7, minimum_duration_ms=20.0, memory_budget_bytes=512 * 1024 * 1024, include_latency=True, explicit_single_affinity=None) ProcessorPerformanceProfile#

Measures an immutable, versioned ProcessorPerformanceProfile. This is an explicit, expensive action and is never run during import, session creation, calibration lookup, or inference.

Every option is validated before allocation or timing; invalid thread_policies, repeats, minimum_duration_ms, memory_budget_bytes, or explicit_single_affinity raises ValueError. A memory level or compute element type that cannot be measured truthfully is absent rather than represented by zero or a fabricated value; see ProcessorPerformanceProfile.warnings.

from onnx_light_cpu import benchmark_processor_performance

profile = benchmark_processor_performance(
    thread_policies=("single", "physical"),
    repeats=7,
    minimum_duration_ms=50,
    memory_budget_bytes=512 * 1024 * 1024,
    include_latency=True,
)

print(profile.memory["L1"]["single"].read.median_gbps)
print(profile.memory["RAM"]["physical"].copy.median_gbps)
print(profile.compute["float32"]["physical"].median_gops)
class ProcessorPerformanceProfile#

Immutable, versioned processor performance profile.

metadata: ProcessorProfileMetadata#
topology: ProcessorProfileTopology#
memory: dict[str, dict[str, MemoryLevelMeasurement]]#

Keyed by memory level, then by thread policy. Missing entries could not be measured truthfully; see warnings.

compute: dict[str, dict[str, ComputeMeasurement]]#

Keyed by element type, then by thread policy. Missing entries have no compiled and runtime-detected native arithmetic path.

roofline: dict[str, dict[str, dict[str, RooflineMeasurement]]]#

Keyed by element type, thread policy, then memory level.

warnings: tuple[str, ...]#

Unavailable, inferred, noisy, unpinned, or memory-budget-limited conditions from assembling the profile.

class ProcessorProfileMetadata#

Schema version, timestamp, platform/compiler identity, resolved options, and shared timer identity for a profile run.

schema_version: int#
unix_timestamp_ns: int#
platform: str#
compiler: str#
timer_name: str#
options: ProcessorProfileOptionsEcho#
diagnostics: tuple[str, ...]#
class ProcessorProfileOptionsEcho#

Immutable echo of the measured options.

class ProcessorProfileTopology#

Process-visible logical/physical topology and cache descriptors.

class CacheDescriptor#

One reusable cache level descriptor.

class BandwidthMeasurement#

One available bandwidth measurement.

class LatencyMeasurement#

One available dependent-load pointer-chase latency measurement.

class MemoryLevelMeasurement#

Measurements for one memory level and thread policy.

class ComputeMeasurement#

One available register-resident arithmetic throughput measurement.

class RooflineMeasurement#

One derived Roofline crossover point.

class ExplicitAffinity#

One explicit logical-processor affinity (group, index).