Skip to main content

Crate amx_sys

Crate amx_sys 

Source
Expand description

Pure Rust implementation of Apple’s undocumented AMX (matrix acceleration) instructions.

This crate provides software emulation of the AMX instruction set found on Apple M1, M2, M3, and M4 processors. AMX is a specialized hardware accelerator for matrix and vector operations, distinct from standard ARM NEON.

§Architecture Overview

The AMX register file contains:

  • 8 X registers (512 bytes total) - acts as a circular buffer
  • 8 Y registers (512 bytes total) - acts as a circular buffer
  • 64 Z registers (4KB total) - arranged as a 64×64 byte matrix

Operations work on 64-byte spans from X/Y and accumulate into Z using:

  • Vector mode: element-wise operations (Z[i] += X[i] * Y[i])
  • Matrix mode: outer product operations (Z[j][i] += X[i] * Y[j])

§Example

use amx_sys::registers::AmxState;

let mut state = AmxState::new();
// Emulate instruction operations...

Re-exports§

pub use registers::AmxState;
pub use registers::AmxReg;
pub use registers::DATA_TYPE;
pub use instructions::*;
pub use test_helpers::*;

Modules§

instructions
AMX instruction implementations
registers
AMX register file definition
test_helpers
Test helpers for AMX operations
utils
Utility functions for AMX operations

Functions§

amx_clr
Clear AMX state
amx_set
Initialize AMX hardware state - soft reset