Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-03-13 Thread Galder Zamarreño
On Fri, 7 Mar 2025 13:17:29 GMT, Emanuel Peter wrote: >>> As for possible solutions. In all Regression 1-3 cases, it seems the issue >>> is scalar cmove. So actually in all cases a possible solution is using >>> branching code (i.e. `cmp+mov`). So to me, these are the follow-up RFE's: >>> >>>

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-03-07 Thread Galder Zamarreño
On Thu, 27 Feb 2025 06:54:30 GMT, Emanuel Peter wrote: > As for possible solutions. In all Regression 1-3 cases, it seems the issue is > scalar cmove. So actually in all cases a possible solution is using branching > code (i.e. `cmp+mov`). So to me, these are the follow-up RFE's: > > * Detect

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-03-07 Thread Emanuel Peter
On Fri, 7 Mar 2025 12:25:51 GMT, Galder Zamarreño wrote: >> @galderz Thanks for the summary of regressions! Yes, there are plenty of >> speedups, I assume primarily because of `Long.min/max` vectorization, but >> possibly also because the operation can now "float" out of a loop for >> example.

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-03-06 Thread Galder Zamarreño
On Thu, 6 Mar 2025 15:22:18 GMT, Emanuel Peter wrote: >> Also, I've started a [discussion on >> jmh-dev](https://mail.openjdk.org/pipermail/jmh-dev/2025-February/004094.html) >> to see if there's a way to minimise pollution of `Math.min(II)` >> compilation. As a follow to >> https://github.co

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-03-06 Thread Emanuel Peter
On Thu, 27 Feb 2025 16:38:30 GMT, Galder Zamarreño wrote: >> Galder Zamarreño has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 44 additional >> c

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-03-06 Thread Emanuel Peter
On Thu, 27 Feb 2025 16:38:30 GMT, Galder Zamarreño wrote: >> Galder Zamarreño has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 44 additional >> c

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-27 Thread Galder Zamarreño
On Thu, 27 Feb 2025 06:54:30 GMT, Emanuel Peter wrote: > Detect "extreme" probability scalar cmove, and replace them with branching > code. This should take care of all regressions here. This one has high > priority, as it fixes the regression caused by this patch here. But it would > also hel

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-27 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-26 Thread Emanuel Peter
On Wed, 26 Feb 2025 18:29:58 GMT, Galder Zamarreño wrote: >>> > Re: [#20098 >>> > (comment)](https://github.com/openjdk/jdk/pull/20098#issuecomment-2671144644) >>> > - I was trying to think what could be causing this. >>> >>> Maybe it is an issue with probabilities? Do you know at what point (

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-26 Thread Galder Zamarreño
On Wed, 26 Feb 2025 11:32:57 GMT, Galder Zamarreño wrote: > > That said: if we know that it is only in the high-probability cases, then > > we can address those separately. I would not consider it a blocking issue, > > as long as we file the follow-up RFE for int/max scalar case with high > >

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-26 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-25 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-21 Thread Emanuel Peter
On Thu, 20 Feb 2025 06:50:07 GMT, Galder Zamarreño wrote: > The interesting thing is intReductionSimpleMin @ 100%. We see a regression > there but I didn't observe it with the perfasm run. So, this could be due to > variance in the application of cmov or not? I don't see the error / variance i

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-20 Thread Galder Zamarreño
On Thu, 20 Feb 2025 06:50:07 GMT, Galder Zamarreño wrote: > There is something very intriguing happening here, which I don't know it's > due to min itself or int vs long. Benchmark (probability) (size) Mode Cnt -min/-max +min/+max Units MinMaxVector.intRed

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-19 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-19 Thread Galder Zamarreño
On Wed, 19 Feb 2025 19:50:50 GMT, Evgeny Astigeevich wrote: >> I will run a comparison next with the same batch of tests but looking at >> `int` and see if there are any differences compared with `long` or not. > > Hi @galderz, > Results from Graviton 3(Neoverse-V1). > Without the patch: > > B

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-19 Thread Evgeny Astigeevich
On Wed, 19 Feb 2025 17:43:54 GMT, Galder Zamarreño wrote: >> Galder Zamarreño has updated the pull request with a new target base due to >> a merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 44 additional >> c

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-19 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-19 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-18 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-17 Thread Galder Zamarreño
On Mon, 17 Feb 2025 17:02:47 GMT, Galder Zamarreño wrote: > This test is like a reduction test and no vectorization appears to be kicking > in any of the percentages (I've not enabled vectorization SW rejections to > check). Ah, that's probably because of profitable vectorization checks.

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-17 Thread Galder Zamarreño
On Fri, 7 Feb 2025 12:39:24 GMT, Galder Zamarreño wrote: >> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in >> order to help improve vectorization performance. >> >> Currently vectorization does not kick in for loops containing either of >> these calls because of t

Re: RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v12]

2025-02-07 Thread Galder Zamarreño
> This patch intrinsifies `Math.max(long, long)` and `Math.min(long, long)` in > order to help improve vectorization performance. > > Currently vectorization does not kick in for loops containing either of these > calls because of the following error: > > > VLoop::check_preconditions: failed: