Mojo trait
DevicePassable
This trait marks types as passable to accelerator devices.
Implemented traits
AnyType
,
UnknownDestructibility
Aliases
__del__is_trivial
alias __del__is_trivial
A flag (often compiler generated) to indicate whether the implementation of __del__
is trivial.
The implementation of __del__
is considered to be trivial if:
- The struct has a compiler-generated trivial destructor and all its fields
have a trivial
__del__
method.
In practice, it means that the __del__
can be considered as no-op.
device_type
alias device_type
Indicate the type being used on accelerator devices.
Methods
get_type_name
static get_type_name() -> String
Gets the name of the host type (the one implementing this trait). For example, Int would return "Int", DeviceBuffer[DType.float32] would return "DeviceBuffer[DType.float32]". This is used for error messages when passing types to the device. TODO: This method will be retired soon when better kernel call error messages arrive.
Returns:
String
: The host type's name.
get_device_type_name
static get_device_type_name() -> String
Gets device_type's name. For example, because DeviceBuffer's device_type is UnsafePointer, DeviceBuffer[DType.float32]'s get_device_type_name() should return something like "UnsafePointer[Scalar[DType.float32]]". This is used for error messages when passing types to the device. TODO: This method will be retired soon when better kernel call error messages arrive.
Returns:
String
: The device type's name.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!