[Bug target/86393] GCC-8 appears to not detect AVX512 on iMac Pro 2018

2019-09-04 Thread mrslevinsky at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86393

--- Comment #10 from Mikael Slevinsky  ---
I can confirm this is fixed, thank you!

P.S. the exact processor type is a Xeon(R) W-2191B CPU @ 2.30GHz.

scima-mh421-20:Desktop mikael$ sysctl -a |grep cpu
hw.ncpu: 36
hw.activecpu: 36
hw.physicalcpu: 18
hw.physicalcpu_max: 18
hw.logicalcpu: 36
hw.logicalcpu_max: 36
hw.cputype: 7
hw.cpusubtype: 8
hw.cpu64bit_capable: 1
hw.cpufamily: 939270559
hw.cpufrequency: 23
hw.cpufrequency_min: 23
hw.cpufrequency_max: 23
hw.cputhreadtype: 1
machdep.cpu.max_basic: 22
machdep.cpu.max_ext: 2147483656
machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel(R) Xeon(R) W-2191B CPU @ 2.30GHz
machdep.cpu.family: 6
machdep.cpu.model: 85
machdep.cpu.extmodel: 5
machdep.cpu.extfamily: 0
machdep.cpu.stepping: 4
machdep.cpu.feature_bits: 9223086162756500479
machdep.cpu.leaf7_feature_bits: 3550478331
machdep.cpu.extfeature_bits: 1241984796928
machdep.cpu.signature: 329300
machdep.cpu.brand: 0
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 SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC
MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2
BMI2 INVPCID RTM SMAP RDSEED ADX IPT AVX512F AVX512CD AVX512DQ AVX512BW
AVX512VL PQM FPU_CSDS MPX PQE CLFSOPT
machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP
TSCI
machdep.cpu.logical_per_package: 64
machdep.cpu.cores_per_package: 32
machdep.cpu.microcode_version: 33554526
machdep.cpu.processor_flag: 1
machdep.cpu.mwait.linesize_min: 64
machdep.cpu.mwait.linesize_max: 64
machdep.cpu.mwait.extensions: 3
machdep.cpu.mwait.sub_Cstates: 8224
machdep.cpu.thermal.sensor: 1
machdep.cpu.thermal.dynamic_acceleration: 1
machdep.cpu.thermal.invariant_APIC_timer: 1
machdep.cpu.thermal.thresholds: 2
machdep.cpu.thermal.ACNT_MCNT: 1
machdep.cpu.thermal.core_power_limits: 1
machdep.cpu.thermal.fine_grain_clock_mod: 1
machdep.cpu.thermal.package_thermal_intr: 1
machdep.cpu.thermal.hardware_feedback: 0
machdep.cpu.thermal.energy_policy: 1
machdep.cpu.xsave.extended_state: 255 2688 2688 0
machdep.cpu.xsave.extended_state1: 15 2432 256 0
machdep.cpu.arch_perf.version: 4
machdep.cpu.arch_perf.number: 4
machdep.cpu.arch_perf.width: 48
machdep.cpu.arch_perf.events_number: 7
machdep.cpu.arch_perf.events: 0
machdep.cpu.arch_perf.fixed_number: 3
machdep.cpu.arch_perf.fixed_width: 48
machdep.cpu.cache.linesize: 64
machdep.cpu.cache.L2_associativity: 16
machdep.cpu.cache.size: 256
machdep.cpu.tlb.inst.large: 8
machdep.cpu.tlb.data.small: 64
machdep.cpu.tlb.data.small_level1: 64
machdep.cpu.address_bits.physical: 46
machdep.cpu.address_bits.virtual: 48
machdep.cpu.core_count: 18
machdep.cpu.thread_count: 36
machdep.cpu.tsc_ccc.numerator: 192
machdep.cpu.tsc_ccc.denominator: 2
machdep.xcpm.cpu_thermal_level: 0

[Bug target/86393] GCC-8 appears to not detect AVX512 on iMac Pro 2018

2019-09-05 Thread mrslevinsky at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86393

--- Comment #12 from Mikael Slevinsky  ---
It is fixed for all GCC versions I checked: all the up-to-date versions of 4.9,
5, 6, 7, 8, 9 from Homebrew.

Also, I recently updated from High Sierra to Mojave, and the new clang is:

scima-mh421-20:FastTransforms mikael$ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

