Re: RFR: 8329077: C2 SuperWord: Add MoveD2L, MoveL2D, MoveF2I, MoveI2F

2025-08-01 Thread Quan Anh Mai
On Thu, 24 Jul 2025 10:29:15 GMT, Galder Zamarreño wrote: > I've added support to vectorize `MoveD2L`, `MoveL2D`, `MoveF2I` and `MoveI2F` > nodes. The implementation follows a similar pattern to what is done with > conversion (`Conv*`) nodes. The tests in `TestCompatibleUseDefTypeSize` have >

Re: RFR: 8358768: [vectorapi] Make VectorOperators.SUADD an Associative [v4]

2025-07-15 Thread Quan Anh Mai
On Mon, 14 Jul 2025 21:43:58 GMT, Ian Graves wrote: >> Adding SUADD an associative operation in the Vector API. Saturated addition >> on fixed-width unsigned integers is provably associative. > > Ian Graves has updated the pull request incrementally with one additional > commit since the last r

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

2025-04-04 Thread Quan Anh Mai
On Thu, 3 Apr 2025 12:54:01 GMT, Per Minborg wrote: >> src/java.base/share/classes/java/lang/StableValue.java line 402: >> >>> 400: * race. Since stable functions and stable collections are built on >>> top of >>> 401: * {@linkplain StableValue#orElseSet(Supplier) orElseSet()} they too >>> a

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

2025-04-02 Thread Quan Anh Mai
On Wed, 2 Apr 2025 13:22:44 GMT, Per Minborg wrote: >> Implement JEP 502. >> >> The PR passes tier1-tier3 tests. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Add info that Map#values and Map#entrySet are stable src/java

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v21]

2025-03-31 Thread Quan Anh Mai
On Mon, 31 Mar 2025 14:22:16 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Finish and clean up benchmarks > > src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java >

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-21 Thread Quan Anh Mai
On Fri, 21 Mar 2025 20:25:51 GMT, Andrew Dinn wrote: >>> In all these cases there is a fast path: e.g. when we know we have already >>> warned for enable native access, or for Unsafe. In the SV API, the fast >>> path is when we know that the SV is set already. In my experience, the >>> volatil

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v6]

2025-03-21 Thread Quan Anh Mai
On Fri, 21 Mar 2025 15:50:05 GMT, Maurizio Cimadamore wrote: > In all these cases there is a fast path: e.g. when we know we have already > warned for enable native access, or for Unsafe. In the SV API, the fast path > is when we know that the SV is set already. In my experience, the volatile

Integrated: 8345687: Improve the implementation of SegmentFactories::allocateSegment

2025-03-18 Thread Quan Anh Mai
On Fri, 6 Dec 2024 16:30:47 GMT, Quan Anh Mai wrote: > Hi, > > This patch improves the performance of a typical `Arena::allocate` in several > ways: > > - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge of > the instance with the one obtained

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v7]

2025-03-18 Thread Quan Anh Mai
On Thu, 13 Mar 2025 16:21:07 GMT, Maurizio Cimadamore wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> expand wildcard imports > > Marked as reviewed by mcimadamore (Reviewer). @mc

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview)

2025-03-15 Thread Quan Anh Mai
On Wed, 12 Mar 2025 08:09:04 GMT, Per Minborg wrote: >> If you have an `@Stable Object[]`, then the elements are also considered >> `@Stable`. Then you can do something like: >> >> ReentrantLock[] locks; >> >> T get(int idx) { >> Object x = backing[idx]; >> if (x == nul

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview)

2025-03-15 Thread Quan Anh Mai
On Tue, 11 Mar 2025 11:19:13 GMT, Per Minborg wrote: >> src/java.base/share/classes/java/util/ImmutableCollections.java line 777: >> >>> 775: private final IntFunction mapper; >>> 776: @Stable >>> 777: private final StableValueImpl[] backing; >> >> You can use a backing

Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview)

