Who is this for?

This is an advanced topic for software developers, performance engineers, and AI practitioners who want to optimize llama.cpp performance on Arm-based CPUs.

What will you learn?

Upon completion of this Learning Path, you will be able to:

  • Profile llama.cpp architecture and identify the role of the Prefill and Decode stages.
  • Integrate marker annotations into llama.cpp for fine-grained performance insights.
  • Capture and interpret profiling data with Streamline.
  • Analyze specific operators during token generation using channel annotations.
  • Evaluate multi-core and multi-thread execution of llama.cpp on Arm CPUs.

Prerequisites

Before starting, you will need the following:

  • Basic understanding of llama.cpp
  • Understanding of transformer models
  • Knowledge of Arm Streamline usage
  • An Arm Neoverse or Cortex-A hardware platform running Linux or Android

Summary

AI-assisted

This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
You’ll profile llama.cpp on Arm CPUs with Arm Streamline, including runs that use KleidiAI LLM kernels. First, you’ll add marker annotations for prefill and decode phases and build llama-cli. Then, you’ll prepare the model files and gator daemon, and capture traces. Finally, you’ll inspect channel annotations and operator timing to distinguish pipeline stages and assess multi-core and multi-thread behavior during token generation.

Frequently asked questions

AI-assisted

These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
How do I know that the marker annotations are working in Streamline?
During capture, look for marker annotations on the Streamline timeline. Each marker annotation is added before llama_decode() and records the start of a token-generation event. Marker annotations include values such as past and n_eval. If marker annotations don’t appear, rebuild llama.cpp with the annotation changes and run the annotated llama-cli.
What do I need on the Arm target before starting a profiling capture?
Ensure that the gator daemon is configured and running on the Arm system. Place the built llama-cli and the required model files on the target so that Streamline can capture a representative run.
How do I differentiate prefill and decode phases in the results?
Use the inserted marker annotations to identify each stage in the Streamline timeline. Prefill is compute-intensive and decode is memory-bound, so compare their annotated ranges to understand where time is spent.
How can I analyze operator-level performance with channel annotations?
Enable channel annotations in the annotation integration so that Streamline displays separate lanes for grouped operations. Inspect the channel annotation lanes to see operator timing and overlaps during token generation.
How do I evaluate multi-core or multi-thread execution?
Capture a token generation run and use the marker and channel annotations to correlate work across cores and threads. Compare behavior during prefill and decode phases to see how execution is distributed.
Next