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
unsupported_target_error
static unsupported_target_error[result: AnyType = None, *, operation: Optional[String] = Optional(None), note: Optional[String] = Optional(None)]() -> result
Produces a constraint failure when called indicating that some operation is not supported by the current compilation target.
Parameters:
- result (
AnyType
): The never-returned result type of this function. - operation (
Optional
): Optional name of the operation that is not supported. Should be a function name or short description. - note (
Optional
): Optional additional note to print.
Returns:
result
: This function does not return normally, however a return type
can be specified to satisfy Mojo type checking.
__arch
static __arch() -> string
Returns:
string
default_compile_options
static default_compile_options() -> StringSlice[StaticConstantOrigin]
Returns the default compile options for the compilation target.
Returns:
StringSlice
: The string of default compile options for the compilation target.
has_sse4
static has_sse4() -> Bool
Checks if the target supports SSE4 instructions.
Returns:
Bool
: 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:
Bool
: 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:
Bool
: 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:
Bool
: True if the host system has AVX512, otherwise returns False.
has_intel_amx
static has_intel_amx() -> Bool
Returns True if the host system has Intel AMX support, otherwise returns False.
Returns:
Bool
: True if the host system has Intel AMX and False otherwise.
has_fma
static has_fma() -> Bool
Returns True if the target has FMA (Fused Multiply-Add) support, otherwise returns False.
Returns:
Bool
: 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:
Bool
: 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:
Bool
: 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:
Bool
: 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:
Bool
: 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:
Bool
: True if the target is x86, False otherwise.
is_apple_m1
static is_apple_m1() -> Bool
Check if the target is an Apple M1 system.
Returns:
Bool
: True if the host system is an Apple M1, False otherwise.
is_apple_m2
static is_apple_m2() -> Bool
Check if the target is an Apple M2 system.
Returns:
Bool
: True if the host system is an Apple M2, False otherwise.
is_apple_m3
static is_apple_m3() -> Bool
Check if the target is an Apple M3 system.
Returns:
Bool
: True if the host system is an Apple M3, False otherwise.
is_apple_m4
static is_apple_m4() -> Bool
Check if the target is an Apple M4 system.
Returns:
Bool
: True if the host system is an Apple M4, False otherwise.
is_apple_silicon
static is_apple_silicon() -> Bool
Check if the host system is an Apple Silicon with AMX support.
Returns:
Bool
: True if the host system is an Apple Silicon with AMX support, and
False otherwise.
is_neoverse_n1
static is_neoverse_n1() -> Bool
Returns True if the host system is a Neoverse N1 system, otherwise returns False.
Returns:
Bool
: True if the host system is a Neoverse N1 system and False otherwise.
is_linux
static is_linux() -> Bool
Returns True if the host operating system is Linux.
Returns:
Bool
: True if the host operating system is Linux and False otherwise.
is_macos
static is_macos() -> Bool
Returns True if the host operating system is macOS.
Returns:
Bool
: True if the host operating system is macOS and False otherwise.
is_windows
static is_windows() -> Bool
Returns True if the host operating system is Windows.
Returns:
Bool
: True if the host operating system is Windows and False otherwise.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!