summaryrefslogtreecommitdiff
path: root/numpy/array_api/_set_functions.py
diff options
context:
space:
mode:
authorDeveloper-Ecosystem-Engineering <65677710+Developer-Ecosystem-Engineering@users.noreply.github.com>2021-10-11 09:26:07 -0700
committerDeveloper-Ecosystem-Engineering <65677710+Developer-Ecosystem-Engineering@users.noreply.github.com>2021-10-11 09:26:07 -0700
commit1b10b89e232f67760617631818ed2c07c4ad0c85 (patch)
tree4a02a6e281681fa2e192cb8942323677f6b3135a /numpy/array_api/_set_functions.py
parentc2d2104356b51be6c9596d354d7fa389c6a8ddbc (diff)
downloadnumpy-1b10b89e232f67760617631818ed2c07c4ad0c85.tar.gz
BUG: AVX-512F log() overflows
LLVM has a bug with AVX-512F masked multiply intrinsic `_mm512_mask_mul_pd`. The multiply operation is performed unmasked with a masked store. This can cause FP exceptions for lanes that should be masked. LLVM bug report: https://bugs.llvm.org/show_bug.cgi?id=51988. The bug affects NumPy / SciPy because NumPy has an AVX-512F implementation for log(), which uses a masked multiply intrinsic: `_mm512_mask_mul_pd`. The bug surfaces in SciPy when trying to setup constants: ``` # The largest [in magnitude] usable floating value. _XMAX = np.finfo(float).max # The log of the largest usable floating value; useful for knowing # when exp(something) will overflow _LOGXMAX = np.log(_XMAX) ``` The workaround here explicitly masks the inputs before the multiply operation. **Testing** - Added a test case to numpy/core/tests/test_umath.py - Fails on trunk - Passes after workaround SciPy testing before: ``` 93 failed, 22378 passed, 1385 skipped, 93 xfailed, 7 xpassed, 1128 errors in 117.54s (0:01:57) ``` SciPy testing after: ``` 74 failed, 33361 passed, 2230 skipped, 108 xfailed, 8 xpassed in 178.19s (0:02:58) ``` Note, all `1128` errors have been resolved as well as less test failures (`93` --> `74`)
Diffstat (limited to 'numpy/array_api/_set_functions.py')
0 files changed, 0 insertions, 0 deletions