info

Module

Implements methods for querying the host target info.

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

from sys.info import is_x86

is_x86

is_x86() -> Bool

Returns True if the host system architecture is X86 and False otherwise.

Returns:

True if the host system architecture is X86 and False otherwise.

has_sse4

has_sse4() -> Bool

Returns True if the host system has sse4, otherwise returns False.

Returns:

True if the host system has sse4, otherwise returns False.

has_avx

has_avx() -> Bool

Returns True if the host system has AVX, otherwise returns False.

Returns:

True if the host system has AVX, otherwise returns False.

has_avx2

has_avx2() -> Bool

Returns True if the host system has AVX2, otherwise returns False.

Returns:

True if the host system has AVX2, otherwise returns False.

has_avx512f

has_avx512f() -> Bool

Returns True if the host system has AVX512, otherwise returns False.

Returns:

True if the host system has AVX512, otherwise returns False.

has_avx512_vnni

has_avx512_vnni() -> Bool

Returns True if the host system has avx512_vnni, otherwise returns False.

Returns:

True if the host system has avx512_vnni, otherwise returns False.

has_neon

has_neon() -> Bool

Returns True if the host system has Neon support, otherwise returns False.

Returns:

True if the host system support the Neon instruction set.

is_apple_m1

is_apple_m1() -> Bool

Returns True if the host system is an Apple M1 with AMX support, otherwise returns False.

Returns:

True if the host system is an Apple M1 with AMX support and False otherwise.

is_neoverse_n1

is_neoverse_n1() -> Bool

Returns True if the host system is a Neoverse N1 system, otherwise returns False.

Returns:

True if the host system is a Neoverse N1 system and False otherwise.

has_intel_amx

has_intel_amx() -> Bool

Returns True if the host system has Intel AMX support, otherwise returns False.

Returns:

True if the host system has Intel AMX and False otherwise.

os_is_macos

os_is_macos() -> Bool

Returns True if the host operating system is macOS.

Returns:

True if the host operating system is macOS and False otherwise.

os_is_linux

os_is_linux() -> Bool

Returns True if the host operating system is Linux.

Returns:

True if the host operating system is Linux and False otherwise.

os_is_windows

os_is_windows() -> Bool

Returns True if the host operating system is Windows.

Returns:

True if the host operating system is Windows and False otherwise.

is_triple

is_triple[triple: StringLiteral]() -> Bool

Returns True if the target triple of the compiler matches the input and False otherwise.

Parameters:

  • triple (StringLiteral): The triple value to be checked against.

Returns:

True if the triple matches and False otherwise.

triple_is_nvidia_cuda

triple_is_nvidia_cuda() -> Bool

Returns True if the target triple of the compiler is nvptx64-nvidia-cuda False otherwise.

Returns:

True if the triple target is cuda and False otherwise.

simdbitwidth

simdbitwidth() -> Int

Returns the vector size (in bits) of the host system.

Returns:

The vector size (in bits) of the host system.

is_little_endian

is_little_endian() -> Bool

Returns True if the host endianness is little and False otherwise.

Returns:

True if the host target is little endian and False otherwise.

is_big_endian

is_big_endian() -> Bool

Returns True if the host endianness is big and False otherwise.

Returns:

True if the host target is big endian and False otherwise.

simd_byte_width

simd_byte_width() -> Int

Returns the vector size (in bytes) of the host system.

Returns:

The vector size (in bytes) of the host system.

sizeof

sizeof[type: AnyType]() -> Int

Returns the size of (in bytes) of the type.

Parameters:

  • type (AnyType): The type in question.

Returns:

The size of the type in bytes.

sizeof[type: DType]() -> Int

Returns the size of (in bytes) of the dtype.

Parameters:

  • type (DType): The DType in question.

Returns:

The size of the dtype in bytes.

alignof

alignof[type: AnyType]() -> Int

Returns the align of (in bytes) of the type.

Parameters:

  • type (AnyType): The type in question.

Returns:

The alignment of the type in bytes.

alignof[type: DType]() -> Int

Returns the align of (in bytes) of the dtype.

Parameters:

  • type (DType): The DType in question.

Returns:

The alignment of the dtype in bytes.

bitwidthof

bitwidthof[type: AnyType]() -> Int

Returns the size of (in bits) of the type.

Parameters:

  • type (AnyType): The type in question.

Returns:

The size of the type in bits.

bitwidthof[type: DType]() -> Int

Returns the size of (in bits) of the dtype.

Parameters:

  • type (DType): The type in question.

Returns:

The size of the dtype in bits.

simdwidthof

simdwidthof[type: AnyType]() -> Int

Returns the vector size of the type on the host system.

Parameters:

  • type (AnyType): The type in question.

Returns:

The vector size of the type on the host system.

simdwidthof[type: DType]() -> Int

Returns the vector size of the type on the host system.

Parameters:

  • type (DType): The DType in question.

Returns:

The vector size of the dtype on the host system.