Disclaimer: I just started to dive into SIMD.
I think my MacBook Pro doesn't support AVX-512:
$ sysctl -a
...
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
...
hw.optional.avx512f: 0
hw.optional.avx512cd: 0
hw.optional.avx512dq: 0
hw.optional.avx512bw: 0
hw.optional.avx512vl: 0
hw.optional.avx512ifma: 0
hw.optional.avx512vbmi: 0
...
However, the following code buids and runs fine:
use packed_simd::f64x8;
fn main() {
let a = f64x8::splat(0.0);
let b = f64x8::splat(0.0);
println!("{}", (a + b).sum());
}
$ cat .cargo/config
[build]
rustflags = ["-C", "target-cpu=native"]
I wonder if it's compiled into using narrower vectors or scalars? In other words, when using packed_simd
, should I not worry and choose width the most suitable for my task, or should I still care about target features to get most of it?