129 pointsby frabonacci2 hours ago12 comments
  • engzaanin2 hours ago
    That makes sense. The title initially sounded like a general llama.cpp speedup on Apple Silicon, but if the improvement comes from fixing kernel selection inside Virtualization.framework VMs, that distinction is pretty important.
  • simonw2 hours ago
    It looks to me like this won't speed up llama.cpp for everyone, just for users running it in this particular kind of Virtualization.framework VM.

    The fix here works around a problem where the VM was causing llama.cpp to select the wrong kernels.

    • frabonacci2 hours ago
      > this won't speed up llama.cpp for everyone, just for users running it in this particular kind of Virtualization.framework VM.

      correct. these figures apply to llama.cpp inside the macOS guest configuration we tested. Lume is the VM frontend we used, while Apple's Virtualization.framework provides the virtual GPU. bare-metal llama.cpp is unaffected.

      > The fix here works around a problem where the VM was causing llama.cpp to select the wrong kernels.

      mostly, with one nuance: llama.cpp is selecting the correct kernels for the capability answers it receives. the stock guest reports an older Apple GPU family and a 32 KB threadgroup memory limit, so llama.cpp chooses slower kernels. Our process-scoped layer reports the tested Apple 9 and 64 KB values while allowing llama.cpp to select newer paths that the paravirtual GPU successfully execute

      the layer itself though works at the Metal API boundary, independently of llama.cpp. other Metal compute and graphics apps now may select newer paths from the same capability answers, although this is still preliminary and each app needs separate testing. for example, MLX-LM stayed flat in our tests

      historically related limitations have been coming up across Apple Silicon VM frontends for a while e.g. Tart tracked MPS/GPU support back in 2023: - https://github.com/openai/tart/issues/501 - https://github.com/openai/tart/issues/1032

      UTM also has related cases where apps detect the Apple paravirtual Metal device but falls back to software rendering: https://github.com/utmapp/UTM/issues/7671

      • sitkack7 minutes ago
        why do use ai to write your posts ?
  • aeriose19 minutes ago
    What I don't get, which this article doesn't talk about, why would Apple’s Virtualization.framework expose a lesser Metal profile instead of reporting all capabilities supported by the host GPU?
    • bestham7 minutes ago
      Because it cannot be safely virtualised?
      • 3 minutes ago
        undefined
  • thehamkercat2 hours ago
    > 11.08× faster and generated tokens 16.36× faster than the same workload in the same stock VM.

    So this was the comparison, for me the title was a bit confusing

    • frabonacci2 hours ago
      yeah fair point. it's always tricky to get the whole idea across within HN's title limit. tldr: we ran the same workload in the same Lume macOS VM on the same Apple Silicon host, first with stock Metal capability reporting and then with our process-scoped dynamic library. The 11.08x figure is prompt processing, while 16.36x is token generation. the mechanism technically extends to graphics workloads too but these figures are specifically from llama.cpp
  • azinman22 hours ago
    I don’t understand what Apple 1-9 are. At first I thought it was M series chips but there is no M9 (yet)
  • gigatexal13 minutes ago
    All this work to get the Mac to be a platform useful for AI is being done despite Apple's efforts. They're famously pissed at Nvidia since the Nvidia + Intel Macs due to heat and other issues. But then the OS is a bit closed off and they move slow and are more focused on milking iOS and the App Store and services for money BUT the PA-Semi purchase and Apple Silicon and everything following it has made the hardware just so amazing and useful that despite all that people build for it.

    I love the platform. I'm happy to see people building on it.

    AND! if we ever get an M7 chip with the rumored 1.5TB of available ram all this work will not have been in vain. You think the ai acceleration is nice in the M5 wait till M7 and M8.

  • shay_ker2 hours ago
    I recall there was another YC startup that was working on Mac-specific ML optimizations for local inference (and perhaps fine-tuning).

    I wonder if their work is related?

  • luciana1uan hour ago
    my whole setup is buy more RAM, run it on CPU, and tell myself the GPU is just a personality trait I'm working on.
    • cyanydeez29 minutes ago
      I'm hoping AMD wins when the RAM bubble bursts and their integrated AMD 395+ platform can keep getting faster and higher bandwidth.
  • woadwarrior01an hour ago
    The Claudish in the blogpost makes it really hard to ready. Also, TinyLlama 1.1B lol.
  • dxsecarchan hour ago
    [dead]
  • purplemoonx2 hours ago
    [flagged]
    • kevin422 hours ago
      What hardware do you run? I have a first-gen mac studio, and I just run cmake and build with no special options. Same thing with llama-server, I just specify the model and use the built-in web UI.

      For reference, I get ~26 tok/sec with the new Muse 30B model.

      • dofm2 hours ago
        An M1 Max MBP manages roughly 10 tok/sec without the Dflash speculative draft support so that tracks; the M1 Max apparently has trouble actually saturating its memory bandwidth.
    • drittich2 hours ago
      There are certainly challenges. When setting up a new model, I get AI to walk me through the commands using llama-benchmark that determine the best parameters for my particular configuration and needs. Once you've got that it's pretty easy to port those parameters to llama-server. It takes me about an hour to run through this process. It would be great if there was a registry of hardware, models, configuration parameters, and resulting tokens per second. Maybe one day we'll get there.
      • kevin422 hours ago
        What kind of parameters do you end up changing, and how much difference does it make. Perhaps I am missing something and get more tok/sec, but I usually just do a git pull, then rebuild the latest whenever I get a new model.

        In the past, I had to play with chat templates for some models to work with agents for tool calling. But I've never had to do anything other than specify the model, and tweaking the context size in some cases.

      • purplemoonx2 hours ago
        > It takes me about an hour to run through this process

        Yeah not doing that

    • unglaublich2 hours ago
      I think people generally throw Claude or Codex at the configuration challenge, so they don't know either.
      • purplemoonx2 hours ago
        Maybe the llama.cpp dev loved webpack as a child, or just loves making the most simple thing complicated as hell for no reason lol
    • NamlchakKhandroan hour ago
      No
  • myshapeprotocolan hour ago
    [flagged]