RE: [PHP-DEV] Make PHP JIT to generate AVX2/AVX3 for performance improvement?

2023-10-31 Thread Su, Tao
> > > 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
> 

Thanks Pierre and tag? (apologize if I take your name wrongly) for 
the hint and information. We will carefully think about them...

So far, we are still in early investigation stage and would like to 
hear opinions and ideas from our community. 

Best,
Tony Su


Re: [PHP-DEV] Make PHP JIT to generate AVX2/AVX3 for performance improvement?

2023-10-31 Thread Pierre Joye
On Tue, Oct 31, 2023, 3:57 PM tag Knife  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

>


Re: [PHP-DEV] Make PHP JIT to generate AVX2/AVX3 for performance improvement?

2023-10-31 Thread tag Knife
> 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.


[PHP-DEV] Make PHP JIT to generate AVX2/AVX3 for performance improvement?

2023-10-31 Thread Su, Tao
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.