(In reply to Iain Sandoe from comment #11)
> (In reply to Mikael Slevinsky from comment #10)
> > I can confirm this is fixed, thank you!
> 
> Great, for which GCC versions is it fixed?
> 
> > P.S. the exact processor type is a Xeon(R) W-2191B CPU @ 2.30GHz.
> 
> thanks

[Bug c/86393] New: GCC-8 appears to not detect AVX512 on iMac Pro 2018

2018-07-03 Thread mrslevinsky at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86393

Bug ID: 86393
   Summary: GCC-8 appears to not detect AVX512 on iMac Pro 2018
   Product: gcc
   Version: 8.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mrslevinsky at hotmail dot com
  Target Milestone: ---

On GCC-8, build details:

dhcp-10-45-0-78:~ mikael$ gcc-8 -v
Using built-in specs.
COLLECT_GCC=gcc-8
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/8.1.0/libexec/gcc/x86_64-apple-darwin17.5.0/8.1.0/lto-wrapper
Target: x86_64-apple-darwin17.5.0
Configured with: ../configure --build=x86_64-apple-darwin17.5.0
--prefix=/usr/local/Cellar/gcc/8.1.0
--libdir=/usr/local/Cellar/gcc/8.1.0/lib/gcc/8
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl
--with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC
8.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-nls
Thread model: posix
gcc version 8.1.0 (Homebrew GCC 8.1.0)

the compiler appears to fail to detect that the iMac Pro 2018 with a Skylake W
generation Intel Xeon W processor has AVX512 vectorization capabilities,
turning many compiler optimizations off:

dhcp-10-45-0-78:~ mikael$ gcc-8 -march=native -E -v - &1 | grep
cc1
 /usr/local/Cellar/gcc/8.1.0/libexec/gcc/x86_64-apple-darwin17.5.0/8.1.0/cc1 -E
-quiet -v -D__DYNAMIC__ - -march=skylake-avx512 -mmmx -mno-3dnow -msse -msse2
-msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul
-mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2
-mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt
-mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave
-mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf
-mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw
-mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps
-mno-avx5124vnniw -mclwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid -mno-gfni
-mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq
-mno-avx512bitalg -mno-movdiri -mno-movdir64b --param l1-cache-size=32 --param
l1-cache-line-size=64 --param l2-cache-size=25344 -mtune=skylake-avx512 -fPIC
-mmacosx-version-min=10.13.0

On the contrary, clang-6 appears to enable AVX512:

dhcp-10-45-0-78:~ mikael$ /usr/local/opt/llvm/bin/clang -march=native -E -v -
&1 | grep cc1
 "/usr/local/Cellar/llvm/6.0.0/bin/clang-6.0" -cc1 -triple
x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage
-Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2
-mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables
-target-cpu skylake-avx512 -target-feature +sse2 -target-feature +cx16
-target-feature -tbm -target-feature -avx512ifma -target-feature -gfni
-target-feature -sha -target-feature -fma4 -target-feature -vpclmulqdq
-target-feature +prfchw -target-feature +bmi2 -target-feature +xsavec
-target-feature +fsgsbase -target-feature +popcnt -target-feature +aes
-target-feature -avx512bitalg -target-feature +xsaves -target-feature -avx512er
-target-feature -avx512vnni -target-feature -avx512vpopcntdq -target-feature
+clwb -target-feature -avx512f -target-feature -clzero -target-feature -pku
-target-feature +mmx -target-feature -lwp -target-feature -xop -target-feature
+rdseed -target-feature -ibt -target-feature -sse4a -target-feature -avx512bw
-target-feature +clflushopt -target-feature +xsave -target-feature -avx512vbmi2
-target-feature -avx512vl -target-feature -avx512cd -target-feature +avx
-target-feature -vaes -target-feature +rtm -target-feature +fma -target-feature
+bmi -target-feature +rdrnd -target-feature -mwaitx -target-feature +sse4.1
-target-feature +sse4.2 -target-feature +avx2 -target-feature +sse
-target-feature +lzcnt -target-feature +pclmul -target-feature -prefetchwt1
-target-feature +f16c -target-feature +ssse3 -target-feature -sgx
-target-feature -shstk -target-feature +cmov -target-feature -avx512vbmi
-target-feature +movbe -target-feature +xsaveopt -target-feature -avx512dq
-target-feature +adx -target-feature -avx512pf -target-feature +sse3
-dwarf-column-info -debugger-tuning=lldb -target-linker-version 305 -v
-resource-dir /usr/local/Cellar/llvm/6.0.0/lib/clang/6.0.0
-fdebug-compilation-dir /Users/mikael -ferror-limit 19 -fmessage-length 0
-stack-protector 1 -fblocks -fencode-extended-block-signature
-fobjc-runtime=macosx-10.13.0 -fmax-type-align=16 -fdiagnostics-show-option -o
- -x c -
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target
x86_64-apple-darwin17.4.0

[Bug target/86393] GCC-8 appears to not detect AVX512 on iMac Pro 2018

2018-07-03 Thread mrslevinsky at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86393

--- Comment #2 from Mikael Slevinsky  ---
I'm not so sure. Consider the following minimal test file:

#include 
#include 

int main(void) {
double * X, * Y, * Z;
X = (double *) calloc(8, sizeof(double));
Y = (double *) calloc(8, sizeof(double));
Z = (double *) calloc(8, sizeof(double));

for (int i = 0; i < 8; i++) {
X[i] = (double) i;
Y[i] = ((double) i)*((double) 2*i+1);
}

for (int i = 0; i < 8; i++)
Z[i] = X[i] + Y[i];

printf("\n");
for (int i = 0; i < 8; i++) {
printf("%1.2e  ", Z[i]);
}
printf("\n");

return 0;
}


If I call it `testavx512.c`, then AVX512-like assembly is created, but it
errors when trying to create an executable:

dhcp-10-45-0-78:FastTransforms mikael$ gcc-8 -S -O3 -mavx512f testavx512.c -o
testavx512.s
dhcp-10-45-0-78:FastTransforms mikael$ gcc-8 -O3 -mavx512f testavx512.c -o
testavx512
/var/folders/dy/wbvgp8656tg6kwtz8sx_9z_mgn/T//cchgQrNi.s:45:2: error:
instruction requires: AVX-512 ISA
vmovupd 0(%r13), %zmm0
^
/var/folders/dy/wbvgp8656tg6kwtz8sx_9z_mgn/T//cchgQrNi.s:46:2: error:
instruction requires: AVX-512 ISA
vaddpd  (%r12), %zmm0, %zmm0
^
/var/folders/dy/wbvgp8656tg6kwtz8sx_9z_mgn/T//cchgQrNi.s:47:2: error:
instruction requires: AVX-512 ISA
vmovupd %zmm0, (%rax)
^

[Bug target/86393] GCC-8 appears to not detect AVX512 on iMac Pro 2018

2018-07-03 Thread mrslevinsky at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86393

--- Comment #4 from Mikael Slevinsky  ---
I'm not sure if this answers your question, but compiling the same program
(modifying 8 to 128 to tease the compiler into using zmm registers) with
clang-6 works fine.