2025-03-13 Thread Quan Anh Mai
On Mon, 10 Mar 2025 18:11:23 GMT, Per Minborg wrote: > Implement JEP 502. > > The PR passes tier1-tier3 tests. src/java.base/share/classes/java/util/ImmutableCollections.java line 777: > 775: private final IntFunction mapper; > 776: @Stable > 777: private final StableVa

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v6]

2025-03-13 Thread Quan Anh Mai
On Wed, 12 Mar 2025 11:15:29 GMT, Maurizio Cimadamore wrote: >> Quan Anh Mai 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 contai

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v7]

2025-03-12 Thread Quan Anh Mai
ke it more straightforward. > - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that > `false` value can be constant folded. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has updated the pull request incrementally with one additional commit sin

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v6]

2025-03-07 Thread Quan Anh Mai
On Fri, 7 Mar 2025 17:38:13 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch improves the performance of a typical `Arena::allocate` in >> several ways: >> >> - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge >> of the insta

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v6]

2025-03-07 Thread Quan Anh Mai
ke it more straightforward. > - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that > `false` value can be constant folded. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The i

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v3]

2025-02-06 Thread Quan Anh Mai
On Wed, 5 Feb 2025 10:18:01 GMT, Maurizio Cimadamore wrote: >> Only the return value of `CALLOC` is converted to `MemorySegment` in an >> equivalent way, I believe passing a `MemorySegment` to a downcall involves >> acquiring the corresponding segment? As a result, `FREE` is made to accept >>

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v5]

2025-02-06 Thread Quan Anh Mai
ke it more straightforward. > - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that > `false` value can be constant folded. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The i

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v3]

2025-01-24 Thread Quan Anh Mai
On Fri, 24 Jan 2025 11:57:06 GMT, Maurizio Cimadamore wrote: >> The main goal here is that passing/receiving raw addresses as longs is >> cheaper than as `MemorySegment`s. > > But the address is immediately converted to memory segment using > MemorySegment::ofAddress, which is what the linker

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v3]

2025-01-22 Thread Quan Anh Mai
On Mon, 16 Dec 2024 11:01:11 GMT, Maurizio Cimadamore wrote: >> Quan Anh Mai has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - wrong init >> - move segment instance creation to SegmentFactories > &g

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v4]

2025-01-22 Thread Quan Anh Mai
ke it more straightforward. > - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that > `false` value can be constant folded. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The i

Integrated: 8346532: XXXVector::rearrangeTemplate misses null check

2024-12-18 Thread Quan Anh Mai
On Wed, 18 Dec 2024 16:22:51 GMT, Quan Anh Mai wrote: > Hi, > > This patch adds the missing null checks to the shuffle arguments of the > various `rearrangeTemplate` method. For all other API points, we null check > arguments by calling `check` on them. As `rearrange` implement

Re: RFR: 8346532: XXXVector::rearrangeTemplate misses null check

2024-12-18 Thread Quan Anh Mai
On Wed, 18 Dec 2024 17:51:08 GMT, Paul Sandoz wrote: >> Looks good, thanks for fixing. >> >> This is really a bug rather than an enhancement. In the package JavaDoc we >> state: >>> * For every class in this package, >>> * unless specified otherwise, any method arguments of reference >>> * type

Re: RFR: 8346532: XXXVector::rearrangeTemplate misses null check

2024-12-18 Thread Quan Anh Mai
On Wed, 18 Dec 2024 17:44:02 GMT, Paul Sandoz wrote: >> Hi, >> >> This patch adds the missing null checks to the shuffle arguments of the >> various `rearrangeTemplate` method. For all other API points, we null check >> arguments by calling `check` on them. As `rearrange` implementations cast

RFR: 8346532: XXXVector::rearrangeTemplate misses null check

