Skip to main content
Log in

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, UnknownDestructibility

Methods

__copyinit__

__copyinit__(out self, existing: Self)

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

Args:

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

__moveinit__

__moveinit__(out self, owned existing: Self)

Moves an existing device function into this one.

Args:

  • existing (Self): The device function to move from.

__del__

__del__(owned self)

Releases resources associated with this device function.

get_attribute

get_attribute(self, attr: Attribute) -> Int

Retrieves a specific attribute of this device function.

Args:

  • attr (Attribute): The attribute to query.

Returns:

The value of the requested attribute.

Raises:

If the attribute query fails.