On Tuesday, 6 December 2016 at 09:12:16 UTC, Walter Bright wrote:
I've been experimenting with code generation in DMD for the AVX
instruction set, in particular the replacement of SSE 16 byte
vectors with AVX 16 byte vectors (no, not the 32 byte ones!).
In my experiments on my machines, two of them support the AVX
instruction set,
one of which is my Mac Mini, as determined by this program:
import core.stdc.stdio;
import core.cpuid;
void main() {
printf("%d %d\n", core.cpuid.avx, core.cpuid.avx2);
}
or by running:
sysctl -a | grep machdep.cpu.features
and looking for AVX1.0.
My Mac Mini sez:
~> sysctl -a | grep machdep.cpu.features
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 CX16 TPR PDCM
SSE4.1 SSE4.2
xAPIC POPCNT AES PCID XSAVE OSXSAVE TSCTMR AVX1.0
My older MM clearly does not support AVX2, though.
This leads to the question is AVX support a minimum
configuration for Macs? Can AVX instruction generation become
the default for OSX?
No. Avx arrived in sandy bridge, early 2011. The first sandy
bridge processors to land in Macs were shortly after that. macOS
Sierra supports hardware back to late 2009 and the OS X versions
we support work on even earlier hardware.
See everymac.com for apple hardware details.
As far I can tell, -march= / -mcpu= options with native as a
valid specification is the standard, sane way to deal with this.