IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

DevicePassable

This trait marks types as passable to accelerator devices.

Implemented traits​

AnyType

comptime members​

device_type​

comptime device_type

Indicate the type being used on accelerator devices.

Provided methods​

get_type_name​

static def get_type_name() -> String

Gets the name of the host type (the one implementing this trait).

The default is the type's base name without its parameters, so a Foo[1] returns "Foo". A type that wants its parameters in the name, such as DeviceBuffer[DType.float32], overrides it. 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.