2024-12-18 Thread Quan Anh Mai
Hi, This patch adds the missing null checks to the shuffle arguments of the various `rearrangeTemplate` method. For all other API points, we null check arguments by calling `check` on them. As `rearrange` implementations cast the argument to the concrete type, there is no need for species check

Integrated: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation

2024-12-11 Thread Quan Anh Mai
On Tue, 17 Sep 2024 16:13:55 GMT, Quan Anh Mai wrote: > Hi, > > This is just a redo of https://github.com/openjdk/jdk/pull/13093. mostly just > the revert of the backout. > > Regarding the related issues: > > - [JDK-8306008](https://bugs.openjdk.org/browse/JDK-8306

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v3]

2024-12-11 Thread Quan Anh Mai
On Wed, 11 Dec 2024 18:50:18 GMT, Maurizio Cimadamore wrote: >> I want to put it here so that even if `SegmentFactories::allocateNative` is >> not inlined, this small method will be more likely to be inlined and the >> segment can be non-escape, then. I have added a comment regarding class >>

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v3]

2024-12-11 Thread Quan Anh Mai
ke it more straightforward. > - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that > `false` value can be constant folded. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has updated the pull request incrementally with two additional commits since the last r

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v2]

2024-12-11 Thread Quan Anh Mai
ke it more straightforward. > - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that > `false` value can be constant folded. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has updated the pull request incrementally with one additional c

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v2]

2024-12-11 Thread Quan Anh Mai
On Mon, 9 Dec 2024 12:48:07 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/jdk/internal/foreign/SegmentFactories.java line >> 213: >> >>> 211: >>> 212: @DontInline >>> 213: private static long allocateNativeOveraligned(long byteSize, long >>> byteAlignment, MemorySess

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v2]

2024-12-11 Thread Quan Anh Mai
On Fri, 6 Dec 2024 18:29:46 GMT, Jorn Vernee wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> address review > > src/java.base/share/classes/jdk/internal/foreign/Ar

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment

2024-12-11 Thread Quan Anh Mai
On Fri, 6 Dec 2024 16:30:47 GMT, Quan Anh Mai wrote: > Hi, > > This patch improves the performance of a typical `Arena::allocate` in several > ways: > > - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge of > the instance with the one obtained

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v10]

2024-12-11 Thread Quan Anh Mai
On Tue, 10 Dec 2024 16:10:09 GMT, Quan Anh Mai wrote: >> Hi, >> >> This is just a redo of https://github.com/openjdk/jdk/pull/13093. mostly >> just the revert of the backout. >> >> Regarding the related issues: >> >> - [JDK-8306008](https://b

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v8]

2024-12-10 Thread Quan Anh Mai
On Tue, 10 Dec 2024 09:02:40 GMT, Jatin Bhateja wrote: >> This is called in an `assert` so I think throwing `AssertionError` seems >> more reasonable, the original implementation also throws `AssertionError` > > I see, you want to throw an error here and not just use an assert statement > that

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v9]

2024-12-10 Thread Quan Anh Mai
On Tue, 10 Dec 2024 08:34:30 GMT, Jatin Bhateja wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Change wording on VectorLoadShuffleNode >> >> Co-authored-by: Jatin Bhateja

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v10]

2024-12-10 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-12-10 Thread Quan Anh Mai
On Mon, 9 Dec 2024 13:40:16 GMT, Jatin Bhateja wrote: >> @merykitty do you want me to initiate tier 1 to 3 tests? > >> @PaulSandoz @sviswa7 Thanks for your advice, I have made the PR ready for >> review >> >> @iwanowww Could you take another look at this, please? >> >> @jatin-bhateja Could you

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v8]

2024-12-10 Thread Quan Anh Mai
On Tue, 10 Dec 2024 07:01:27 GMT, Jatin Bhateja wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> adverb order > > src/jdk.incubator.vector/share/classes/jdk/incubator/vector/B

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v9]

