RFR: 8256431: [PPC64] Implement Base64 encodeBlock() for Power64-LE [v6]
Corey Ashford
github.com+51754783+coreyashford at openjdk.java.net
Wed Dec 16 18:45:10 UTC 2020
> Add a vector-based implementation of the Base64 encodeBlock intrinsic for Power9 and Power10, little-endian Linux only.
>
> This implementation is based upon a paper (linked in comments) describing an Intel SSE vector-based implementation of Base64 encoding. Although the Intel SSE instruction set and the Power VMX/VSX instruction sets are different, the method used in the paper is adaptable to Power. In addition there are a few places in the algorithm where it's possible to gain some performance by using more optimal instruction sequences for VMX/VSX, and some additional benefit is gained from the ISA 3.1 additions available in Power10.
>
> There is one controversial method I used in this implementation: I defined a macro to emit the instruction sequence for encoding 12 bytes in a vector to 16 bytes, because this sequence is needed in three places. Turning it into a function would have been possible, but I would have needed to pass quite a few register numbers into the function. I would have liked to have used a nested function, to give the function visibility to the register numbers declared in the outer scope, but alas nested functions are not possible in C++.
>
> The overall performance advantage on Power9 is about 4.0X, based on the main/java/org/openjdk/micro/bench/java/util/Base64VarLenEncode.java benchmark. This benchmark covers random buffer lengths from 8 to 20007 bytes. Buffers that are short won't perform as well, approaching the performance of the pure Java code (or slightly worse for very short buffers), Buffers that are consistently long will perform a little better than 4.0X.
Corey Ashford has updated the pull request incrementally with one additional commit since the last revision:
stubGenerator_ppc.cpp: Improve readability of the vector constant initialization
Use a struct of vectors instead of a large byte array, and make the C++
compiler compute the offsets, using the offsetof() macro.
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/1245/files
- new: https://git.openjdk.java.net/jdk/pull/1245/files/5badbf6a..f0d31076
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1245&range=05
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1245&range=04-05
Stats: 81 lines in 1 file changed: 15 ins; 0 del; 66 mod
Patch: https://git.openjdk.java.net/jdk/pull/1245.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1245/head:pull/1245
PR: https://git.openjdk.java.net/jdk/pull/1245
More information about the hotspot-compiler-dev
mailing list