Skip to main content

Mojo struct

CompilationTarget

@register_passable(trivial) struct CompilationTarget[value: target = _current_target()]

A struct that provides information about a target architecture.

This struct encapsulates various methods to query target-specific information such as architecture features, OS details, endianness, and memory characteristics.

Parameters

  • value (target): The target architecture to query. Defaults to the current target.

Implemented traits

AnyType, Copyable, Movable, UnknownDestructibility

Methods

has_sse4

static has_sse4() -> Bool

Checks if the target supports SSE4 instructions.

Returns:

True if the target supports SSE4, False otherwise.

has_avx

static 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

static 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

static 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_fma

static has_fma() -> Bool

Returns True if the target has FMA (Fused Multiply-Add) support, otherwise returns False.

Returns:

True if the target has FMA support, otherwise returns False.

has_vnni

static has_vnni() -> Bool

Returns True if the target has avx512_vnni, otherwise returns False.

Returns:

True if the target has avx512_vnni, otherwise returns False.

has_neon

static has_neon() -> Bool

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

Returns:

True if the target support the Neon instruction set.

has_neon_int8_dotprod

static has_neon_int8_dotprod() -> Bool

Returns True if the target has the Neon int8 dot product extension, otherwise returns False.

Returns:

True if the target support the Neon int8 dot product extension and False otherwise.

has_neon_int8_matmul

static has_neon_int8_matmul() -> Bool

Returns True if the target has the Neon int8 matrix multiplication extension (I8MM), otherwise returns False.

Returns:

True if the target support the Neon int8 matrix multiplication extension (I8MM) and False otherwise.

is_x86

static is_x86() -> Bool

Checks if the target is an x86 architecture.

Returns:

True if the target is x86, False otherwise.

Was this page helpful?