parallel_region_collector.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

Functions

ParallelRegionCollector *CurrentParallelRegionCollector() noexcept#

Returns the non-owning collector installed on the calling thread.

class ParallelRegionCollector#
#include <parallel_region_collector.h>

Collects parallel-region events in fixed storage without locking inference.

Storage is allocated once by the constructor. Concurrent writers reserve distinct slots atomically; events beyond capacity increment the dropped count. Readers must inspect events only when no inference is writing.

Public Functions

explicit ParallelRegionCollector(size_t capacity)#

Allocates storage for exactly capacity events.

ParallelRegionCollector(const ParallelRegionCollector&) = delete#
ParallelRegionCollector &operator=(const ParallelRegionCollector&) = delete#
void Record(ParallelRegionEvent event) noexcept#

Records an event or increments the dropped count when storage is full.

inline size_t capacity() const noexcept#

Returns the configured event capacity.

std::span<const ParallelRegionEvent> events() const noexcept#

Returns the completed event slots. No inference may be writing concurrently.

inline uint64_t dropped_events() const noexcept#

Returns the number of events rejected after capacity was exhausted.

Private Members

std::vector<ParallelRegionEvent> events_#
std::atomic<size_t> next_event_ = {0}#
std::atomic<uint64_t> dropped_events_ = {0}#
class ParallelRegionCollectorScope#
#include <parallel_region_collector.h>

Installs a non-owning collector view for the lifetime of this scope.

Public Functions

explicit ParallelRegionCollectorScope(ParallelRegionCollector *collector) noexcept#
ParallelRegionCollectorScope(const ParallelRegionCollectorScope&) = delete#
ParallelRegionCollectorScope &operator=(const ParallelRegionCollectorScope&) = delete#
~ParallelRegionCollectorScope()#

Private Members

ParallelRegionCollector *previous_#
struct ParallelRegionEvent#
#include <parallel_region_collector.h>

Describes one portable ParallelFor execution.

Public Members

std::string_view label#
std::source_location location#
int64_t total_iterations = 0#
int64_t grain_size = 0#
int32_t requested_threads = 0#
int32_t admitted_threads = 0#
int32_t observed_threads = 0#
uint64_t wall_time_ns = 0#
uint64_t executor_instance_id = 0#
bool nested_inline = false#