Skip to main content
Log in

Mojo struct

Vendor

@register_passable struct Vendor

Represents GPU vendors.

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

The Vendor struct defines constants for common GPU vendors (NVIDIA, AMD) and includes a NO_GPU option for systems without GPU support. It provides comparison operators and string conversion methods for vendor identification.

Aliases

  • NO_GPU = Vendor(__init__[__mlir_type.!pop.int_literal](0)): Represents no GPU or CPU-only execution.
  • AMD_GPU = Vendor(__init__[__mlir_type.!pop.int_literal](1)): Represents AMD GPU vendor.
  • NVIDIA_GPU = Vendor(__init__[__mlir_type.!pop.int_literal](2)): Represents NVIDIA GPU vendor.

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility, Writable

Methods

__eq__

__eq__(self, other: Self) -> Bool

Checks if two Vendor instances are equal.

Args:

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

Returns:

True if vendors are equal, False otherwise.

__ne__

__ne__(self, other: Self) -> Bool

Checks if two Vendor instances are not equal.

Args:

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

Returns:

True if vendors are not equal, False otherwise.

__is__

__is__(self, other: Self) -> Bool

Identity comparison for vendors.

Args:

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

Returns:

True if vendors are identical, False otherwise.

__isnot__

__isnot__(self, other: Self) -> Bool

Negative identity comparison for vendors.

Args:

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

Returns:

True if vendors are not identical, False otherwise.

write_to

write_to[W: Writer](self, mut writer: W)

Writes vendor information to a writer.

Parameters:

  • W (Writer): The type of writer to use for output. Must implement the Writer trait.

Args:

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

__str__

__str__(self) -> String

Returns a string representation of the vendor.

Returns:

String representation of the vendor.