Skip to content

Commit ec2b4aa

Browse files
Add detailed description and improve diagram caption for data layout optimization
1 parent e622bd4 commit ec2b4aa

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

content/learning-paths/cross-platform/vectorization-friendly-data-layout/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Optimize SIMD code with vectorization-friendly data layout
33

44
minutes_to_complete: 45
55

6+
description: Learn how to optimize SIMD performance on Arm by restructuring data layouts from Array-of-Structures to Structure-of-Arrays, with practical examples using Neon and SVE intrinsics.
7+
68
who_is_this_for: This is an advanced topic for C/C++ developers who are interested in improving the performance of SIMD code.
79

810
learning_objectives:

content/learning-paths/cross-platform/vectorization-friendly-data-layout/data-layout-basics-2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Before trying any optimization, it's important to understand the way the data is
1010

1111
In order to improve the data layout and help the compiler, you need to go back and look at the `object` struct in more detail. The memory layout of `object` is the following:
1212

13-
![Memory layout #center](memory-layout1.svg "Figure 1. struct object memory layout with vec3")
13+
![Diagram showing the memory layout of the object struct using vec3 fields, illustrating the 12-byte alignment issue that prevents efficient SIMD operations#center](memory-layout1.svg "Figure 1. struct object memory layout with vec3")
1414

1515
As the `vec3` types are triplets, their alignment `is 3 x 4 bytes = 12 bytes`. This makes usage of SIMD instructions difficult as they usually operate on data multiples of 16 bytes. Alignment to 16 bytes is also important. You can usually solve this by adding extra bytes in such structures as padding. This results in wasted bytes, but sometimes these can be used for extra information. Even if the extra bytes cannot be used, the performance benefit outweighs the loss in memory.
1616

0 commit comments

Comments
 (0)