ONNX Runtime
Loading...
Searching...
No Matches
OrtResourceCount Struct Reference

ABI-stable tagged union representing a resource cost or budget. More...

#include <onnxruntime_ep_c_api.h>

Public Member Functions

 OrtResourceCount () noexcept
 
uint64_t AsTotalBytes () const noexcept
 

Static Public Member Functions

static OrtResourceCount None () noexcept
 
static OrtResourceCount FromTotalBytes (uint64_t bytes) noexcept
 

Public Attributes

uint32_t kind
 
uint32_t reserved
 
union { 
 
   uint64_t   total_bytes 
 
   uint64_t   reserved_words [6] 
 
value 
 

Detailed Description

ABI-stable tagged union representing a resource cost or budget.

This struct is a C-safe variant that can be passed by value across the plugin DLL boundary. The kind field selects which member of the value union is active. The value.reserved_words storage reserves space for future resource types without changing the struct layout.

Adding new resource types requires only: (a) a new OrtResourceCountKind enum value, (b) a new union member. No new C API functions are needed.

Since
Version 1.26.

Constructor & Destructor Documentation

◆ OrtResourceCount()

OrtResourceCount::OrtResourceCount ( )
inlinenoexcept

Default-construct a None (unset) resource count.

Member Function Documentation

◆ AsTotalBytes()

uint64_t OrtResourceCount::AsTotalBytes ( ) const
inlinenoexcept

Read the total_bytes value (caller must check kind first).

◆ FromTotalBytes()

static OrtResourceCount OrtResourceCount::FromTotalBytes ( uint64_t  bytes)
inlinestaticnoexcept

Construct a resource count representing total bytes.

◆ None()

static OrtResourceCount OrtResourceCount::None ( )
inlinestaticnoexcept

Construct a zero/unset resource count.

Member Data Documentation

◆ kind

uint32_t OrtResourceCount::kind

OrtResourceCountKind discriminator.

◆ reserved

uint32_t OrtResourceCount::reserved

Must be zero. Ensures natural alignment for the value union.

◆ reserved_words

uint64_t OrtResourceCount::reserved_words[6]

48 bytes fixed storage for future resource types.

◆ total_bytes

uint64_t OrtResourceCount::total_bytes

Active when kind == OrtResourceCountKind_TotalBytes.

◆ [union]

union { ... } OrtResourceCount::value