Skip to content

Commit 453d79b

Browse files
updates
1 parent 84f3ce0 commit 453d79b

2 files changed

Lines changed: 16 additions & 23 deletions

File tree

content/learning-paths/servers-and-cloud-computing/sve2-match/_index.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
---
22
title: Accelerate Search Operations with SVE2 MATCH Instruction on Arm servers
33

4-
draft: true
5-
cascade:
6-
draft: true
74

85
minutes_to_complete: 20
96

@@ -12,12 +9,11 @@ who_is_this_for: This is an introductory topic for database developers, performa
129

1310
learning_objectives:
1411
- Understand how SVE2 MATCH instructions work
15-
- Implement search algorithms using scalar and SVE2 implementations using the MATCH instruction
16-
- Compare performance between different implementations
12+
- Implement search algorithms using scalar and SVE2 implementations using the MATCH instruction
13+
- Compare performance between scalar and vectorized implementations
1714
- Measure performance improvements on Graviton4 instances
1815
prerequisites:
19-
- An [Arm based instance](/learning-paths/servers-and-cloud-computing/csp/) from an appropriate
20-
cloud service provider.
16+
- Access to an [Arm-based instance](/learning-paths/servers-and-cloud-computing/csp/) from a supported cloud service provider
2117

2218
author: Pareena Verma
2319

content/learning-paths/servers-and-cloud-computing/sve2-match/sve2-match-search.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# User change
3-
title: "Compare performance of different Search implementations"
3+
title: "Compare Search Performance Using Scalar and SVE2 MATCH on Arm Servers"
44

55
weight: 2
66

@@ -10,39 +10,37 @@ layout: "learningpathall"
1010
---
1111
## Introduction
1212

13-
Searching for specific values in large arrays is a fundamental operation in many applications, from databases to text processing. The performance of these search operations can significantly impact overall application performance, especially when dealing with large datasets.
13+
Searching for specific values in large arrays is a fundamental operation in many applications, from databases to text processing. The performance of these search operations can significantly affect overall application performance, especially when dealing with large datasets.
1414

15-
In this learning path, you will learn how to use the SVE2 MATCH instructions available on Arm Neoverse V2 based AWS Graviton4 processors to optimize search operations in byte and half word arrays. You will compare the performance of scalar and SVE2 MATCH implementations to demonstrate the significant performance benefits of using specialized vector instructions.
15+
In this Learning Path, you will learn how to use the SVE2 MATCH instructions available on Arm Neoverse V2 based AWS Graviton4 processors to optimize search operations in byte and half word arrays. You will compare the performance of scalar and SVE2 MATCH implementations to demonstrate the significant performance benefits of using specialized vector instructions.
1616

1717
## What is SVE2 MATCH?
1818

1919
SVE2 (Scalable Vector Extension 2) is an extension to the Arm architecture that provides vector processing capabilities with a length-agnostic programming model. The MATCH instruction is a specialized SVE2 instruction that efficiently searches for elements in a vector that match any element in another vector.
2020

21-
## Set Up Your Environment
21+
## Set up your environment
2222

2323
To follow this learning path, you will need:
2424

25-
1. An AWS Graviton4 instance running `Ubuntu 24.04`.
25+
1. An AWS Graviton4 instance running `Ubuntu 24.04`
2626
2. GCC compiler with SVE support
2727

28-
Let's start by setting up our environment:
28+
Start by setting up your environment:
2929

3030
```bash
3131
sudo apt-get update
3232
sudo apt-get install -y build-essential gcc g++
3333
```
34-
An effective way to achieve optimal performance on Arm is not only through optimal flag usage, but also by using the most
35-
recent compiler version. This Learning path was tested with GCC 13 which is the default version on `Ubuntu 24.04` but you
36-
can run it with newer versions of GCC as well.
34+
An effective way to achieve optimal performance on Arm is not only through optimal flag usage, but also by using the most recent compiler version. This Learning path was tested with GCC 13 which is the default version on `Ubuntu 24.04` but you can run it with newer versions of GCC as well.
3735

38-
Create a directory for our implementations:
36+
Create a directory for your implementations:
3937
```bash
4038
mkdir -p sve2_match_demo
4139
cd sve2_match_demo
4240
```
4341
## Understanding the Problem
4442

45-
Our goal is to implement a function that searches for any occurrence of a set of keys in an array. The function should return true if any element in the array matches any of the keys, and false otherwise.
43+
Your goal is to implement a function that searches for any occurrence of a set of keys in an array. The function should return true if any element in the array matches any of the keys, and false otherwise.
4644

4745
This type of search operation is common in many applications:
4846

@@ -51,13 +49,13 @@ This type of search operation is common in many applications:
5149
3. **Network Packet Inspection**: Looking for specific byte patterns
5250
4. **Image Processing**: Finding specific pixel values
5351

54-
## Implementing Search Algorithms
52+
## Implementing search algorithms
5553

5654
Let's implement three versions of our search function:
5755

58-
### 1. Generic Scalar Implementation
56+
### 1. Generic scalar implementation
5957

60-
Create a generic implementation in C, checking each element individually against each key. Open a editor of your choice and copy the code shown into a file named `sve2_match_demo.c`:
58+
Create a generic implementation in C that checks each element individually against each key. Open a editor of your choice and copy the code shown into a file named `sve2_match_demo.c`:
6159

6260
```c
6361
#include <arm_sve.h>
@@ -246,7 +244,7 @@ if (svptest_any(pg, match1) || svptest_any(pg, match2) ||
246244
}
247245
```
248246
The main highlights of this implementation are:
249-
- Processes 4 vectors per iteration instead of just one and stops immediately when any match is found in any of the 4 vectors.
247+
- Processes four vectors per iteration instead of just one and stops immediately when any match is found in any of the four vectors.
250248
- Uses prefetching (__builtin_prefetch) to reduce memory latency
251249
- Leverages the svmatch_u8/u16 instruction to efficiently compare each element against multiple keys in a single operation
252250
- Aligns memory to 64-byte boundaries for better memory access performance
@@ -565,4 +563,3 @@ For image processing, MATCH can accelerate:
565563

566564
The SVE2 MATCH instruction provides a powerful way to accelerate search operations in byte and half word arrays. By implementing these optimizations on Graviton4 instances, you can achieve significant performance improvements for your applications.
567565

568-

0 commit comments

Comments
 (0)