MemoryOperatorsType
public protocol MemoryOperatorsType
Memory manager for a device
-
Undocumented
Declaration
Swift
associatedtype Device : DeviceType where Self == Self.Device.Memory
-
Undocumented
Declaration
Swift
associatedtype RawBuffer : Hashable
-
Allocates a buffer with capacity for the amount of elements in the given shape
Declaration
Swift
static func allocateBuffer<Element>(withShape shape: [Int], type: Element.Type) -> ShapedBuffer<Element, Device>
Parameters
shape
Shape of the buffer to allocate
type
Type of elements in the buffer
-
Releases all resources associated with the given buffer
Declaration
Swift
static func free<Element>(_ buffer: ShapedBuffer<Element, Device>)
Parameters
buffer
Buffer to release
-
Copies values from the given host buffer to the memory of the device
Declaration
Parameters
source
Source buffer
destination
Device buffer
count
Number of elements to copy
-
Copies values from the given device buffer to the given host buffer
Declaration
Parameters
source
Device buffer
destination
Host buffer
count
Number of elements to copy
-
Retrieves a slice of values from the given buffer
Declaration
Parameters
slice
Index
buffer
Buffer to read from
shape
Shape of the buffer
Return Value
The result buffer, a boolean indicating whether the result buffer is a copy (true) or a pointer in the same memory region (false) and the shape of the result.
-
Retrieves a slice of values from the given buffer
Declaration
Parameters
slice
Index
buffer
Buffer to read from
shape
Shape of the buffer
Return Value
The result buffer, a boolean indicating whether the result buffer is a copy (true) or a pointer in the same memory region (false) and the shape of the result.
-
Writes a slice into a target buffer
Declaration
Parameters
slice
Slice index
buffer
Buffer to write to
dstShape
Shape of the destination buffer
source
Buffer to read from
sourceShape
Shape of the source buffer
-
Writes a slice into a target buffer
Declaration
Parameters
slice
Slice index
buffer
Buffer to write to
dstShape
Shape of the destination buffer
source
Buffer to read from
sourceShape
Shape of the source buffer
-
Returns a buffer that uses the same region of memory but is advanced by the given number of elements
Declaration
Parameters
buffer
Parent buffer
advancement
Number of elements to advance the start index by