execute_action.h#

Single step of an :cpp:class:ExecutionPlan (:cpp:class:ExecuteAction) describing one memory-management or node-execution operation.

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 ExecuteActionKind : int32_t#

Kind of a single :cpp:class:ExecuteAction.

The values enumerate every operation an :cpp:class:ExecutionPlan may schedule while running a graph, function or free-standing node range.

Values:

enumerator kLockInitializer#

Locks an initializer so it stays alive while it is still referenced.

enumerator kUnlockInitializer#

Unlocks an initializer once no remaining node references it.

enumerator kLockInput#

Locks an input so it stays alive while it is still referenced.

enumerator kUnlockInput#

Unlocks an input once no remaining node references it.

enumerator kAllocateBuffer#

Allocates a buffer for a named result.

enumerator kDeleteBuffer#

Deletes a named result (frees its buffer).

enumerator kTransfer#

Transfers a named result to another named result.

enumerator kExecuteNode#

Executes a node.

enumerator kCreateShape#

Creates the shape of a named result.

enumerator kDeleteShape#

Deletes the shape of a named result.

enumerator kAllocateTemporaryBuffer#

Allocates a temporary buffer required for one or several kernels to handle a memory peak.

enumerator kDeleteTemporaryBuffer#

Deallocates a temporary buffer once the kernel(s) using it are done.

enumerator kDeleteSequence#

Deletes a named sequence result (frees the sequence it holds).

enumerator kDeleteMap#

Deletes a named map result (frees the map it holds).

Functions

inline constexpr const char *ExecuteActionKindName(ExecuteActionKind kind) noexcept#

Returns a stable, human-readable name for kind.

class ExecuteAction#
#include <execute_action.h>

Single step of an :cpp:class:ExecutionPlan.

An action captures exactly one operation the runtime performs while executing a node sequence: locking/unlocking an input or initializer, allocating or deleting a named result (or a temporary buffer), creating or deleting the shape of a named result, transferring a named result to another one, or executing a node.

Public Functions

ExecuteAction() = default#
inline ExecuteAction(ExecuteActionKind kind, std::string name, size_t node_index = 0, size_t size = 0, std::string target = std::string(), compute::InPlaceReuse inplace = compute::InPlaceReuse{})#

Builds an action.

Parameters:
  • kind – Kind of the action.

  • name – Primary named result / input / initializer the action operates on. Empty for actions that do not target a name (e.g. a bare node execution).

  • node_index – Index of the node for :cpp:enumerator:kExecuteNode; 0 otherwise.

  • size – Number of bytes for buffer allocations; 0 when unknown or not applicable.

  • target – Destination named result for :cpp:enumerator:kTransfer, or the input buffer reused by an in-place :cpp:enumerator:kAllocateBuffer; empty otherwise.

  • inplace – In-place reuse decision backing an :cpp:enumerator:kAllocateBuffer action. The default (output_index < 0) means the allocation is a fresh allocation rather than an in-place reuse.

inline ExecuteActionKind kind() const noexcept#

Returns the kind of the action.

inline const char *kind_name() const noexcept#

Returns the stable, human-readable name of :cpp:func:kind.

inline const std::string &name() const noexcept#

Returns the primary named result / input / initializer the action operates on (empty when not applicable).

inline const std::string &target() const noexcept#

Returns the destination named result of a :cpp:enumerator:ExecuteActionKind::kTransfer action (empty otherwise).

inline size_t node_index() const noexcept#

Returns the index of the node for :cpp:enumerator:ExecuteActionKind::kExecuteNode (0 otherwise).

inline size_t size() const noexcept#

Returns the number of bytes for buffer allocations (0 when unknown or not applicable).

inline bool is_inplace() const noexcept#

Returns true when this action reuses an input buffer in place rather than allocating fresh memory (only meaningful for :cpp:enumerator:ExecuteActionKind::kAllocateBuffer).

inline const compute::InPlaceReuse &inplace() const noexcept#

Returns the in-place reuse decision backing this action. When :cpp:func:is_inplace is false the returned value has output_index == -1.

inline std::string summary() const#

Returns a concise, human-readable one-line summary of the action.

The summary starts with the action :cpp:func:kind_name and only appends the fields relevant to that kind (node index for node execution, byte size for buffer allocations, transfer destination, in-place reuse). It is meant for logging and debugging an :cpp:class:ExecutionPlan.

Returns:

A short description such as "AllocateBuffer name='y' size=16".

Private Members

ExecuteActionKind kind_ = ExecuteActionKind::kExecuteNode#
std::string name_#
std::string target_#
size_t node_index_ = 0#
size_t size_ = 0#
compute::InPlaceReuse inplace_#