2024-12-10 Thread Quan Anh Mai
On Tue, 10 Dec 2024 07:44:57 GMT, Jatin Bhateja wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Change wording on VectorLoadShuffleNode >> >> Co-authored-by: Jatin

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v9]

2024-12-10 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v8]

2024-12-10 Thread Quan Anh Mai
On Tue, 10 Dec 2024 07:54:55 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java >> line 822: >> >>> 820: static final Class ETYPE = byte.class; // used by the JVM >>> 821: >>> 822: Byte128Shuffle(byte[] indices) { >> >>

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v7]

2024-12-09 Thread Quan Anh Mai
On Mon, 9 Dec 2024 14:39:25 GMT, Emanuel Peter wrote: >> @eme64 I think this PR is orthogonal to the concern you are having. Either >> we need to refactor the expansion to lowering, then modify this PR to match >> the semantics, or we integrate this PR first, then do the lowering refactor >> o

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v8]

2024-12-09 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v7]

2024-12-09 Thread Quan Anh Mai
On Mon, 9 Dec 2024 13:59:29 GMT, Emanuel Peter wrote: >> @eme64 Yes I have thought about that. My idea is that once phase lowering is >> ready we will move the expansion there (#21599) . This removes the need to >> have a standalone method that checks if `LoadShuffleNode` is needed. The >> cur

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v7]

2024-12-09 Thread Quan Anh Mai
On Mon, 9 Dec 2024 13:47:10 GMT, Emanuel Peter wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> address reviews > > Ok, looks better. > > I've thought about this a little.

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v6]

2024-12-09 Thread Quan Anh Mai
On Mon, 9 Dec 2024 08:10:20 GMT, Emanuel Peter wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> add comment, extract cast into local variable > > src/hotspot/share/opto/vector

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v7]

2024-12-09 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v6]

2024-12-06 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-12-06 Thread Quan Anh Mai
On Fri, 6 Dec 2024 17:22:33 GMT, Paul Sandoz wrote: >> @sviswa7 @PaulSandoz @eme64 @jatin-bhateja Thanks for taking a look, I have >> merged the PR with a more recent master and resolved the sematic difference >> with newly added intrinsics, too. > > @merykitty do you want me to initiate tier 1

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-12-06 Thread Quan Anh Mai
On Fri, 6 Dec 2024 16:20:55 GMT, Paul Sandoz wrote: >> Ah i see now, you want to ensure an invocation to the final/concrete method. >> (The IDE's highlighting of the redundant cast is misleading) > > The common way we tend to do this in other areas is assign to a local > variable with the sharp

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-12-06 Thread Quan Anh Mai
On Fri, 6 Dec 2024 16:16:04 GMT, Paul Sandoz wrote: >> This piece of code follows the pattern: >> >> if (uncommonCondition) { >> return uncommonPath(); >> } >> // Continue the common path >> >> So I think it is better to keep it as it is. > > Ok, but since it deviates from t

Re: RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment

2024-12-06 Thread Quan Anh Mai
On Fri, 6 Dec 2024 16:30:47 GMT, Quan Anh Mai wrote: > Hi, > > This patch improves the performance of a typical `Arena::allocate` in several > ways: > > - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge of > the instance with the one obtained

RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment

2024-12-06 Thread Quan Anh Mai
Hi, This patch improves the performance of a typical `Arena::allocate` in several ways: - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge of the instance with the one obtained from the call in the uncommon path, increasing the chance the object being scalar replaced. -

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v5]

2024-12-06 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-12-06 Thread Quan Anh Mai
On Thu, 5 Dec 2024 20:48:07 GMT, Paul Sandoz wrote: >> `shuffleFromOp` is a slow path op so I don't think it is. Additionally, our >> vector multiplication is against a scalar, too. So we can optimize it if >> `step` is a constant. > > I incorrectly read `!=` as `==` :-) as that is the more com

Integrated: 8345119: Some java/foreign tests wrongly assume aligned memory

