Req #78743 [Opn]: Provide a configure flag to disable SIMD optimizations
| From: | nikic@php.net | Date: | Wed, 23 Oct 2019 15:54:21 +0000 |
| Subject: | Req #78743 [Opn]: Provide a configure flag to disable SIMD optimizations | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223418@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78743&edit=1
ID: 78743
Updated by: nikic@php.net
Reported by: php-bugs-2019 at ryandesign dot com
Summary: Provide a configure flag to disable SIMD
optimizations
Status: Open
Type: Feature/Change Request
Package: *Compile Issues
PHP Version: 7.3.10
Block user comment: N
Private report: N
New Comment:
I believe that what happens here is that these do indeed check if your native CPU supports the
instruction set (for whatever reason -- needs to be fixed), but it will still generate code that
performs a runtime dispatch. The instruction set used without dynamic dispatch only depends on
-march / -mcpu / -mattr I believe.
Do you actually observe something to the contrary?
Previous Comments:
------------------------------------------------------------------------
[2019-10-23 15:44:38] php-bugs-2019 at ryandesign dot com
Description:
------------
Hi, I'm the maintainer of php in MacPorts.
When I configure php73 on my Mac, the output includes these lines:
checking for ssse3 instructions supports... yes
checking for sse4.2 instructions supports... yes
checking for avx instructions supports... yes
checking for avx2 instructions supports... yes
checking whether __SSE4_2__ is defined... no
If I understand correctly, it's checking which SIMD instruction sets are available on the
current CPU, and builds a binary that uses those instructions. If that's correct, then moving
that binary to a computer with a different CPU with lesser SIMD capabilities would not work, and
would probably crash.
This is a problem for anyone who wants to distribute binaries of php for others to use, such as
MacPorts and other package management systems. I think this may be why some of our users have
reported crashes with php73.
Therefore I would like to disable SIMD optimizations, but I couldn't find a configure flag to
do that. If there isn't one, could one be added? Or is there another way for me to indicate
this at build time?
It would be useful to be able to override the detection of each instruction set individually. (For
example, for MacPorts, I know that every Intel Mac Apple ever shipped supported SSE3, so I would
enable that and disable the rest. Or I might vary it based on deployment macOS version, since newer
macOS versions often require newer computers anyway.)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78743&edit=1