IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

DeviceExternalFunction

struct DeviceExternalFunction

Represents an external device function loaded from PTX/SASS assembly.

This class provides functionality to load and execute pre-compiled GPU functions from assembly code rather than compiling them from Mojo source. This is useful for integrating with existing CUDA/HIP code or for using specialized assembly optimizations.

The DeviceExternalFunction handles reference counting of the underlying device function handle and provides methods for launching the function on a GPU with specified execution configuration.

Implemented traits​

AnyType, Deinitable, Movable

Methods​

__init__​

def __init__(out self, *, copy: Self)

Creates a copy of an existing device function by incrementing its reference count.

Args:

  • ​copy (Self): The device function to copy.

__deinit__​

def __deinit__(deinit self)

Releases resources associated with this device function.

get_attribute​

def get_attribute(self, attr: Attribute) -> Int

Retrieves a specific attribute of this device function.

Args:

  • ​attr (Attribute): The attribute to query.

Returns:

Int: The value of the requested attribute.

Raises:

If the attribute query fails.