Mojo trait
DeviceBuffer
Implemented traitsβ
AnyType
Methodsβ
copy_to
β
copy_to(self: T, dev: Device, name: Optional[String]) -> T
Copies the contents of self into DeviceBuffer allocated on dev. Note: this function allocates memory on dev.
Args:
- βdev (
Device
): The Device on which to allocate the new DeviceBuffer. - βname (
Optional[String]
): Optional name of the new DeviceBuffer.
Returns:
Newly allocated DeviceBuffer containing a copy of self's contents.
Raises:
If the DeviceBuffer is backed by the same Device object as dev.
copy_into
β
copy_into(self: T, inout dst_memory: T)
Copies the contents of self into a preallocated DeviceBuffer.
Args:
- βdst_memory (
T
): The destination DeviceBuffer of the copy.
move_to
β
move_to(owned self: T, dev: Device) -> T
Returns self if already allocated on dev, otherwise copy the contents of self to dev.
Args:
- βdev (
Device
): The Device of the returned buffer.
Returns:
A DeviceBuffer located in dev's address space.
unsafe_ptr
β
unsafe_ptr(self: T) -> UnsafePointer[SIMD[uint8, 1], 0, 0, alignof[::AnyType,__mlir_type.!kgen.target]() if triple_is_nvidia_cuda() else 1]
Returns a pointer to the DeviceBuffer's storage in device memory.
device
β
device(self: T) -> Device
Returns the Device on which the DeviceBuffer was allocated.
bytecount
β
bytecount(self: T) -> Int
Returns the size of the DeviceBuffer in bytes.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
If you'd like to share more information, please report an issue on GitHub
π What went wrong?