For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo struct
StableStorage
struct StableStorage[mut: Bool, //, dtype: DType, origin: Origin[mut=mut], address_space: AddressSpace]
The storage handle of StableAddrEngine: a stable address slot plus a scalar-element offset into the tensor the slot currently stands for.
The handle never holds the data pointer itself. Every dereference reads
the pointer out of the slot first, so a view built from the handle (a
tile, a slice, an offset) keeps going through the slot no matter where it
was built. That is what lets a TileTensor over a slot be constructed and
tiled on the host while a graph recorded against it still sees whatever
DeviceGraphBuilder.place_stable() puts in the slot at replay.
The type parameters are carried for TensorEngine conformance only. The
slot and its contents are always GENERIC device addresses, and the
origin is not tracked by the slot.
Parameters
- mut (
Bool): The mutability of the viewed storage, inferred fromorigin. - dtype (
DType): The element data type of the viewed storage. - origin (
Origin[mut=mut]): The origin the view is attributed to. - address_space (
AddressSpace): The address space of the viewed storage.
Fields
- addr (
StableAddr): The slot whose contents locate the tensor data. - offset (
Int64): Scalar elements between the slot's data pointer and this handle.
Implemented traits
AnyType,
Copyable,
Deinitable,
ImplicitlyCopyable,
Movable,
RegisterPassable,
TrivialRegisterPassable
Methods
__init__
def __init__(addr: StableAddr) -> Self
Initialize the stable storage from a stable address with 0 offset.
def __init__(ptr: Pointer[NoneType]) -> Self
Initializes the stable storage over the slot at address ptr, with 0 offset.
ptr is reinterpreted as the slot's address and never read through.
The graph compiler hands a stable argument's slot where a dense
argument's data pointer would go, and this constructor is where the
two meet.
Args:
- ptr (
Pointer[NoneType]): The slot's address.