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: 1.0.0
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).

Vendor

struct Vendor

Represents GPU vendors.

This struct provides identifiers for different GPU vendors and utility methods for comparison and string representation.

The struct defines a constant for each vendor the stdlib knows about and a NO_GPU option for systems without an accelerator. It provides comparison operators and string conversion methods for vendor identification.

It classifies the accelerator the compiler is targeting, which is what has_amd_gpu_accelerator(), has_nvidia_gpu_accelerator() and has_apple_gpu_accelerator() report. To identify a specific device, use GPUInfo.api.

Implemented traits

AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable, Writable

comptime members

AMD_GPU

comptime AMD_GPU = Vendor(Int8(1))

Represents AMD GPU vendor.

APPLE_GPU

comptime APPLE_GPU = Vendor(Int8(3))

Represents Apple GPU vendor.

NO_GPU

comptime NO_GPU = Vendor(Int8(0))

Represents no GPU or CPU-only execution.

NVIDIA_GPU

comptime NVIDIA_GPU = Vendor(Int8(2))

Represents NVIDIA GPU vendor.

Methods

__eq__

def __eq__(self, other: Self) -> Bool

Checks if two Vendor instances are equal.

Args:

  • other (Self): The Vendor to compare with.

Returns:

Bool: True if vendors are equal, False otherwise.

__ne__

def __ne__(self, other: Self) -> Bool

Checks if two Vendor instances are not equal.

Args:

  • other (Self): The Vendor to compare with.

Returns:

Bool: True if vendors are not equal, False otherwise.

write_to

def write_to(self, mut writer: T)

Writes vendor information to a writer.

Args:

  • writer (T): The writer to output vendor information to.