问题描述
我见过的AOS(结构数组)之间进行比较常见的:
I've seen common comparisons made between the AoS (Array of Structures):
struct xyz
{
ALIGNED float x, y, z, ignored;
};
ALIGNED struct xyz AoS[n];
以及SOA(数组结构):
And the SoA (Structure of Arrays):
struct SoA
{
ALIGNED_AND_PADDED float x[n];
ALIGNED_AND_PADDED float y[n];
ALIGNED_AND_PADDED float z[n];
};
那么,什么将这种数据重新presentation被称为?
So what would this kind of data representation be called?
struct xyz4
{
ALIGNED float x[4];
ALIGNED float y[4];
ALIGNED float z[4];
};
ALIGNED struct xyz4[n/4] ???;
一个缓存高效的SOA?一个AoSoA?一个索奥声? APITA至code?这似乎是最有效的解决方案一般来说,提供SOA式SIMD有大量的缓存命中。
A "cache-efficient SoA"? An AoSoA? An SoAoS? A "PITA to code"? It seems like the most efficient solution generally speaking, providing SoA-type SIMD with a lot of cache hits.
推荐答案
这是数据结构有多个名字,如阵列的混合结构(见的一个类似C语言)或数组的结构(AoSoA)的数组。
That data structure has multiple names such as a Hybrid Structure of Arrays (see Extending a C-like Language for Portable SIMD Programming) or an array of struct of arrays (AoSoA).
AOS是不适合的SIMD。 SOA是一种改进,但在某些情况下,仍是不充分的。解决的办法是阵列中的混合结构。它可能是一个PITA像你说的,但是这是你,如果你想从SIMD最高的效率有时会使用什么(除非收集和分散指令成为有效)。
AoS is not suitable for SIMD. SoA is an improvement but in some cases is still not sufficient. The solution is a Hybrid Structure of Arrays. It may be a PITA as you say but that's what you have to use sometimes if you want the highest efficient from SIMD (unless gather and scatter instructions become efficient).
这篇关于什么叫这个结构?简单SOA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!