Researchers from Cua have developed a process-scoped Metal capability shim to resolve performance bottlenecks in macOS virtual machines running on Apple Silicon. While Apple's Virtualization.framework utilizes paravirtualization to execute guest Metal workloads on the host GPU, the stock Tahoe VM reports conservative capability profiles, such as an Apple-5 era family and a 32 KB threadgroup memory limit. This causes applications like llama.cpp to avoid optimized kernels. By injecting a compatibility layer via DYLD_INSERT_LIBRARIES, the researchers intercepted Metal queries to report Apple-family 9 support and a 64 KB threadgroup memory limit, enabling the use of SIMD-group matrix and bfloat16 paths. Benchmarks on an M1 Ultra showed dramatic improvements: TinyLlama 1.1B saw prompt processing speeds jump from 431.86 to 4,786.70 tok/s (11.08×) and token generation increase from 12.63 to 206.60 tok/s (16.36×). For Gemma 4 12B, prompt processing improved by 7.20× and generation by 14.54×. Meta's Muse Glimmer 30B also saw significant gains, with prompt processing increasing 7.55× and generation 8.87×. These results demonstrate that the paravirtualized GPU path is significantly underutilized due to artificial capability reporting, allowing VMs to achieve near-bare-metal prompt processing speeds.

Read original