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_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 runtime#
Enums
-
enum class ExecuteActionKind : int32_t#
Kind of a single :cpp:class:
ExecuteAction.The values enumerate every operation an :cpp:class:
ExecutionPlanmay 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).
-
enumerator kLockInitializer#
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;0otherwise.size – Number of bytes for buffer allocations;
0when 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:
kAllocateBufferaction. 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::kTransferaction (empty otherwise).
-
inline size_t node_index() const noexcept#
Returns the index of the node for :cpp:enumerator:
ExecuteActionKind::kExecuteNode(0otherwise).
-
inline size_t size() const noexcept#
Returns the number of bytes for buffer allocations (
0when unknown or not applicable).
-
inline bool is_inplace() const noexcept#
Returns
truewhen 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_inplaceisfalsethe returned value hasoutput_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_nameand 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".
-
ExecuteAction() = default#
-
enum class ExecuteActionKind : int32_t#
-
namespace runtime#
-
namespace core