"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "numpy/core/src/common/npy_cpu_features.c.src" between
numpy-1.21.0.tar.gz and numpy-1.21.1.tar.gz

About: NumPy is the fundamental package for scientific computing with Python.

npy_cpu_features.c.src  (numpy-1.21.0):npy_cpu_features.c.src  (numpy-1.21.1)
skipping to change at line 397 skipping to change at line 397
// third call to the cpuid to get extended AVX2 & AVX512 feature bits // third call to the cpuid to get extended AVX2 & AVX512 feature bits
npy__cpu_cpuid(reg, 7); npy__cpu_cpuid(reg, 7);
npy__cpu_have[NPY_CPU_FEATURE_AVX2] = (reg[1] & (1 << 5)) != 0; npy__cpu_have[NPY_CPU_FEATURE_AVX2] = (reg[1] & (1 << 5)) != 0;
if (!npy__cpu_have[NPY_CPU_FEATURE_AVX2]) if (!npy__cpu_have[NPY_CPU_FEATURE_AVX2])
return; return;
// detect AVX2 & FMA3 // detect AVX2 & FMA3
npy__cpu_have[NPY_CPU_FEATURE_FMA] = npy__cpu_have[NPY_CPU_FEATURE_FMA3]; npy__cpu_have[NPY_CPU_FEATURE_FMA] = npy__cpu_have[NPY_CPU_FEATURE_FMA3];
// check AVX512 OS support // check AVX512 OS support
if ((xcr & 0xe6) != 0xe6) int avx512_os = (xcr & 0xe6) == 0xe6;
#if defined(__APPLE__) && defined(__x86_64__)
/**
* On darwin, machines with AVX512 support, by default, threads are created
with
* AVX512 masked off in XCR0 and an AVX-sized savearea is used.
* However, AVX512 capabilities are advertised in the commpage and via sysct
l.
* for more information, check:
* - https://github.com/apple/darwin-xnu/blob/0a798f6738bc1db01281fc08ae024
145e84df927/osfmk/i386/fpu.c#L175-L201
* - https://github.com/golang/go/issues/43089
* - https://github.com/numpy/numpy/issues/19319
*/
if (!avx512_os) {
npy_uintp commpage64_addr = 0x00007fffffe00000ULL;
npy_uint16 commpage64_ver = *((npy_uint16*)(commpage64_addr + 0x01E));
// cpu_capabilities64 undefined in versions < 13
if (commpage64_ver > 12) {
npy_uint64 commpage64_cap = *((npy_uint64*)(commpage64_addr + 0x010)
);
avx512_os = (commpage64_cap & 0x0000004000000000ULL) != 0;
}
}
#endif
if (!avx512_os) {
return; return;
}
npy__cpu_have[NPY_CPU_FEATURE_AVX512F] = (reg[1] & (1 << 16)) != 0; npy__cpu_have[NPY_CPU_FEATURE_AVX512F] = (reg[1] & (1 << 16)) != 0;
npy__cpu_have[NPY_CPU_FEATURE_AVX512CD] = (reg[1] & (1 << 28)) != 0; npy__cpu_have[NPY_CPU_FEATURE_AVX512CD] = (reg[1] & (1 << 28)) != 0;
if (npy__cpu_have[NPY_CPU_FEATURE_AVX512F] && npy__cpu_have[NPY_CPU_FEATURE_ AVX512CD]) { if (npy__cpu_have[NPY_CPU_FEATURE_AVX512F] && npy__cpu_have[NPY_CPU_FEATURE_ AVX512CD]) {
// Knights Landing // Knights Landing
npy__cpu_have[NPY_CPU_FEATURE_AVX512PF] = (reg[1] & (1 << 26)) != 0; npy__cpu_have[NPY_CPU_FEATURE_AVX512PF] = (reg[1] & (1 << 26)) != 0;
npy__cpu_have[NPY_CPU_FEATURE_AVX512ER] = (reg[1] & (1 << 27)) != 0; npy__cpu_have[NPY_CPU_FEATURE_AVX512ER] = (reg[1] & (1 << 27)) != 0;
npy__cpu_have[NPY_CPU_FEATURE_AVX512_KNL] = npy__cpu_have[NPY_CPU_F EATURE_AVX512ER] && npy__cpu_have[NPY_CPU_FEATURE_AVX512_KNL] = npy__cpu_have[NPY_CPU_F EATURE_AVX512ER] &&
npy__cpu_have[NPY_CPU_F EATURE_AVX512PF]; npy__cpu_have[NPY_CPU_F EATURE_AVX512PF];
// Knights Mill // Knights Mill
npy__cpu_have[NPY_CPU_FEATURE_AVX512VPOPCNTDQ] = (reg[2] & (1 << 14)) != 0; npy__cpu_have[NPY_CPU_FEATURE_AVX512VPOPCNTDQ] = (reg[2] & (1 << 14)) != 0;
 End of changes. 2 change blocks. 
1 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)