2024-11-27 Thread Quan Anh Mai
On Wed, 27 Nov 2024 16:12:04 GMT, Quan Anh Mai wrote: > Hi, > > This patch resolves some issues I found that the tests wrongly assume > sufficient alignment from the segment returned by `Arena::allocate`. > > Please take a look and leave your reviews, thanks a lot. This pu

Re: RFR: 8345119: Some java/foreign tests wrongly assume aligned memory

2024-11-27 Thread Quan Anh Mai
On Wed, 27 Nov 2024 18:56:02 GMT, Maurizio Cimadamore wrote: >> Hi, >> >> This patch resolves some issues I found that the tests wrongly assume >> sufficient alignment from the segment returned by `Arena::allocate`. >> >> Please take a look and leave your reviews, thanks a lot. > > Marked as

Re: RFR: 8345119: Some java/foreign tests wrongly assume aligned memory

2024-11-27 Thread Quan Anh Mai
On Wed, 27 Nov 2024 16:41:39 GMT, Jorn Vernee wrote: >> Hi, >> >> This patch resolves some issues I found that the tests wrongly assume >> sufficient alignment from the segment returned by `Arena::allocate`. >> >> Please take a look and leave your reviews, thanks a lot. > > test/jdk/java/forei

RFR: 8345119: Some java/foreign tests wrongly assume aligned memory

2024-11-27 Thread Quan Anh Mai
Hi, This patch resolves some issues I found that the tests wrongly assume sufficient alignment from the segment returned by `Arena::allocate`. Please take a look and leave your reviews, thanks a lot. - Commit messages: - Some java/foreign tests wrongly assume aligned memory Chang

Integrated: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign

2024-11-26 Thread Quan Anh Mai
On Sat, 23 Nov 2024 16:29:10 GMT, Quan Anh Mai wrote: > Hi, > > This patch sharpens the return types of various internal methods. This helps > the compiler to have better information when the corresponding methods are > not inlined. > > Please take a look and leave your

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v4]

2024-11-26 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-11-26 Thread Quan Anh Mai
On Tue, 29 Oct 2024 20:27:20 GMT, Paul Sandoz wrote: >> Quan Anh Mai has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains one commit: >> >> [vectorapi] Refactor VectorShuffle implementation > > src/jdk.

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-11-26 Thread Quan Anh Mai
On Tue, 15 Oct 2024 16:25:04 GMT, Emanuel Peter wrote: >> Quan Anh Mai has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains one commit: >> >> [vectorapi] Refactor VectorShuffle implementation &g

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v2]

2024-11-26 Thread Quan Anh Mai
On Fri, 8 Nov 2024 23:17:35 GMT, Sandhya Viswanathan wrote: >> I have adapted the patch in accordance with >> https://github.com/openjdk/jdk/pull/20634, I moved the index wrapping into >> C2 instead of making it a separate step as I think it seems clearer. Also, I >> think in the future we ca

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation [v3]

