Skip to content

Commit bf00850

Browse files
Updates
1 parent acc2a7a commit bf00850

1 file changed

Lines changed: 44 additions & 42 deletions

File tree

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
---
2-
title: Migrating SIMD code to the Arm architecture
2+
title: "Migrating SIMD code to the Arm architecture"
33
weight: 3
44

5-
### FIXED, DO NOT MODIFY
6-
layout: learningpathall
5+
# FIXED, DO NOT MODIFY
6+
layout: "learningpathall"
77
---
88

99
## Vectorization on x86 and Arm
1010

1111
Migrating SIMD (Single Instruction, Multiple Data) code from x86 extensions to Arm extensions is an important task for software developers aiming to optimize performance on Arm platforms.
1212

13-
Understanding the mapping between x86 instruction sets like SSE, AVX, and AMX to Arm's NEON, SVE, and SME extensions is essential for ensuring portability and high performance. This Learning Path provides an overview to help you design a migration plan, leveraging Arm features such as scalable vector lengths and advanced matrix operations, to effectively adapt your code.
13+
Understanding the mapping from x86 instruction sets such as SSE, AVX, and AMX to Arms NEON, SVE, and SME extensions is essential for achieving portability and high performance. This Learning Path provides an overview to help you design a migration plan, leveraging Arm features such as scalable vector lengths and advanced matrix operations to adapt your code effectively.
1414

15-
Vectorization is a key optimization strategy where one instruction processes multiple data elements simultaneously. It drives performance in HPC, AI/ML, signal processing, and data analytics.
15+
Vectorization is a key optimization strategy where one instruction processes multiple data elements simultaneously. It drives performance in High-Performance Computing (HPC), AI and ML, signal processing, and data analytics.
1616

17-
Both x86 and Arm processors offer rich SIMD capabilities, but they differ in philosophy and design. The x86 architecture provides fixed-width vector units of 128, 256, and 512 bits. The Arm architecture offers a mix of fixed-width, for NEON, and scalable vectors for SVE and SME ranging from 128 to 2048 bits.
17+
Both x86 and Arm processors offer rich SIMD capabilities, but they differ in philosophy and design. The x86 architecture provides fixed-width vector units of 128, 256, and 512 bits. The Arm architecture offers fixed-width vectors for NEON and scalable vectors for SVE and SME, ranging from 128 to 2048 bits.
1818

19-
If you are interested in migrating SIMD software to Arm, understanding these differences ensures portable, high-performance code.
19+
If you are migrating SIMD software to Arm, understanding these differences helps you write portable, high-performance code.
2020

2121
## Arm vector and matrix extensions
2222

2323
### NEON
2424

25-
NEON is a 128bit SIMD extension available across Armv8A cores (including Neoverse and mobile). It is well suited to multimedia, DSP, and packet processing. Conceptually, NEON is closest to x86 SSE (and AVX used in 128bit mode), making it the primary target when migrating SSE workloads. Compiler autovectorization to NEON is mature, reducing the need for manual intrinsics.
25+
NEON is a 128-bit SIMD extension available across Armv8-A cores, including Neoverse and mobile. It is well suited to multimedia, DSP, and packet processing. Conceptually, NEON is closest to x86 SSE and AVX used in 128-bit mode, making it the primary target when migrating many SSE workloads. Compiler auto-vectorization to NEON is mature, reducing the need for manual intrinsics.
2626

2727
### Scalable Vector Extension (SVE)
2828

2929
SVE introduces a revolutionary approach to SIMD with its vector-length agnostic (VLA) design. Registers in SVE can range from 128 to 2048 bits, with the exact width determined by the hardware implementation in multiples of 128 bits. This flexibility allows the same binary to run efficiently across different hardware generations. SVE also features advanced capabilities like per-element predication, which eliminates branch divergence, and native support for gather/scatter operations, enabling efficient handling of irregular memory accesses. While SVE is ideal for high-performance computing (HPC) and future-proof portability, developers must adapt to its unique programming model, which differs significantly from fixed-width SIMD paradigms. SVE is most similar to AVX-512 on x86, offering greater portability and scalability.
3030

3131
### Scalable Matrix Extension (SME)
3232

33-
SME is designed to accelerate matrix multiplication and is similar to AMX. Unlike AMX, which relies on dot-product-based operations, SME employs outer-product-based operations, providing greater flexibility for custom AI and HPC kernels. SME integrates seamlessly with SVE, utilizing scalable tiles and a streaming mode to optimize performance. It is particularly well-suited for AI training and inference workloads, as well as dense linear algebra in HPC applications.
33+
SME accelerates matrix multiplication and is similar in intent to AMX. Unlike AMX, which often uses dot-product oriented operations, SME employs outer-product oriented operations. SME integrates with SVE, using scalable tiles and a streaming mode to optimize performance. It is well suited to AI training and inference, as well as dense linear algebra in HPC applications.
3434

3535
## x86 vector and matrix extensions
3636

@@ -42,78 +42,80 @@ However, its fixed-width design can constrain throughput compared with newer ext
4242

4343
### Advanced Vector Extensions (AVX)
4444

45-
AVX introduces 256bit YMM registers and AVX512 adds 512bit ZMM registers. Features include FMA, mask registers (AVX512), and VEX/EVEX encodings. Migrating AVX code to Arm typically maps 128bit work to NEON and vector‑scalable algorithms to SVE. Because SVE is VLA, refactoring for predication and scalable loops is recommended.
45+
AVX provides 256-bit YMM registers, and AVX-512 adds 512-bit ZMM registers. Features include FMA, per-lane masking in AVX-512, and VEX or EVEX encodings. When moving AVX workloads to Arm, 128-bit paths often translate to NEON, while algorithms that scale with vector width are good candidates for SVE. Because SVE is vector-length agnostic, refactor for predication and scalable loops to maintain portability and performance.
4646

4747
### Advanced Matrix Extensions (AMX)
4848

49-
AMX accelerates matrix operations with **tile** registers configured via a tile palette. It suits AI workloads such as GEMM and convolutions. When migrating AMX kernels to Arm, target SME. While both target matrix compute, AMX commonly expresses **dot products**; SME focuses on **outer products**, so porting often entails algorithmic adjustments.
49+
AMX accelerates matrix operations with tile registers configured using a tile palette. It suits AI workloads such as GEMM and convolutions. When migrating AMX kernels to Arm, target SME. While both target matrix compute, AMX commonly expresses dot products, while SME focuses on outer products, so porting often entails algorithmic adjustments.
5050

5151
## Comparison tables
5252

5353
### SSE vs. NEON
5454

5555
| Feature | SSE | NEON |
5656
|---|---|---|
57-
| **Register width** | 128bit (XMM) | 128bit (Q) |
57+
| **Register width** | 128-bit (XMM) | 128-bit (Q) |
5858
| **Vector length model** | Fixed 128 bits | Fixed 128 bits |
59-
| **Predication / masking** | Minimal; no dedicated mask registers | No dedicated mask registers; use bitwise selects and conditionals |
60-
| **Gather / scatter** | No native gather/scatter (gather in AVX2; scatter in AVX512) | No native gather/scatter; emulate in software |
61-
| **Instruction set scope** | Arithmetic, logical, shuffle, convert, basic SIMD | Arithmetic, logical, shuffle, saturating ops; cryptography via Armv8 Crypto Extensions (AES/SHA) |
62-
| **Floatingpoint support** | Single and double precision | Single and double precision |
59+
| **Predication or masking** | Minimal, no dedicated mask registers | No dedicated mask registers; use bitwise selects and conditionals |
60+
| **Gather or scatter** | No native gather or scatter; gather in AVX2 and scatter in AVX-512 | No native gather or scatter; emulate in software |
61+
| **Instruction set scope** | Arithmetic, logical, shuffle, convert, basic SIMD | Arithmetic, logical, shuffle, saturating ops; cryptography via Armv8 Cryptography Extensions (AES and SHA) |
62+
| **Floating-point support** | Single and double precision | Single and double precision |
6363
| **Typical applications** | Legacy SIMD, general vector arithmetic | Multimedia, DSP, cryptography, embedded compute |
64-
| **Extensibility** | Extended by AVX/AVX2/AVX512 | Fixed at 128bit; scalable vectors provided by **SVE** (separate extension) |
65-
| **Programming model** | Intrinsics in C/C++; assembly for hotspots | Intrinsics widely used; inline assembly less common |
64+
| **Extensibility** | Extended by AVX, AVX2, and AVX-512 | Fixed at 128-bit; scalable vectors provided by SVE as a separate extension |
65+
| **Programming model** | Intrinsics in C or C plus plus; assembly for hotspots | Intrinsics widely used; inline assembly less common |
6666

6767
### AVX vs. SVE (SVE2)
6868

69-
| Feature | x86: AVX / AVX512 | Arm: SVE / SVE2 |
69+
| Feature | x86: AVX or AVX-512 | Arm: SVE or SVE2 |
7070
|---|---|---|
71-
| **Register width** | Fixed: 256‑bit (YMM), 512‑bit (ZMM) | Scalable: 128 to 2048 bits (128‑bit steps) |
72-
| **Vector length model** | Fixed; often multiple code paths for different widths | Vector‑length agnostic; same binary adapts to hardware width |
73-
| **Predication / masking** | AVX‑512 mask registers | Rich predication via predicate registers |
74-
| **Gather / scatter** | Gather (AVX2), scatter (AVX‑512) | Native gather/scatter across widths |
75-
| **Key operations** | Wide SIMD, FMA, conflict detection, advanced masking | Wide SIMD, FMA, predication, gather/scatter, reductions, bit‑manipulation |
76-
| **Best suited for** | HPC, AI/ML, scientific compute, analytics | HPC, AI/ML, scientific compute, cloud/scalable workloads |
77-
| **Limitations** | Power/thermal headroom under heavy 512‑bit use; ecosystem complexity | Requires VLA programming style; SVE/SVE2 hardware availability varies by platform |
78-
79-
> **Note:** SVE2 extends SVE with richer integer/DSP capabilities for general‑purpose and media workloads.
71+
| **Register width** | Fixed: 256-bit YMM, 512-bit ZMM | Scalable: 128 to 2048 bits in 128-bit steps |
72+
| **Vector length model** | Fixed; often multiple code paths for different widths | Vector-length agnostic; same binary adapts to hardware width |
73+
| **Predication or masking** | Mask registers in AVX-512 | Rich predication via predicate registers |
74+
| **Gather or scatter** | Gather in AVX2 and scatter in AVX-512 | Native gather and scatter across widths |
75+
| **Key operations** | Wide SIMD, FMA, conflict detection, advanced masking | Wide SIMD, FMA, predication, gather or scatter, reductions, bit manipulation |
76+
| **Best suited for** | HPC, AI and ML, scientific computing, analytics | HPC, AI and ML, scientific computing, cloud and scalable workloads |
77+
| **Limitations** | Power and thermal headroom under heavy 512-bit use; ecosystem complexity | Requires VLA programming style; SVE or SVE2 hardware availability varies by platform |
78+
79+
{{% notice Note %}}
80+
SVE2 extends SVE with richer integer and DSP capabilities for general-purpose and media workloads.
81+
{{% /notice %}}
8082

8183
### AMX vs. SME
8284

8385
| Feature | x86: AMX | Arm: SME |
8486
|---|---|---|
85-
| **Register model** | Tile registers configured via a palette; fixed pertype limits | Scalable matrix tiles integrated with SVE; implementationdependent dimensions |
87+
| **Register model** | Tile registers configured via a palette; fixed per type limits | Scalable matrix tiles integrated with SVE; implementation-dependent dimensions |
8688
| **Vector length model** | Fixed tile geometry per configuration | Scales with SVE vector length and streaming mode |
87-
| **Predication / masking** | Predication not inherent to tiles | Predication via SVE predicate registers |
88-
| **Gather / scatter** | Not provided in AMX tiles (handled elsewhere) | Via SVE integration (gather/scatter) |
89-
| **Key operations** | Dotproductoriented GEMM/convolution | Outerproduct matrix multiply; streaming mode for dense linear algebra |
90-
| **Best suited for** | AI/ML training and inference, GEMM/conv kernels | AI/ML training and inference, scientific/HPC dense linear algebra |
91-
| **Limitations** | Hardware/software availability limited to specific CPUs | Emerging hardware support; compiler/library support evolving |
89+
| **Predication or masking** | Predication not inherent to tiles | Predication via SVE predicate registers |
90+
| **Gather or scatter** | Not provided in AMX tiles; handled elsewhere | Via SVE integration with gather or scatter |
91+
| **Key operations** | Dot-product oriented GEMM and convolution | Outer-product matrix multiply; streaming mode for dense linear algebra |
92+
| **Best suited for** | AI and ML training and inference, GEMM and convolution kernels | AI and ML training and inference, scientific and HPC dense linear algebra |
93+
| **Limitations** | Hardware and software availability limited to specific CPUs | Emerging hardware support; compiler and library support evolving |
9294

9395
## Key differences for developers
9496

9597
### Vector length model
9698

97-
x86 SIMD (SSE/AVX/AVX512) uses fixed widths (128/256/512). This often requires multiple code paths or dispatch strategies. Arm NEON is also fixed at 128bit and is a familiar baseline. **SVE/SME** introduce **vectorlength agnostic** execution from 128 to 2048 bits so the same binary scales across implementations.
99+
x86 SIMD (SSE, AVX, and AVX-512) uses fixed widths of 128, 256, or 512 bits. This often requires multiple code paths or dispatch strategies. Arm NEON is also fixed at 128-bit and is a familiar baseline. SVE and SME introduce vector-length agnostic execution from 128 to 2048 bits so the same binary scales across implementations.
98100

99101
### Programming and intrinsics
100102

101-
x86 intrinsics are extensive, and AVX512 adds masks and lane controls that increase complexity. NEON intrinsics look familiar to SSE developers. SVE/SME use **predication** and scalable loops; prefer **autovectorization** and VLAfriendly patterns over heavy handwritten intrinsics when portability matters.
103+
x86 intrinsics are extensive, and AVX-512 adds masks and lane controls that increase complexity. NEON intrinsics look familiar to SSE developers. SVE and SME use predication and scalable loops. Prefer auto-vectorization and VLA-friendly patterns over heavy hand-written intrinsics when portability matters.
102104

103105
### Matrix acceleration
104106

105-
AMX provides fixedgeometry tile compute optimized for dot products. SME extends Arm’s scalable model with outerproduct math, scalable tiles, and streaming mode. Both AMX and SME are currently available on a **limited set of platforms**.
107+
AMX provides fixed-geometry tile compute optimized for dot products. SME extends Arm’s scalable model with outer-product math, scalable tiles, and streaming mode. Both AMX and SME are currently available on a limited set of platforms.
106108

107109
### Overall summary
108110

109-
Migrating from x86 SIMD to Arm entails adopting Arm’s **scalable** and **predicated** programming model (SVE/SME) for forwardportable performance, while continuing to use NEON for fixedwidth SIMD similar to SSE.
111+
Migrating from x86 SIMD to Arm entails adopting Arm’s scalable and predicated programming model with SVE and SME for forward-portable performance, while continuing to use NEON for fixed-width SIMD similar to SSE.
110112

111113
## Migration tools
112114

113115
Several libraries help translate or abstract SIMD intrinsics to speed up migration. Coverage varies, and some features have no direct analogue.
114116

115-
- **sse2neon** — Open‑source header that maps many SSE2 intrinsics to NEON equivalents. Good for getting code building quickly; still review generated code for performance. <https://github.com/DLTcollab/sse2neon>
116-
- **SIMD Everywhere (SIMDe)** — Header‑only portability layer that implements many x86/Arm intrinsics across ISAs, with scalar fallbacks when SIMD is unavailable. <https://github.com/simd-everywhere/simde>
117-
- **Google Highway (hwy)** — Portable SIMD library and APIs that target multiple ISAs (NEON, SVE where supported, AVX, etc.) for high‑performance data processing without perISA code paths. <https://github.com/google/highway>
117+
- **sse2neon:** open-source header that maps many SSE2 intrinsics to NEON equivalents. Good for getting code building quickly. Review generated code for performance. <https://github.com/DLTcollab/sse2neon>
118+
- **SIMD Everywhere (SIMDe):** header-only portability layer that implements many x86 and Arm intrinsics across ISAs, with scalar fallbacks when SIMD is unavailable. <https://github.com/simd-everywhere/simde>
119+
- **Google Highway (hwy):** portable SIMD library and APIs that target multiple ISAs, including NEON, SVE where supported, and AVX, without per-ISA code paths. <https://github.com/google/highway>
118120

119-
For more on crossplatform intrinsics, see [Porting architecturespecific intrinsics](/learning-paths/cross-platform/intrinsics/).
121+
For more on cross-platform intrinsics, see [Porting architecture-specific intrinsics](/learning-paths/cross-platform/intrinsics/).

0 commit comments

Comments
 (0)