Re: Make PHP JIT to generate AVX2/AVX3 for performance improvement?
| From: | Pierre Joye | Date: | Tue, 31 Oct 2023 15:56:22 +0000 |
| Subject: | Re: Make PHP JIT to generate AVX2/AVX3 for performance improvement? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121546@lists.php.net to get a copy of this message | ||
On Tue, Oct 31, 2023, 3:57 PM tag Knife <fenniclog@gmail.com> wrote:
> > Hi Guys,
> >
> > A quick question: is it possible to enable AVX2/AVX3 in PHP JIT generated
> > code, and hence can get some performance improvement?
> > Just check the community first: if anyone has already tried that or got
> > some experiences? before we dive into this investigation.
> > We are discussing if we could get some extra performance via new AVX
> > instructions in PHP program execution.
> >
> > Thanks.
> >
>
> AVX3 might be too new to just flat out generate for it. But
> It can be quite simple for the JIT compiler to be aware of what
> features flags are enabled on a CPU and generate compatible
> instructions that will run on that CPU.
>
it is not really new, however the gain for most cases are not necessarily
significant but for specific cases.
For most usages in php, at a request level, the gain will be barely
measurable.
Also for latest avx, most hosting servers won't have them anyway.
I would think some specific APIs to prepare specific data to be processed
using the best available runtime intrinsics would bring much more than in
JIT.
As a sidenote, most libraries used by php, where larger intrinsics vectors
bring something, implement them already.
best,
Pierre
>