2024-11-26 Thread Quan Anh Mai
qu 0x10(%r10),%xmm2 > movabs $0x7515a0d08,%r10; {oop([I{0x0007515a0d08})} > vmovdqu 0x10(%r10),%xmm1 > movabs $0x75158afb8,%r10; {oop([I{0x00075158afb8})} > vmovdqu 0x10(%r10),%xmm0 > vpand -0xddc12(%rip),%xmm0,%xmm0# S

Re: RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign [v3]

2024-11-26 Thread Quan Anh Mai
On Sun, 24 Nov 2024 03:26:18 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch sharpens the return types of various internal methods. This helps >> the compiler to have better information when the corresponding methods are >> not inlined. >> >>

Re: RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign [v3]

2024-11-26 Thread Quan Anh Mai
On Mon, 25 Nov 2024 12:26:37 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java >> line 144: >> >>> 142: } >>> 143: >>> 144: private NativeMemorySegmentImpl reinterpretInternal(Class >>> callerClass, long newSize, MemorySessionIm

Re: RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign [v3]

2024-11-25 Thread Quan Anh Mai
On Mon, 25 Nov 2024 07:26:56 GMT, Per Minborg wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> fix failing tests > > src/java.base/share/classes/jdk/internal/foreign/NativeMem

Re: RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign [v3]

2024-11-23 Thread Quan Anh Mai
> Hi, > > This patch sharpens the return types of various internal methods. This helps > the compiler to have better information when the corresponding methods are > not inlined. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has upd

Re: RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign [v2]

2024-11-23 Thread Quan Anh Mai
On Sat, 23 Nov 2024 17:27:43 GMT, Chen Liang wrote: >> Quan Anh Mai has refreshed the contents of this pull request, and previous >> commits have been removed. The incremental views will show differences >> compared to the previous content of the PR. The pull request co

Re: RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign [v2]

2024-11-23 Thread Quan Anh Mai
> Hi, > > This patch sharpens the return types of various internal methods. This helps > the compiler to have better information when the corresponding methods are > not inlined. > > Please take a look and leave your reviews, thanks a lot. Quan Anh Mai has refreshed the

RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign

2024-11-23 Thread Quan Anh Mai
Hi, This patch sharpens the return types of various internal methods. This helps the compiler to have better information when the corresponding methods are not inlined. Please take a look and leave your reviews, thanks a lot. - Commit messages: - sharpen the return types of vario

Integrated: 8343793: Test java/foreign/TestMemorySession.java is timing out

2024-11-09 Thread Quan Anh Mai
On Fri, 8 Nov 2024 11:56:08 GMT, Quan Anh Mai wrote: > Hi, > > This patch fixes the deadlock in `TestMemorySession#testAcquireCloseRace`. > The lock-step spin lock is implemented as with `lock` being an > `AtomicInteger`: > > // Keep the 2 threads operating on the s

Re: RFR: 8343793: Test java/foreign/TestMemorySession.java is timing out [v2]

2024-11-09 Thread Quan Anh Mai
On Fri, 8 Nov 2024 16:59:48 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch fixes the deadlock in `TestMemorySession#testAcquireCloseRace`. >> The lock-step spin lock is implemented as with `lock` being an >> `AtomicInteger`: >> >> // Keep

Re: RFR: 8343793: Test java/foreign/TestMemorySession.java is timing out [v2]

2024-11-08 Thread Quan Anh Mai
; proceed because lock can never reach 2 > > > The solution is to not rely on the exact value of the lock but instead > whether the lock has passed the expected value. > > Testing: I have run this test several hundreds times and got no failure while > without this patch I e

Re: RFR: 8343793: Test java/foreign/TestMemorySession.java is timing out

2024-11-08 Thread Quan Anh Mai
On Fri, 8 Nov 2024 11:56:08 GMT, Quan Anh Mai wrote: > Hi, > > This patch fixes the deadlock in `TestMemorySession#testAcquireCloseRace`. > The lock-step spin lock is implemented as with `lock` being an > `AtomicInteger`: > > // Keep the 2 threads operating on the s

Re: RFR: 8343793: Test java/foreign/TestMemorySession.java is timing out

2024-11-08 Thread Quan Anh Mai
On Fri, 8 Nov 2024 12:22:54 GMT, Maurizio Cimadamore wrote: >> Hi, >> >> This patch fixes the deadlock in `TestMemorySession#testAcquireCloseRace`. >> The lock-step spin lock is implemented as with `lock` being an >> `AtomicInteger`: >> >> // Keep the 2 threads operating on the same scop

RFR: 8343793: Test java/foreign/TestMemorySession.java is timing out

2024-11-08 Thread Quan Anh Mai
Hi, This patch fixes the deadlock in `TestMemorySession#testAcquireCloseRace`. The lock-step spin lock is implemented as with `lock` being an `AtomicInteger`: // Keep the 2 threads operating on the same scope int k = lock.getAndAdd(1) + 1; while (k != i * 2) { Thread.onSpinWa

Re: RFR: 8343770: Build fails due to use of sun.misc.Unsafe in LoopOverRandom

2024-11-07 Thread Quan Anh Mai
On Thu, 7 Nov 2024 15:12:01 GMT, Maurizio Cimadamore wrote: > This small PR fixes a build failure due to usage of sun.misc.Unsafe in a new > benchmark. > > FFM benchmarks appear to be broken -- because of JDK-8332744 -- but we will > fix that separately. @mcimadamore Sorry for the failure an

Integrated: 8343394: Make MemorySessionImpl.state a stable field

2024-11-07 Thread Quan Anh Mai
On Thu, 31 Oct 2024 15:52:04 GMT, Quan Anh Mai wrote: > Hi, > > This patch makes `MemorySessionImpl.state` a `Stable` field so that liveness > check of non-closeable scopes such as the global scope can be elided. > > Currently, the `state` field is overloaded with 2 respon

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Fri, 18 Oct 2024 05:37:16 GMT, Quan Anh Mai wrote: >> src/hotspot/share/opto/vectornode.cpp line 2122: >> >>> 2120: // MulL (URShift SRC1 , 32) (URShift SRC2, 32) >>> 2121: // MulL (URShift SRC1 , 32) ( And SRC2, 0x) >>> 2122: //

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Fri, 18 Oct 2024 05:35:28 GMT, Vladimir Ivanov wrote: >> This patch optimizes LongVector multiplication by inferring VPMUL[U]DQ >> instruction for following IR pallets. >> >> >>MulVL ( AndV SRC1, 0x) ( AndV SRC2, 0x) >>MulVL (URShiftVL SRC1 , 32)

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Sun, 29 Sep 2024 04:21:19 GMT, Jatin Bhateja wrote: > This patch optimizes LongVector multiplication by inferring VPMUL[U]DQ > instruction for following IR pallets. > > >MulVL ( AndV SRC1, 0x) ( AndV SRC2, 0x) >MulVL (URShiftVL SRC1 , 32) (URShif

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Fri, 18 Oct 2024 05:42:21 GMT, Jatin Bhateja wrote: >>> The issue is that a node is not immutable. >> >> I don't see any issues with mutability here. >> `MulVLNode::_mult_lower_double_word` is constant, so you have to allocate >> new node if you want to change its value. (And that's exactly

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Fri, 18 Oct 2024 05:16:04 GMT, Vladimir Ivanov wrote: >>> I see this is as a twostep optimization, in the first step we do analysis >>> and annotate additional information on existing IR, which is later used by >>> instruction selector. I plan to subsume first stage with enhanced dataflow >

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Fri, 18 Oct 2024 04:16:15 GMT, Jatin Bhateja wrote: > I see this is as a twostep optimization, in the first step we do analysis and > annotate additional information on existing IR, which is later used by > instruction selector. I plan to subsume first stage with enhanced dataflow > analysi

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Tue, 15 Oct 2024 17:00:26 GMT, Jasmine Karthikeyan wrote: >> This patch optimizes LongVector multiplication by inferring VPMUL[U]DQ >> instruction for following IR pallets. >> >> >>MulVL ( AndV SRC1, 0x) ( AndV SRC2, 0x) >>MulVL (URShiftVL SRC1

Re: RFR: 8341137: Optimize long vector multiplication using x86 VPMUL[U]DQ instruction

2024-11-06 Thread Quan Anh Mai
On Mon, 14 Oct 2024 12:12:58 GMT, Jatin Bhateja wrote: >>> I am having a similar idea that is to group those transformations together >>> into a `Phase` called `PhaseLowering` >> >> I think such a phase could be quite useful in general. Recently I was trying >> to implement the BMI1 instructio

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v3]

2024-11-06 Thread Quan Anh Mai
On Thu, 31 Oct 2024 23:08:40 GMT, Maurizio Cimadamore wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> fix benchmarks > > Actually, @JornVernee pointed out (great observation!)

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v5]

2024-11-05 Thread Quan Anh Mai
On Tue, 5 Nov 2024 14:07:12 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch makes `MemorySessionImpl.state` a `Stable` field so that liveness >> check of non-closeable scopes such as the global scope can be elided. >> >> Currently, the `state` field is ov

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v5]

2024-11-05 Thread Quan Anh Mai
On Tue, 5 Nov 2024 15:31:11 GMT, Maurizio Cimadamore wrote: >> Okay, fair enough. > > Using two blocking queues might also be possible: > * at the start of each iteration a thread does a `get` on its own queue > * at the end of each iteration, a thread does a put on the other thread's > queue >

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v5]

