RFR: 8272861: Add a micro benchmark for vector api
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors. ------------- Commit messages: - whitespace - 8272861: Add a micro benchmark for vector api Changes: https://git.openjdk.java.net/jdk/pull/5234/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5234&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8272861 Stats: 190 lines in 1 file changed: 190 ins; 0 del; 0 mod Patch: https://git.openjdk.java.net/jdk/pull/5234.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/5234/head:pull/5234 PR: https://git.openjdk.java.net/jdk/pull/5234
On Mon, 23 Aug 2021 23:18:28 GMT, Sandhya Viswanathan <sviswanathan@openjdk.org> wrote:
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java line 138:
136: } 137: 138: static final VectorSpecies<Float> fsp = FloatVector.SPECIES_256;
Can we use a more portable way instead of fixed size SPECIES_256? ------------- PR: https://git.openjdk.java.net/jdk/pull/5234
On Mon, 23 Aug 2021 23:18:28 GMT, Sandhya Viswanathan <sviswanathan@openjdk.org> wrote:
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
Some benchmark comments. test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java line 91:
89: static float A4 = -1.821255978f; 90: static float A5 = 1.330274429f; 91: static float PI = (float)Math.PI;
Want to make these `static final`? test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java line 134:
132: 133: @Benchmark 134: public void scalar_black_scholes(Blackhole bh) {
So there is a `Blackhole` argument here, but what is actually blackholed? AFAICS, stores to `call` and `put` are roughly okay to avoid dead-code elimination on these paths. ------------- PR: https://git.openjdk.java.net/jdk/pull/5234
On Tue, 24 Aug 2021 10:09:13 GMT, Aleksey Shipilev <shade@openjdk.org> wrote:
Sandhya Viswanathan has updated the pull request incrementally with one additional commit since the last revision:
Make constants as static final
Some benchmark comments.
@shipilev @nsjian Thanks a lot for the feedback. I have implemented your review comments. ------------- PR: https://git.openjdk.java.net/jdk/pull/5234
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
Sandhya Viswanathan has updated the pull request incrementally with one additional commit since the last revision: Implement review comments ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/5234/files - new: https://git.openjdk.java.net/jdk/pull/5234/files/ca688faa..f92994cd Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5234&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5234&range=00-01 Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/5234.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/5234/head:pull/5234 PR: https://git.openjdk.java.net/jdk/pull/5234
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
Sandhya Viswanathan has updated the pull request incrementally with one additional commit since the last revision: Make constants as static final ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/5234/files - new: https://git.openjdk.java.net/jdk/pull/5234/files/f92994cd..5b4abbf9 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5234&range=02 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5234&range=01-02 Stats: 7 lines in 1 file changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.java.net/jdk/pull/5234.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/5234/head:pull/5234 PR: https://git.openjdk.java.net/jdk/pull/5234
On Tue, 24 Aug 2021 20:49:52 GMT, Sandhya Viswanathan <sviswanathan@openjdk.org> wrote:
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
Sandhya Viswanathan has updated the pull request incrementally with one additional commit since the last revision:
Make constants as static final
@PaulSandoz @ericcaspole Looking forward to your review and approval for this vector api micro benchmark. ------------- PR: https://git.openjdk.java.net/jdk/pull/5234
On Tue, 24 Aug 2021 20:49:52 GMT, Sandhya Viswanathan <sviswanathan@openjdk.org> wrote:
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
Sandhya Viswanathan has updated the pull request incrementally with one additional commit since the last revision:
Make constants as static final
Very nice, just one minor comment (no need for another review), thanks for contributing this. test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java line 60:
58: 59: float randFloat(float low, float high) { 60: float val = rand.nextFloat()/Float.MAX_VALUE;
`nextFloat` returns a PSR between 0 and 1., so no need to divide by `Float.MAX_VALUE` ? ------------- Marked as reviewed by psandoz (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/5234
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
Sandhya Viswanathan has updated the pull request incrementally with one additional commit since the last revision: No need to normalize nextFloat ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/5234/files - new: https://git.openjdk.java.net/jdk/pull/5234/files/5b4abbf9..df22def3 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5234&range=03 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5234&range=02-03 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/5234.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/5234/head:pull/5234 PR: https://git.openjdk.java.net/jdk/pull/5234
On Mon, 23 Aug 2021 23:18:28 GMT, Sandhya Viswanathan <sviswanathan@openjdk.org> wrote:
This pull request adds a micro benchmark for Vector API. The Black Scholes algorithm is implemented with and without Vector API. We see about ~6x gain with Vector API for this micro benchmark using 256 bit vectors.
This pull request has now been integrated. Changeset: 5aaa20f8 Author: Sandhya Viswanathan <sviswanathan@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/5aaa20f898e8679ef1c2c36bd01d48c17be0... Stats: 189 lines in 1 file changed: 189 ins; 0 del; 0 mod 8272861: Add a micro benchmark for vector api Reviewed-by: psandoz ------------- PR: https://git.openjdk.java.net/jdk/pull/5234
participants (4)
-
Aleksey Shipilev
-
Ningsheng Jian
-
Paul Sandoz
-
Sandhya Viswanathan