Integrated: 8351949: RISC-V: Cleanup and enable store-load peephole for membars
Robbin Ehn
rehn at openjdk.org
Mon Apr 7 07:12:57 UTC 2025
On Thu, 13 Mar 2025 13:49:32 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
> Hi please consider.
>
> |RVWMO| Patched|
> | ---------- | ---------- |
> |fence iorw,iorw| fence iorw,ow|
> |sw t4,120(t2) | sw t4,120(t2) |
> |fence ow,ir | unnecessary_membar_volatile_rvwmo |
> | sw t6,128(t2) // Non-volatile | sw t6,128(t2) // Non-volatile |
> |fence iorw,ow | fence iorw,ow|
> |sw t5,124(t2) |sw t5,124(t2) |
>
> |TSO | Patched|
> | ---------- | ---------- |
> | lw a4,120(t2) | lw a6,120(t2) |
> | sw a0,124(t2) | sw t6,124(t2) |
> | fence iorw,iorw | unnecessary_membar_volatile_tso |
> | sw t4,120(t2) | sw t4,120(t2) |
> | fence ow,ir | unnecessary_membar_volatile_tso |
> | sw t6,128(t2) | sw t5,128(t2) |
> | sw t5,124(t2) // Non-volatile| sw a1,124(t2) // Non-volatile |
> | fence iorw,iorw | unnecessary_membar_volatile_tso |
> |... | ... |
> | sw a3,120(t2) | sw a0,120(t2) |
> | fence ow,ir | fence ow,ir |
> | lw a7,124(t2) | lw a5,124(t2) |
>
> For the specific rvwmo volatile store + store + volatile store is around 30% faster on VF2.
>
> The patch do:
> - Separate ztso and rvwmo in ad by using UseZtso predicate.
> - Match all that requires the same membar.
> - Make fence/fencei protected as they shouldn't be using directly.
> - Increased cost of membars to VOLATILE_REF_COST.
> - Added a real_empty pipe.
> - Change to pipe_slow on TSO (as x86).
>
> Note that C2-rv64 is now superior to gcc/clang regrading fencing:
> https://godbolt.org/z/6E3YTP15j
>
> Testing jcstress, tier1 and manually reading the generated assembly.
> Doing additional testing, but RFR it now as it may need some consideration.
>
> /Robbin
This pull request has now been integrated.
Changeset: 6d9ece73
Author: Robbin Ehn <rehn at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/6d9ece73a96dd32fccf4a740205407a76dcd907a
Stats: 147 lines in 4 files changed: 71 ins; 27 del; 49 mod
8351949: RISC-V: Cleanup and enable store-load peephole for membars
Reviewed-by: fyang, fjiang, mli
-------------
PR: https://git.openjdk.org/jdk/pull/24035
More information about the hotspot-dev
mailing list