2024-11-05 Thread Quan Anh Mai
On Tue, 5 Nov 2024 15:29:22 GMT, Per Minborg wrote: >> Quan Anh Mai has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - copyright year >> - address reviews > > In `SharedSession`, would it not be nec

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v5]

2024-11-05 Thread Quan Anh Mai
On Tue, 5 Nov 2024 14:43:29 GMT, Jorn Vernee wrote: >> Quan Anh Mai has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - copyright year >> - address reviews > > test/jdk/java/foreign/TestMe

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v4]

2024-11-05 Thread Quan Anh Mai
On Fri, 1 Nov 2024 02:44:15 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch makes `MemorySessionImpl.state` a `Stable` field so that liveness >> check of non-closeable scopes such as the global scope can be elided. >> >> Currently, the `state` field is ov

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v5]

2024-11-05 Thread Quan Anh Mai
his is the results without this patch: > > Benchmark Mode Cnt Score Error Units > MemorySegmentGetUnsafe.panama avgt 30 0.420 ± 0.019 ns/op > MemorySegmentGetUnsafe.unsafe avgt 30 0.329 ± 0.003 ns/op > > Please kindly review, thanks v

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v4]

2024-11-05 Thread Quan Anh Mai
On Mon, 4 Nov 2024 19:08:49 GMT, Jorn Vernee wrote: >> `checkValidStateRaw` synchronizes with `justClose` using handshakes so an >> opaque or higher load is only needed in `sharedSessionAlreadyClosed`. A >> `getOpaque` would probably be adequate. But I believe there is no formal >> restriction

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v4]

