Skip to main content

Mojo module

info

Implements methods for querying the host target info.

You can import these APIs from the sys package. For example:

from sys import is_x86
from sys import is_x86

Functions

  • alignof: Returns the align of (in bytes) of the type.
  • bitwidthof: Returns the size of (in bits) of the type.
  • has_avx: Returns True if the host system has AVX, otherwise returns False.
  • has_avx2: Returns True if the host system has AVX2, otherwise returns False.
  • has_avx512f: Returns True if the host system has AVX512, otherwise returns False.
  • has_fma: Returns True if the host system has FMA (Fused Multiply-Add) support, otherwise returns False.
  • has_intel_amx: Returns True if the host system has Intel AMX support, otherwise returns False.
  • has_neon: Returns True if the host system has Neon support, otherwise returns False.
  • has_neon_int8_dotprod: Returns True if the host system has the Neon int8 dot product extension, otherwise returns False.
  • has_neon_int8_matmul: Returns True if the host system has the Neon int8 matrix multiplication extension (I8MM), otherwise returns False.
  • has_sse4: Returns True if the host system has sse4, otherwise returns False.
  • has_vnni: Returns True if the host system has avx512_vnni, otherwise returns False.
  • is_32bit: Returns True if the maximum integral value is 32 bit.
  • is_64bit: Returns True if the maximum integral value is 64 bit.
  • is_amd_gpu: Returns True if the target triple of the compiler is amdgcn-amd-amdhsa False otherwise.
  • is_apple_m1: Returns True if the host system is an Apple M1 with AMX support, otherwise returns False.
  • is_apple_m2: Returns True if the host system is an Apple M2 with AMX support, otherwise returns False.
  • is_apple_m3: Returns True if the host system is an Apple M3 with AMX support, otherwise returns False.
  • is_apple_silicon: Returns True if the host system is an Apple Silicon with AMX support, otherwise returns False.
  • is_big_endian: Returns True if the host endianness is big and False otherwise.
  • is_gpu: Returns True if the target triple is GPU and False otherwise.
  • is_little_endian: Returns True if the host endianness is little and False otherwise.
  • is_neoverse_n1: Returns True if the host system is a Neoverse N1 system, otherwise returns False.
  • is_nvidia_gpu: Returns True if the target triple of the compiler is nvptx64-nvidia-cuda False otherwise.
  • is_triple: Returns True if the target triple of the compiler matches the input and False otherwise.
  • is_x86: Returns True if the host system architecture is X86 and False otherwise.
  • num_logical_cores: Returns the number of hardware threads, including hyperthreads across all CPU sockets.
  • num_performance_cores: Returns the number of physical performance cores across all CPU sockets. If not known, returns the total number of physical cores.
  • num_physical_cores: Returns the number of physical cores across all CPU sockets.
  • os_is_linux: Returns True if the host operating system is Linux.
  • os_is_macos: Returns True if the host operating system is macOS.
  • os_is_windows: Returns True if the host operating system is Windows.
  • simdbitwidth: Returns the vector size (in bits) of the specified target.
  • simdbytewidth: Returns the vector size (in bytes) of the specified target.
  • simdwidthof: Returns the vector size of the type on the host system.
  • sizeof: Returns the size of (in bytes) of the type.