You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/_index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,11 @@ minutes_to_complete: 45
10
10
who_is_this_for: This is an introductory topic for C/C++ developers who are interested in using GitHub Copilot to improve performance using NEON intrinsics.
11
11
12
12
learning_objectives:
13
-
- Use GitHub Copilot to write NEON intrinsics to improve performance of the Adler32 checksum algorithm.
13
+
- Use GitHub Copilot to write NEON intrinsics that accelerate the Adler32 checksum algorithm.
14
14
15
15
prerequisites:
16
16
- An Arm computer running Linux with the GNU compiler (gcc) installed.
17
-
- VS Code with GitHub Copilot installed.
17
+
- Visual Studio Code with the GitHub Copilot extension installed.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/about-2.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,47 +6,47 @@ weight: 2
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Introduction
9
+
## Overview
10
10
11
-
In computing, optimizing performance is crucial for applications that process large amounts of data. This Learning Path focuses on implementing and optimizing the Adler32 checksum algorithm using Arm advanced SIMD (Single Instruction, Multiple Data) capabilities. You'll learn how to leverage GitHub Copilot to simplify the development process while achieving significant performance improvements.
11
+
In computing, optimizing performance is crucial for applications that process large amounts of data. This Learning Path guides you through implementing and optimizing the Adler32 checksum algorithm using Arm advanced SIMD (Single Instruction, Multiple Data) instructions. You'll learn how to leverage GitHub Copilot to simplify the development process while achieving significant performance improvements.
12
12
13
13
## Simplifying Arm NEON Development with GitHub Copilot
14
14
15
15
Developers recognize that Arm NEON SIMD instructions can significantly boost performance for computationally intensive applications, particularly in areas like image processing, audio/video codecs, and machine learning. However, writing NEON intrinsics directly requires specialized knowledge of the instruction set, careful consideration of data alignment, and complex vector operations that can be error-prone and time-consuming. Many developers avoid implementing these optimizations due to the steep learning curve and development overhead.
16
16
17
-
The good news is that AI developer tools such as GitHub Copilot make working with NEON intrinsics much more accessible. By providing intelligent code suggestions, automated vectorization hints, and contextual examples tailored to your specific use case, GitHub Copilot can help bridge the knowledge gap and accelerate the development of NEON-optimized code. This allows developers to harness the full performance potential of Arm processors without the traditional complexity and time-consuming effort.
17
+
The good news is that AI developer tools such as GitHub Copilot make working with NEON intrinsics much more accessible. By providing intelligent code suggestions, automated vectorization hints, and contextual examples tailored to your specific use case, GitHub Copilot can help bridge the knowledge gap and accelerate the development of NEON-optimized code. This allows developers to harness the full performance potential of Arm processors - without the usual complexity and overhead.
18
18
19
-
Writing NEON intrinsics with GitHub Copilot can be demonstrated by creating a complete project from scratch, and comparing the C implementation with the NEON implementation.
19
+
You can demonstrate writing NEON intrinsics with GitHub Copilot by creating a full project from scratch and comparing the C implementation to a NEON-optimized version.
20
20
21
-
While you may not create complete projects from scratch, and you shouldn't blindly trust the generated code, it's helpful to see what's possible using an example so you can apply the principles to your own projects.
21
+
While you may not create complete projects from scratch - and you shouldn't blindly trust the generated code - it's helpful to see what's possible using an example so you can apply the principles to your own projects.
22
+
23
+
## Accelerating Adler32 with Arm NEON
22
24
23
-
## Accelerating Adler32 Checksum with Arm NEON Instructions
24
-
25
-
This project demonstrates how to significantly improve the performance of Adler32 checksum calculations using Arm NEON instructions.
25
+
This project demonstrates how to accelerate Adler32 checksum calculations using Arm NEON instructions.
26
26
27
27
### What is Arm NEON?
28
28
29
29
Arm NEON is an advanced SIMD architecture extension for Arm processors. It provides a set of instructions that can process multiple data elements in parallel using specialized vector registers. NEON technology enables developers to accelerate computationally intensive algorithms by performing the same operation on multiple data points simultaneously, rather than processing them one at a time. This parallelism is particularly valuable for multimedia processing, scientific calculations, and cryptographic operations where the same operation needs to be applied to large datasets.
30
30
31
-
## What is Adler32?
31
+
## What Is the Adler32 Algorithm?
32
32
33
-
Adler32 is a checksum algorithm that was invented by Mark Adler in 1995. It's used in the zlib compression library and is faster than CRC32 but provides less reliable error detection.
33
+
Mark Adler developed the Adler32 checksum algorithm in 1995. It's used in the zlib compression library and is faster than CRC32 but provides less reliable error detection.
34
34
35
35
The algorithm works by calculating two 16-bit sums:
36
36
37
-
- s1: A simple sum of all bytes
38
-
- s2: A sum of all s1 values after each byte
39
-
- The final checksum is (s2 << 16) | s1.
37
+
- s1: A simple sum of all bytes.
38
+
- s2: A sum of all s1 values after each byte.
39
+
- The final checksum is `(s2 << 16) | s1`.
40
40
41
-
## Project Overview
41
+
## What You'll Build
42
42
43
-
This project explains how you can use GitHub Copilot to create everything listed below:
43
+
This project walks you through building the following components using GitHub Copilot:
44
44
45
-
-Standard C implementation of Adler32
46
-
-Test program to confirm Adler32 works correctly for inputs of various sizes
47
-
- Makefile to build and run the program
48
-
- Performance measurement code to record how long the algorithm takes
49
-
- NEON version of Adler32 to increase performance
50
-
-Tables showing performance comparison between the standard C version and the NEON version
45
+
-A standard C implementation of Adler32.
46
+
-A test program to validate outputs for various input sizes.
47
+
-A Makefile to build and run the program.
48
+
- Performance measurement code to record how long the algorithm takes.
49
+
-A NEON-optimized version of Adler32.
50
+
-A performance comparison table for both implementations.
51
51
52
52
Continue to the next section to start creating the project.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/build-6.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,14 @@ weight: 6
6
6
layout: learningpathall
7
7
---
8
8
9
-
## How can I test the build and run?
9
+
## How Can I Build and Run the Test Program?
10
10
11
-
The required files are now complete to test the Adler32 algorithm.
12
-
-Adler32 C function
13
-
-Test program to call the Adler32 function to test for correctness and measure performance
14
-
- Makefile to build and run
11
+
You now have all the required files to test the Adler32 algorithm:
12
+
-A C implementation of the Adler32 function.
13
+
-A test program to verify correctness and measure performance.
14
+
-A Makefile to build and run the project.
15
15
16
-
Copy the information below to your GitHub Copilot Agent session:
16
+
Paste the following prompt into your GitHub Copilot Agent session:
17
17
18
18
```console
19
19
Use the Makefile to build the project and run to make sure the checksum results are correct for all data sizes.
@@ -57,6 +57,6 @@ The results confirm that your Adler-32 checksum implementation is correct for al
57
57
58
58
```
59
59
60
-
The results from GitHub Copilot explain that the Adler32 checksum calculations are correct and give some initial performance results. The results don't mean much yet as there is nothing to compare with.
60
+
The results from GitHub Copilot confirm that the Adler32 checksum calculations are correct and provide initial performance benchmarks. These results offer a solid baseline, but a meaningful comparison requires an optimized implementation.
61
61
62
-
Continue to the next section to implement Adler32 using NEON and compare the performance.
62
+
In the next section, you’ll implement Adler32 using NEON intrinsics and compare its performance against this baseline.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/makefile-5.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ weight: 5
6
6
layout: learningpathall
7
7
---
8
8
9
-
## How can I create a Makefile to build and run the test program?
9
+
## How Can I Create a Makefile to Build and Run the Test Program?
10
10
11
-
To create a Makefile, copy and paste the information below to GitHub Copilot. The prompt explains that the Makefile should use`gcc`as the compiler and target the Neoverse N1 processor.
11
+
Paste the following prompt into GitHub Copilot. It tells Copilot to generate a Makefile that uses`gcc` and targets the Neoverse N1 processor for optimized performance.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/more-11.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,11 @@ layout: learningpathall
8
8
9
9
## What else can I do with GitHub Copilot on this project?
10
10
11
-
You can investigate more topics using GitHub Copilot.
11
+
GitHub Copilot can help you explore additional performance and optimization ideas:
12
12
13
-
-Direct GitHub Copilot to try different compiler flags and use Agent mode to iterate through the options to find the best solution.
14
-
- Add support for the Clang compiler to the Makefile and compare the results to GCC. Depending on the application code, changing the compiler can result in improved performance.
15
-
-Use GitHub Copilot to generate different data sizes and random data patterns to further investigate correct functionality and performance.
16
-
-Try different algorithm implementations that use compiler autovectorization instead of NEON intrinsics or break down the Adler32 checksum into smaller blocks of data. It may be possible to get even better performance without NEON using the compiler and a better structure for the C code.
13
+
-Test different compiler flags using Agent mode to automate iteration and identify the best combinations.
14
+
- Add Clang support to your Makefile and compare performance against GCC — performance can differ significantly depending on your code structure.
15
+
-Generate a wider range of data sizes and random patterns to stress-test functionality and measure performance under varied conditions.
16
+
-Explore alternative algorithm structures that rely on compiler autovectorization instead of NEON intrinsics — you might discover better performance simply by restructuring the C code.
17
17
18
-
While AI tools do not create performance code for every programming problem, they can be a big help to get you started in a new area of programming such as performance optimization using NEON intrinsics.
18
+
AI tools won’t always generate high-performance code out of the box, but they can rapidly accelerate your experimentation and learning — especially in new areas of programming like NEON-based performance optimization.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/neon-7.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ weight: 7
6
6
layout: learningpathall
7
7
---
8
8
9
-
## How can I create a NEON version of Adler32 to improve performance?
9
+
## How Can I Create a NEON Version of Adler32 To Improve Performance?
10
10
11
11
Writing NEON intrinsics is an advanced programming topic which requires time and effort to learn and apply. GitHub Copilot is a good way to get started with NEON, both to write new code and to debug issues during development.
12
12
13
-
You can instruct Github Copilot to create a NEON version of Adler32 using the prompt below.
13
+
You can instruct Github Copilot to create a NEON-optimized version of Adler32 using the prompt below:
14
14
15
15
```console
16
16
Add a second implementation of adler32 that processes data in blocks and uses Arm NEON intrinsics to improve performance.
@@ -553,6 +553,6 @@ Now that I've created the NEON implementation and updated the test code and Make
553
553
554
554
```
555
555
556
-
GitHub Copilot generated a new implementation of Adler32 using NEON intrinsics. It also updated the test program and the Makefile to make it easy to compare the two versions.
556
+
GitHub Copilot generated a NEON-optimized implementation of Adler32, along with updates to the test program and Makefile. These changes make it easy to compare the performance of both versions.
557
557
558
-
Continue to the next section to compile and run the NEON version and investigate performance.
558
+
Continue to the next section to compile and run the NEON version, and to compare its performance against the original implementation.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/neon-run-8.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ weight: 8
6
6
layout: learningpathall
7
7
---
8
8
9
-
## How can I run the NEON version of Adler32 and compare performance?
9
+
## How Can I Run the NEON Version of Adler32 and Compare Performance?
10
10
11
-
The first step to investigate if NEON can provide improved performance is to make sure the NEON version builds, runs, and matches the results of the C version.
11
+
Before comparing performance, you need to ensure that the NEON implementation builds, runs, and produces the same results as the standard C version.
12
12
13
13
To build the NEON version and compare it to the C version use the prompt below in your GitHub Copilot Agent session:
14
14
@@ -123,6 +123,6 @@ The NEON implementation offers significant performance improvements (up to 5x fa
123
123
If you'd like, I can analyze the code to identify and fix the issue in the NEON implementation so you can maintain both correctness and the performance benefits.
124
124
```
125
125
126
-
GitHub Copilot has come to the conclusion that although the NEON version looks like it offers better performance, it does not produce the correct results for the checksums. Obviously, this is not a good result which needs to be fixed.
126
+
GitHub Copilot determined that while the NEON version delivers better performance, it currently produces incorrect checksums. This must be addressed before the NEON implementation can be considered correct or production-ready.
127
127
128
-
Continue to the next section to fix the functional issues and continue with the performance comparison.
128
+
In the next section, you'll fix the functional issues in the NEON implementation and re-run the performance comparison.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/simple-c-3.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
-
title: Create a C version of Adler32
2
+
title: Create a C Version of Adler32
3
3
weight: 3
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
9
-
## How can I generate a C function for Adler32?
9
+
## How Can I Generate a C Function for Adler32?
10
10
11
11
You can use GitHub Copilot to generate a simple C version of the Adler32 checksum algorithm.
12
12
@@ -191,6 +191,6 @@ The Adler-32 algorithm works by calculating two 16-bit sums (A and B) and combin
191
191
As requested, I did not include a main function, so this code can be used as a library for other C files.
192
192
```
193
193
194
-
You now have the files `adler32-simple.c` and `adler32-simple.h` in your directory which compute the Adler32 checksum. These will serve as the reference implementations of the algorithm with baseline performance.
194
+
You now have the files `adler32-simple.c` and `adler32-simple.h` in your directory. These serve as the reference implementation of the Adler32 algorithm with baseline performance.
195
195
196
196
Continue to the next section to create the test application.
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/adler32/summary-10.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,13 @@ weight: 10
6
6
layout: learningpathall
7
7
---
8
8
9
-
## How can I summarize the project results?
9
+
## How Can I Summarize the Project Results?
10
10
11
11
You can use GitHub Copilot to generate a project summary in a README file.
12
12
13
-
Copy the prompt below to your GitHub Copilot Agent chat and review the created README file.
13
+
Use the prompt below to collaborate with GitHub Copilot Agent to generate your README.
14
+
15
+
Review and refine the results to align them with your project's goals.
14
16
15
17
```console
16
18
Review the files in my project.
@@ -20,7 +22,7 @@ Add a note that the performance results recorded on the Neoverse N1 processor.
20
22
Use a table to compare the original version and the NEON version and show the performance improvement factor.
21
23
```
22
24
23
-
Below is the created README.md file. The formatting doesn't match the Learning Path template exactly, but you can copy the the README file to a new repository in GitHub for improved results.
25
+
Below is the created README.md file. The formatting doesn't match the Learning Path template exactly, but you can copy the README file to a new repository in GitHub for improved results.
24
26
25
27
## Adler-32 Checksum Implementation Comparison
26
28
@@ -93,6 +95,15 @@ The table summarizes the speedup obtained by the NEON version.
93
95
94
96
Using Agent mode in GitHub Copilot is a significant benefit when you are actively building and running software. Agent mode can create files and modify them to make needed improvements.
95
97
96
-
The entire project was done without modifying any of the generated files. While you may not need to do this on a real project, the concept of writing NEON intrinsics to improve performance was demonstrated. You can also use GitHub Copilot to fix issues in NEON code that are difficult to debug for developers who are not experts.
98
+
### Tips for Using GitHub Copilot Effectively
99
+
100
+
This project was completed using GitHub Copilot Agent without modifying the generated files. While that might not be practical in every case, the demonstration shows how NEON intrinsics can significantly boost performance.
101
+
102
+
GitHub Copilot is especially useful for:
103
+
* Generating vectorized versions of scalar code.
104
+
* Writing and adapting NEON intrinsics.
105
+
* Identifying and fixing bugs in complex low-level code, even for developers who aren’t SIMD experts.
97
106
98
107
Make sure to try different LLMs with Copilot as the results will vary greatly depending on the model.
0 commit comments