2024-11-04 Thread Quan Anh Mai
On Mon, 4 Nov 2024 11:32:12 GMT, Maurizio Cimadamore wrote: >> I'm dubious about this. Typically these modes work in a symmetric way - if >> you `setOpaque` you need to `getOpaque`. From >> [this](https://gee.cs.oswego.edu/dl/html/j9mm.html): >> >>> Opaque mode, obtained using VarHandle getOp

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v4]

2024-11-01 Thread Quan Anh Mai
On Fri, 1 Nov 2024 08:55:09 GMT, Per Minborg wrote: >> Quan Anh Mai has updated the pull request incrementally with one additional >> commit since the last revision: >> >> wait for the close operation to complete on acquire failures > > src/java.base/shar

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v4]

2024-10-31 Thread Quan Anh Mai
his is the results without this patch: > > Benchmark Mode Cnt Score Error Units > MemorySegmentGetUnsafe.panama avgt 30 0.420 ± 0.019 ns/op > MemorySegmentGetUnsafe.unsafe avgt 30 0.329 ± 0.003 ns/op > > Please kindly review, thanks v

Re: RFR: 8343394: Make MemorySessionImpl.state a stable field [v3]

2024-10-31 Thread Quan Anh Mai
On Thu, 31 Oct 2024 18:09:55 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch makes `MemorySessionImpl.state` a `Stable` field so that liveness >> check of non-closeable scopes such as the global scope can be elided. >> >> Currently, the `state` field is ov

  1   2   3   >