Re: RFR: 8282432: Optimize masked "test" Vector API with predicate feature [v2]
On Thu, 3 Mar 2022 17:40:13 GMT, Paul Sandoz wrote: > I guess the following: `mask.cast(IntVector.species(shape())` is more > efficient than: `m.cast(vspecies().asIntegral()))` ? Yeah, that's one point. Another main reason is `m.cast(vspecies().asIntegral()))` cannot be handled well in the superclass due to the java generic issues. Thanks for the reiview @PaulSandoz ! - PR: https://git.openjdk.java.net/jdk/pull/7654
Re: RFR: 8282432: Optimize masked "test" Vector API with predicate feature [v2]
On Thu, 3 Mar 2022 08:12:46 GMT, Xiaohong Gong wrote: >> The vector `"test"` api is implemented with vector `"compare"`. And the >> masked `"test" `is implemented with `"test(op).and(m)"` which means >> `"compare().and(m)"` finally. Since the masked vector `"compare"` has been >> optimized with predicated instruction for archituctures that support the >> feature, the masked `"test"` can also be optimized by implementing it with >> the predicated compare. This could save the additional ` "and"` for >> architectures that support the predicate feature. >> >> This patch optimized the masked `"test"` by implementing it with masked >> `"compare"`. With this patch, the following codes for the` "IS_NEGATIVE"` op >> for a DoubleVector with SVE: >> >> mov z19.d, #0 >> cmpgt p1.d, p7/z, z19.d, z17.d >> and p0.b, p7/z, p1.b, p0.b >> >> are optimized to: >> >> mov z19.d, #0 >> cmpgt p0.d, p0/z, z19.d, z17.d >> >> Also update the jtreg tests for masked` "test" ` to make sure they are hot >> enough to be compiled by c2. > > Xiaohong Gong has updated the pull request incrementally with one additional > commit since the last revision: > > Simply the testTemplate I guess the following: `mask.cast(IntVector.species(shape())` is more efficient than: `m.cast(vspecies().asIntegral()))` ? - Marked as reviewed by psandoz (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/7654
Re: RFR: 8282432: Optimize masked "test" Vector API with predicate feature [v2]
> The vector `"test"` api is implemented with vector `"compare"`. And the > masked `"test" `is implemented with `"test(op).and(m)"` which means > `"compare().and(m)"` finally. Since the masked vector `"compare"` has been > optimized with predicated instruction for archituctures that support the > feature, the masked `"test"` can also be optimized by implementing it with > the predicated compare. This could save the additional ` "and"` for > architectures that support the predicate feature. > > This patch optimized the masked `"test"` by implementing it with masked > `"compare"`. With this patch, the following codes for the` "IS_NEGATIVE"` op > for a DoubleVector with SVE: > > mov z19.d, #0 > cmpgt p1.d, p7/z, z19.d, z17.d > and p0.b, p7/z, p1.b, p0.b > > are optimized to: > > mov z19.d, #0 > cmpgt p0.d, p0/z, z19.d, z17.d > > Also update the jtreg tests for masked` "test" ` to make sure they are hot > enough to be compiled by c2. Xiaohong Gong has updated the pull request incrementally with one additional commit since the last revision: Simply the testTemplate - Changes: - all: https://git.openjdk.java.net/jdk/pull/7654/files - new: https://git.openjdk.java.net/jdk/pull/7654/files/41a9d56f..c90d2f49 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7654&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7654&range=00-01 Stats: 197 lines in 49 files changed: 13 ins; 33 del; 151 mod Patch: https://git.openjdk.java.net/jdk/pull/7654.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7654/head:pull/7654 PR: https://git.openjdk.java.net/jdk/pull/7654