[riscv-port] RFR: 8278041: riscv: Use t2 as the dedicated machine flags register in C2 [v2]

kuaiwei duke at openjdk.java.net
Thu Dec 9 12:33:17 UTC 2021


On Thu, 2 Dec 2021 13:04:06 GMT, Yadong Wang <yadongwang at openjdk.org> wrote:

> > > Hi Yadong, it looks cost too much to reserve a dedicated register for control flag. I think in most cases we can use the 2 scratch registers instead. Can you show some complicated cases? We can check if they can be rewrite to avoid the complication.
> >
> >
> > Well, I think there might be some tradeoff here. On the one hand, use the same register 't1' for two different purposes (scratch register & flags registers) at the same time looks rather error prone as mentioned in the PR description. On the other hand, use another register 't2' as the dedicated flags register could somehow affect the performance in certain cases even though this is not reflected on the specjbb2015 numbers. Personally, I have no obvious bias here. I would like to hear how the other Reviewers would say about this. Maybe @shipilev ? Thanks.
>
> Agree. it's a tradeoff. There may be more spill/unspills in some scenarios of a high register pressue, but it is more friendly for code scheduling and higher maintainability with less data flow effects. By the way, we found this PR did not affect the performance of SPECjvm2008 on unmatched:
>
> before:
>
> ```
> compress                      17.71
> crypto                        24.16
> derby                         32.39
> mpegaudio                     14.68
> scimark.large                 3.65
> scimark.small                 15.07
> serial                        12.08
> startup                       3.88
> sunflow                       7.21
> ```
>
> after:
>
> ```
> compress                      17.74
> crypto                        24.1
> derby                         32.67
> mpegaudio                     14.64
> scimark.large                 3.67
> scimark.small                 15.42
> serial                        12.98
> startup                       3.6
> sunflow                       7.09
> ```

Hi Yadong,
Thanks for the test. Since benchmark score showed little impact so far. I'm fine to use a dedicated register now. But it still looks too many special registers in riscv. I think it can be improved in future.

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

PR: https://git.openjdk.java.net/riscv-port/pull/21



More information about the riscv-port-dev mailing list