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
OwnedGPUEngine
struct OwnedGPUEngine[alignment: Int = Int(1)]
Backs an OwnedTensor with GPU shared memory.
Storage is a OwnedGPUStorage, so the layout must be compact, and views use
DefaultEngine, whose storage handle is a plain Pointer.
Parameters
- alignment (
Int): The least alignment of the storage, in bytes. Storage is never aligned below its element type.
Implemented traits
AnyType,
Deinitable,
Movable,
OwnedTensorEngine
comptime members
StorageType
comptime StorageType[dtype: DType, address_space: AddressSpace, LayoutType: TensorLayout] = OwnedGPUStorage[dtype, address_space, LayoutType, max(alignment, align_of[dtype]())]
A OwnedGPUStorage for a tensor with layout LayoutType.
Parameters
- dtype (
DType): The element data type of the storage. - address_space (
AddressSpace): The address space the storage resides in. - LayoutType (
TensorLayout): The layout of the tensor the storage backs.
ViewEngine
comptime ViewEngine = DefaultEngine
Views shared memory through a plain pointer.
Methods
get_storage_view
static def get_storage_view[result_mut: Bool, dtype: DType, address_space: AddressSpace, result_origin: Origin[mut=result_mut], //](ref storage: OwnedGPUStorage[dtype, address_space, max(alignment, align_of[dtype]())]) -> Pointer[Scalar[dtype], result_origin, address_space=address_space]
Returns a pointer to the storage with origin result_origin.
Parameters:
- result_mut (
Bool): The mutability of the view, inferred fromresult_origin. - dtype (
DType): The element data type of the storage. - address_space (
AddressSpace): The address space the storage resides in. - result_origin (
Origin[mut=result_mut]): The origin the view borrows from.
Args:
- storage (
OwnedGPUStorage[dtype, address_space, max(alignment, align_of[dtype]())]): The owned storage to view.
Returns:
Pointer[Scalar[dtype], result_origin, address_space=address_space]: A pointer to the first element of storage.