Skip to content

Commit b77b70d

Browse files
authored
Merge pull request #3497 from anupras-mohapatra-arm/servers-and-cloud-computing
Arm Instruction Mix recipe for Performix LP review + slight skill tweaks
2 parents 46f49d9 + f02301c commit b77b70d

10 files changed

Lines changed: 178 additions & 96 deletions

File tree

.github/skills/learning-path-structure-review/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Use this skill when a Learning Path needs a structural review. Focus on whether
1010
## Workflow
1111

1212
1. Identify the Learning Path directory and read the relevant Markdown files together.
13-
2. State the owned developer task in one sentence. If the task is unclear, too broad, or split across unrelated goals, flag it.
13+
2. Summarize the developer task owned by LP in one sentence. If the task is unclear, too broad, or split across unrelated goals, flag it.
1414
3. Check the required file shape:
1515
- The Learning Path has an `_index.md` file.
1616
- The Learning Path has an `_next-steps.md` file.

.github/skills/seo-geo-aeo-review/SKILL.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ For focused front matter `description` edits only, use `.github/skills/metadata-
2323

2424
## Workflow
2525

26+
On any given page:
27+
2628
1. Identify the target content type and target developer intent.
27-
2. Read the title, front matter description, headings, introduction, prerequisites, main task flow, validation, conclusion, and further reading. If you've previously read a page, use context and don't re-read it unless there's a change since the last read.
28-
3. State the page's owned task in one sentence. If the task is unclear or too broad, flag it.
29+
2. Read the title, front matter description, headings, introduction, prerequisites, main task flow, validation, conclusion, and further reading. If you've previously read the page, use context and don't re-read it unless asked to.
30+
3. Summarize the page's owned task in one sentence. If the task is unclear or too broad, flag it.
2931
4. Review SEO signals:
3032
- The title is task-led and includes the main technology, platform, or tool.
3133
- The `description` is one concise sentence that states the task, context, and outcome.

.github/skills/writing-style-review/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Use this skill for granular prose, voice, readability, terminology, and style re
1010
## Workflow
1111

1212
1. Identify the target file, section, or selected text.
13-
2. Read surrounding context so style edits preserve the author's intent and the technical flow. If you've previously read the page, use context and don't re-read it unless there's a change since the last read.
13+
2. Read surrounding context so style edits preserve the author's intent and the technical flow. If you've previously read the page, use context and don't re-read it unless asked to.
1414
3. Review the target against the guidelines defined in this skill.
1515
4. Depending on request type, do the following:
16-
- For review requests, report high-impact style issues by file and line when possible.
16+
- For review requests, report style issues by file and line when possible, ordered by severity.
1717
- For edit requests, make focused rewrites, then re-open changed sections to check Markdown, shortcodes, links, and code fences.
1818

1919
## Voice and tone

content/learning-paths/servers-and-cloud-computing/performix-instruction-mix/_index.md

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,78 @@
11
---
2-
title: Profile GPT-2 instruction mix with Arm Performix
2+
title: Profile GPT-2 inference with the Arm Performix Instruction Mix recipe
33

4-
draft: true
5-
cascade:
6-
draft: true
7-
8-
description: Learn how to profile GPT-2 inference on Arm Neoverse with the Arm Performix Instruction Mix recipe, identify scalar versus vector execution patterns, and improve throughput with NEON, SVE, and KleidiAI kernels.
4+
description: Profile GPT-2 inference on Arm Neoverse with the Arm Performix Instruction Mix recipe, identify scalar versus vector execution patterns, and improve throughput with Neon, SVE, and KleidiAI kernels.
95

106
minutes_to_complete: 45
117

12-
who_is_this_for: This is an introductory topic for developers who want to get started using the instruction mix recipe in Arm Performix through a practical example.
8+
who_is_this_for: This is an introductory topic for developers who want to get started using the Arm Performix Instruction Mix recipe through a practical example.
139

1410
learning_objectives:
15-
- Explain how the Instruction Mix recipe combines static disassembly with runtime sampling to show execution behavior
11+
- Use the Instruction Mix recipe to combine static disassembly with runtime sampling to show execution behavior
1612
- Build and run the GPT-2 inference example on an Arm Linux server
1713
- Identify why matrix multiplication dominates runtime and how vectorization changes the instruction mix
18-
- Compare throughput and instruction mix across scalar, NEON, SVE, and KleidiAI implementations
14+
- Compare throughput and instruction mix across scalar, Neon, SVE, and KleidiAI implementations
1915

2016
prerequisites:
21-
- Access to Arm Performix configured with a remote Arm Linux target. For setup, see the [Arm Performix install guide](/install-guides/performix/)
17+
- Access to Arm Performix configured with a remote Arm Linux target. For setup, see the [Arm Performix install guide](/install-guides/performix/).
2218
- Basic understanding of C++ and compiler optimization
2319
- Basic understanding of matrix multiplication
2420
- Basic understanding of writing SIMD code with Neon or SVE
2521

22+
# START generated_summary_faq
23+
generated_summary_faq:
24+
template_version: summary-faq-v3
25+
generated_at: '2026-07-15T19:50:40Z'
26+
generator: ai
27+
ai_assisted: true
28+
ai_review_required: true
29+
model: gpt-5
30+
prompt_template: summary-faq-v3
31+
source_hash: 22b8b268d361bfa326a92845a7a0878e26719ef182c3e907fd6da5dcd5503388
32+
summary_generated_at: '2026-07-15T19:50:40Z'
33+
summary_source_hash: 22b8b268d361bfa326a92845a7a0878e26719ef182c3e907fd6da5dcd5503388
34+
faq_generated_at: '2026-07-15T19:50:40Z'
35+
faq_source_hash: 22b8b268d361bfa326a92845a7a0878e26719ef182c3e907fd6da5dcd5503388
36+
summary: >-
37+
You'll build a GPT-2 inference example on an Arm Linux target and use Arm Performix to analyze
38+
execution behavior. After running the Code Hotspots recipe to locate the dominant `matmul`
39+
kernel, you'll use the Instruction Mix recipe to compare scalar and vector execution patterns
40+
on Arm Neoverse. You'll then compare the scalar `gpt2` baseline with `gpt2_neon`, `gpt2_sve`,
41+
optional `gpt2_user`, and the KleidiAI-backed `gpt2_kai_sve` path, validating vectorization
42+
and throughput changes with Performix data and tokens-per-second results.
43+
faqs:
44+
- question: Which Performix recipe should I run first to find the bottleneck?
45+
answer: >-
46+
Start with the Code Hotspots recipe. Set the launch command to the baseline binary and use
47+
`-n 150` to bias the profile toward inference time, then review the top functions.
48+
- question: How do I know that matrix multiplication is the hotspot before I change any code?
49+
answer: >-
50+
The Code Hotspots report ranks functions by sampled time, so `kernels::matmul_ref()` should appear
51+
near the top. Use that evidence to decide where to focus subsequent Instruction Mix profiling.
52+
- question: Where do I add my Neon or SVE intrinsics, and what part of the loop should I change?
53+
answer: >-
54+
Edit `src/kernels/matmul_user.cpp`. Focus on the accumulation loop, `acc += row[j] * x[j];`,
55+
and consider lane utilization, loop unrolling, and how you handle the tail.
56+
- question: What binaries should I expect after building, and where are the reference implementations?
57+
answer: >-
58+
The build produces the scalar baseline `gpt2`, reference variants `gpt2_neon` and `gpt2_sve`,
59+
and `gpt2_user` when the user kernel is enabled. The reference kernels are implemented in
60+
`matmul_neon.cpp` and `matmul_sve.cpp`.
61+
- question: How do I verify that my vectorization worked using Performix?
62+
answer: >-
63+
Profile your rebuilt binary with the Instruction Mix recipe and compare the proportion of
64+
vector instructions with the baseline. You can also run the reference `gpt2_neon` and `gpt2_sve`
65+
and compare instruction mix and the program's tokens-per-second summary.
66+
# END generated_summary_faq
67+
2668
author:
2769
- Kieran Hejmadi
2870
- Oliver Grainge
2971

72+
generate_summary_faq: false
73+
rerun_summary: false
74+
rerun_faqs: false
75+
3076
### Tags
3177
skilllevels: Introductory
3278
subjects: Performance and Architecture
@@ -36,7 +82,7 @@ tools_software_languages:
3682
- Arm Performix
3783
- C
3884
- LLM
39-
- NEON
85+
- Neon
4086
- SVE
4187
operatingsystems:
4288
- Linux
@@ -57,6 +103,10 @@ further_reading:
57103
title: Arm MCP Server GitHub Repository
58104
link: https://github.com/arm/mcp
59105
type: website
106+
- resource:
107+
title: KleidiAI GitHub Repository
108+
link: https://gitlab.arm.com/kleidi/kleidiai
109+
type: website
60110
- resource:
61111
title: GPT-2 Example repository
62112
link: https://github.com/arm-education/GPT-2-Example
@@ -69,4 +119,4 @@ further_reading:
69119
weight: 1 # _index.md always has weight of 1 to order correctly
70120
layout: "learningpathall" # All files under learning paths have this same wrapper
71121
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
72-
---
122+
---
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
---
2-
title: Understand instruction mix profiling
2+
title: Understand profiling with Arm Performix Instruction Mix
3+
description: See how the Arm Performix Instruction Mix recipe combines static disassembly and runtime sampling to reveal scalar and vector execution patterns in GPT-2 inference.
34
weight: 2
45

56
### FIXED, DO NOT MODIFY
67
layout: learningpathall
78
---
89

9-
## Instruction mix overview
10+
## Why to use the Arm Performix Instruction Mix recipe
1011

1112
The Arm Performix Instruction Mix recipe shows the types and proportions of machine instructions your workload executes at runtime and in static analysis, so you can see how efficiently your code uses Arm CPU hardware resources.
1213

13-
The Instruction Mix recipe classifies each instruction into a group. The available groups depend on the Neoverse architecture version you are profiling. Therefore the categories you see may vary depending on the version of Arm Neoverse you are using. Typical categories include:
14+
The Instruction Mix recipe classifies each instruction into a group. The available groups depend on the Neoverse architecture version you are profiling. Therefore the categories you see might vary depending on the version of Arm Neoverse you are using. Typical categories include:
1415

1516
- integer and floating-point arithmetic
1617
- memory loads and stores (including exclusive operations)
1718
- control flow instructions, such as branches and loops
1819
- specialized instructions, such as cryptographic operations
19-
- SIMD (Single Instruction, Multiple Data) instructions, including NEON (fixed 128-bit) and SVE (scalable vector length)
20+
- SIMD (Single Instruction, Multiple Data) instructions, including Neon (fixed 128-bit) and SVE (scalable vector length)
2021

21-
The instruction mix result gives you two complementary views:
22+
The Instruction Mix result gives you two complementary views:
2223

2324
- static analysis, which inspects compiled machine code without running it
2425
- dynamic analysis, which measures instruction usage during real execution
2526

26-
Together, these views help you verify whether architecture-specific features are actually active in hot code paths.
27+
Together, these views help you verify whether architecture-specific features are active in hot code paths.
2728

28-
## Detecting missed vectorization
29+
Instruction Mix is useful when you need to confirm that performance-critical code uses Arm CPU features effectively. This is especially helpful when you are, for example, validating the effectiveness of compiler autovectorization.
2930

30-
Instruction mix is useful when you need to confirm that performance-critical code uses Arm CPU features effectively. This is especially helpful when you are, for example, validating the effectiveness of compiler autovectorization.
31-
32-
For example, if a hot function is mostly scalar at runtime when you expected NEON or SVE activity, that often indicates missed vectorization opportunities. You can then focus optimization work on compiler flags, data layout, loop structure, and kernel implementation to improve throughput where it matters most.
31+
For example, if a hot function is mostly scalar at runtime when you expected Neon or SVE activity, that often indicates missed vectorization opportunities. You can then focus optimization work on compiler flags, data layout, loop structure, and kernel implementation to improve throughput where it matters most.
3332

3433
## GPT-2 as a test workload
3534

36-
You can run the [GPT-2 Medium](https://huggingface.co/openai-community/gpt2-medium) model on a minimal C++ inference engine to analyze instruction mix and throughput. This model is available under a [modified MIT License](https://github.com/openai/gpt-2/blob/master/LICENSE). You will confirm that matrix multiplication (`matmul`) is the hot path, then compare how scalar, NEON, and SVE implementations change instruction behavior and token generation speed.
35+
You can run the [GPT-2 Medium](https://huggingface.co/openai-community/gpt2-medium) model on a minimal C++ inference engine to analyze instruction mix and throughput. This model is available under a [modified MIT License](https://github.com/openai/gpt-2/blob/master/LICENSE). You will confirm that matrix multiplication (`matmul`) is the hot path, then compare how scalar, Neon, and SVE implementations change instruction behavior and token generation speed.
36+
37+
You'll implement only the forward inference path, with no back propagation or training. You don't need to understand the full transformer architecture to complete this Learning Path. Familiarity with matrix multiplication is enough. For background on GPT-2, see the original 2019 paper, [Language Models are Unsupervised Multitask Learners](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf).
3738

38-
This example implements only the forward inference path, with no back propagation or training. You do not need to understand the full transformer architecture to complete this Learning Path. Familiarity with matrix multiplication is enough. For background on GPT-2, see the original 2019 paper, [Language Models are Unsupervised Multitask Learners](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
39+
You'll also try implementing your own `matmul` kernels that target Neon and SVE, then use instruction mix data to verify that these vector paths are active and improving throughput.
3940

40-
You will also try implementing your own `matmul` kernels that target NEON and SVE, then use instruction mix data to verify that these vector paths are active and improving throughput.
41+
## What you've learned and what's next
4142

42-
## Next steps
43+
You now know what the Arm Instruction Mix recipe represents and why it matters for LLM inference optimization on Arm.
4344

44-
You now know what instruction mix represents and why it matters for LLM inference optimization on Arm. Next, you'll set up the GPT-2 example, build the binaries, and run a baseline test.
45+
Next, you'll set up the GPT-2 example, build the binaries, and run a baseline test.

0 commit comments

Comments
 (0)