RFR: 8322790: RISC-V: Tune costs for shuffles with no conversion
Ilya Gavrilin
igavrilin at openjdk.org
Sat Dec 30 20:12:56 UTC 2023
Hi all, please review this small change to RISC-V nodes insertion costs.
Now we have several nodes which provide shuffles without conversion: https://github.com/openjdk/jdk/blob/32d80e2caf6063b58128bd5f3dc87b276f3bd0cb/src/hotspot/cpu/riscv/riscv.ad#L8525-L8741
On most RISC-V cpu`s we prefer reg<->reg operations, because they are faster, but now stack<->reg operations used (for details about reasons, please, visit connected jbs issue).
After changing insertion costs reg<->reg operations selected, and we can see performance improvements for benchmarks, which use such shuffles (tested on thead C910 board):
| Benchmark | Upstream build (ops/ms) | Patched build (ops/ms) | difference (%) |
|:-----------------------------------:|:-----------------------:|:----------------------:|:--------------:|
| MathBench.doubleToRawLongBitsDouble | 30935.139 | 32171.761 | +4.00 |
| StrictMathBench.ceilDouble | 24682.810 | 29782.050 | +20.66 |
| StrictMathBench.cosDouble | 6948.309 | 6938.276 | -0.14 |
| StrictMathBench.expDouble | 6816.143 | 7211.021 | +5.79 |
| StrictMathBench.floorDouble | 30699.630 | 34189.509 | +11.37 |
| StrictMathBench.maxDouble | 35157.355 | 34675.191 | -1.37 |
| StrictMathBench.minDouble | 35192.135 | 35183.015 | -0.03 |
| StrictMathBench.sinDouble | 6698.405 | 6721.809 | +0.35 |
New benchmark for changed nodes:
--- a/test/micro/org/openjdk/bench/java/lang/MathBench.java
+++ b/test/micro/org/openjdk/bench/java/lang/MathBench.java
@@ -540,4 +540,11 @@ public class MathBench {
return Math.ulp(float7);
}
+ @Benchmark
+ public long doubleToRawLongBitsDouble() {
+ double dbl162Dot5 = double81 * 2.0d + double0Dot5;
+ double dbl3 = double2 + double1;
+ return Double.doubleToRawLongBits(dbl162Dot5) + Double.doubleToRawLongBits(dbl3);
+ }
+
-------------
Commit messages:
- Change costs for shuffles with no conversion
Changes: https://git.openjdk.org/jdk/pull/17206/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17206&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8322790
Stats: 13 lines in 1 file changed: 1 ins; 0 del; 12 mod
Patch: https://git.openjdk.org/jdk/pull/17206.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17206/head:pull/17206
PR: https://git.openjdk.org/jdk/pull/17206
More information about the hotspot-compiler-dev
mailing list