Integrated: 8322790: RISC-V: Tune costs for shuffles with no conversion

Ilya Gavrilin igavrilin at openjdk.org
Mon Jan 8 15:56:33 UTC 2024


On Sat, 30 Dec 2023 20:07:13 GMT, Ilya Gavrilin <igavrilin at openjdk.org> wrote:

> 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);
> +    }
> +

This pull request has now been integrated.

Changeset: 2acb5bd9
Author:    Ilya Gavrilin <igavrilin at openjdk.org>
Committer: Vladimir Kempik <vkempik at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2acb5bd9924511b58b0e57ea9eb6c2dee9fd3ee8
Stats:     5 lines in 1 file changed: 1 ins; 0 del; 4 mod

8322790: RISC-V: Tune costs for shuffles with no conversion

Reviewed-by: rehn, fyang

-------------

PR: https://git.openjdk.org/jdk/pull/17206


More information about the hotspot-compiler-dev mailing list