cpu_descriptor.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_NAMESPACEso 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_protouses hidden visibility by default.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_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 fromonnx.-
namespace core
-
namespace platform#
Enums
-
enum class CpuFeature : uint8_t#
Identifies an instruction-set capability usable by the current process.
The numeric values are stable to keep CpuFeatureSet::bits() and CpuFeatureName serialization stable across releases.
Values:
-
enumerator kSse2#
-
enumerator kSse41#
-
enumerator kSse42#
-
enumerator kAvx#
-
enumerator kFma#
-
enumerator kAvx2#
-
enumerator kAvx512F#
-
enumerator kAvx512Bw#
-
enumerator kAvx512Vl#
-
enumerator kNeon#
-
enumerator kDotProduct#
-
enumerator kSve#
-
enumerator kSve2#
-
enumerator kSse2#
Functions
-
std::string_view CpuFeatureName(CpuFeature feature) noexcept#
Returns the stable serialized name of a CPU feature.
Returns: The lowercase feature name.
-
std::optional<CpuFeature> CpuFeatureFromName(std::string_view name) noexcept#
Parses a stable CPU feature name.
Returns: The feature, or
std::nulloptfor an unknown name.
-
CpuDescriptor DetectCpuDescriptor()#
Detects processor properties visible to the current process.
Returns: A descriptor whose unavailable fields remain unknown.
-
const CpuDescriptor &GetCpuDescriptor()#
Returns the processor descriptor detected once for the current process.
Returns: The immutable process-wide descriptor.
-
struct CpuDescriptor#
- #include <cpu_descriptor.h>
Describes immutable properties of the processor visible to the process.
Optional values remain absent when the operating system or architecture cannot report them reliably.
Public Functions
-
bool operator==(const CpuDescriptor&) const = default#
Public Members
-
CpuFeatureSet features#
-
bool operator==(const CpuDescriptor&) const = default#
-
class CpuFeatureSet#
- #include <cpu_descriptor.h>
Stores a compact set of CPU instruction-set capabilities.
Public Functions
-
constexpr CpuFeatureSet() = default#
-
inline explicit constexpr CpuFeatureSet(uint64_t bits)#
-
inline constexpr void Add(CpuFeature feature)#
Adds a feature to the set.
-
inline constexpr bool Has(CpuFeature feature) const#
Returns whether the set contains a feature.
Returns:
truewhen the feature is present.
-
inline constexpr bool ContainsAll(CpuFeatureSet other) const#
Returns whether every feature in another set is present.
Returns:
truewhen all requested features are present.
-
inline constexpr bool Intersects(CpuFeatureSet other) const#
Returns whether this set and another set share a feature.
Returns:
truewhen at least one feature is shared.
-
inline constexpr uint64_t bits() const#
Returns the underlying stable bit mask.
-
constexpr bool operator==(const CpuFeatureSet&) const = default#
Private Members
-
uint64_t bits_ = 0#
Private Static Functions
-
static inline constexpr uint64_t FeatureBit(CpuFeature feature)#
-
constexpr CpuFeatureSet() = default#
-
struct CpuSelector#
- #include <cpu_descriptor.h>
Selects processors using stable identifiers rather than display names.
Empty optional fields and an empty model list are wildcards. Thread limits require an explicit effective thread count when matching.
Public Functions
-
bool Matches(const CpuDescriptor &processor, std::optional<uint32_t> effective_threads = std::nullopt) const#
Returns whether a processor and execution thread count satisfy the selector.
Returns:
truewhen every specified criterion matches.
-
bool Matches(const CpuDescriptor &processor, std::optional<uint32_t> effective_threads = std::nullopt) const#
-
enum class CpuFeature : uint8_t#
-
namespace platform#
-
namespace core