Integrated: 8318158: RISC-V: implement roundD/roundF intrinsics

Olga Mikhaltsova omikhaltcova at openjdk.org
Fri Dec 29 18:36:58 UTC 2023


On Thu, 26 Oct 2023 17:20:49 GMT, Olga Mikhaltsova <omikhaltcova at openjdk.org> wrote:

> Please, review this Implementation of the roundD/roundF intrinsics for RISC-V platform.
> 
> In the table below it is shown that NaN argument should be processed as a special case.
> 
>                                                   RISC-V                            Java
>                                         (FCVT.W.S)    (FCVT.L.D)  (long round(double a)) (int round(float a))
> Minimum valid input (after rounding)     −2^31         −2^63         Long.MIN_VALUE       Integer.MIN_VALUE
> Maximum valid input (after rounding)      2^31 − 1      2^63 − 1     Long.MAX_VALUE       Integer.MAX_VALUE
> Output for out-of-range negative input   −2^31         −2^63         Long.MIN_VALUE       Integer.MIN_VALUE
> Output for −∞                            −2^31         −2^63         Long.MIN_VALUE       Integer.MIN_VALUE
> Output for out-of-range positive input    2^31 − 1      2^63 - 1     Long.MAX_VALUE       Integer.MAX_VALUE
> Output for +∞                             2^31 − 1      2^63 - 1     Long.MAX_VALUE       Integer.MAX_VALUE
> Output for NaN                            2^31 − 1      2^63 - 1           0                      0
> 
> The benchmark running with the 2nd fixed implementation on the T-Head RVB-ICE board shows the following performance improvement::
> 
> **Before**
> 
> Benchmark                              (TESTSIZE)   Mode  Cnt    Score   Error   Units
> FpRoundingBenchmark.test_round_double        2048  thrpt   15   59.555  0.179  ops/ms
> FpRoundingBenchmark.test_round_float         2048  thrpt   15   49.760  0.103  ops/ms
> 
> 
> **After**
> 
> Benchmark                              (TESTSIZE)   Mode  Cnt    Score   Error   Units
> FpRoundingBenchmark.test_round_double        2048  thrpt   15  110.956  0.186  ops/ms
> FpRoundingBenchmark.test_round_float         2048  thrpt   15  115.947  0.122  ops/ms

This pull request has now been integrated.

Changeset: 19147f32
Author:    Olga Mikhaltsova <omikhaltcova at openjdk.org>
Committer: Vladimir Kempik <vkempik at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/19147f326c6b0e78fe72f9a7e7100047f16a0921
Stats:     82 lines in 3 files changed: 82 ins; 0 del; 0 mod

8318158: RISC-V: implement roundD/roundF intrinsics

Co-authored-by: Vladimir Kempik <vkempik at openjdk.org>
Reviewed-by: luhenry, fyang, mli

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

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


More information about the hotspot-dev mailing list