Skip to main content
Log in

Mojo struct

DeviceAttribute

@register_passable(trivial) struct DeviceAttribute

Represents CUDA device attributes that can be queried from a GPU device.

This struct encapsulates the various device properties and capabilities that can be queried through the CUDA driver API. Each attribute is represented as a constant with a corresponding integer value that maps to the CUDA driver's attribute enum.

Aliases

  • MAX_THREADS_PER_BLOCK = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](1)): Maximum number of threads per block
  • MAX_BLOCK_DIM_X = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](2)): Maximum block dimension X
  • MAX_BLOCK_DIM_Y = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](3)): Maximum block dimension Y
  • MAX_BLOCK_DIM_Z = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](4)): Maximum block dimension Z
  • MAX_GRID_DIM_X = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](5)): Maximum grid dimension X
  • MAX_GRID_DIM_Y = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](6)): Maximum grid dimension Y
  • MAX_GRID_DIM_Z = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](7)): Maximum grid dimension Z
  • MAX_SHARED_MEMORY_PER_BLOCK = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](8)): Maximum shared memory available per block in bytes
  • WARP_SIZE = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](10)): Warp size in threads
  • MAX_REGISTERS_PER_BLOCK = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](12)): Maximum number of 32-bit registers available per block
  • CLOCK_RATE = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](13)): Typical clock frequency in kilohertz
  • MULTIPROCESSOR_COUNT = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](16)): Number of multiprocessors on device
  • MAX_THREADS_PER_MULTIPROCESSOR = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](39)): Maximum resident threads per multiprocessor
  • COMPUTE_CAPABILITY_MAJOR = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](75)): Major compute capability version number
  • COMPUTE_CAPABILITY_MINOR = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](76)): Minor compute capability version number
  • MAX_REGISTERS_PER_MULTIPROCESSOR = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](82)): Maximum number of 32-bit registers available per multiprocessor
  • MAX_ACCESS_POLICY_WINDOW_SIZE = DeviceAttribute(__init__[__mlir_type.!pop.int_literal](109)): CUDA-only: Maximum value of CUaccessPolicyWindow::num_bytes.

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility

Methods

__init__

@implicit __init__(value: SIMD[int32, 1]) -> Self

Initialize a DeviceAttribute with the given integer value.

This constructor allows implicit conversion from Int32 to DeviceAttribute, making it easier to use integer constants with this type.

Args:

  • value (SIMD[int32, 1]): The integer value representing a specific device attribute.