-
anyone know? im simdifying some code but i dont have many machines and i need guarantee that i can store at least 6 floats in single Vec. On my machine count reports 8*float but architecturally is only less than 2 years old. I tried reading a bit about registers but it is useless since most sources talk about generic registers (8 for 32 bit, double that for 64 bit) not simd registers |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
128 bits is the min vector register size. For the (current) max the vector register size is 256 bits, so Note:
you'd need at least 256 bits, that's AVX and you can guard your algorithm with if (Avx.IsSupported)
{
// vectorized code path that operates on 8 floats at once
}
else
{
// software fallback for scalar path
} |
Beta Was this translation helpful? Give feedback.
-
We do not have an officially documented minimum or maximum and it ultimately depends on the underlying platform you are targeting. Today, the minimum is 16-bytes and this is what ARM64 however supports If you need to enforce your own minimum for a code-path, I'd recommend a simple |
Beta Was this translation helpful? Give feedback.
-
@tannergooding @gfoidl BTW what happens to Vec if used on hardware that has |
Beta Was this translation helpful? Give feedback.
128 bits is the min vector register size.
A float consists of 4 bytes, so 32 bits, hence
Vector<float>
has 128 / 32 = 4 elements.For the (current) max the vector register size is 256 bits, so
Vector<float>
has 256 / 32 = 8 elements.Note:
Vector<T>
does not have a "fixed" size, as it depends on the max. available register size on the executing hardware.In contrast
Vector128
andVector256
are fix in the size of 128 bit and 256 bit respectively. So foryou'd need at least 256 bits, that's AVX and you can guard your algorithm with