mbox series

[RFC,gcc13,backport,0/3] Add Ztso atomic mappings

Message ID 20231003222700.909771-1-patrick@rivosinc.com
Headers show
Series Add Ztso atomic mappings | expand

Message

Patrick O'Neill Oct. 3, 2023, 10:26 p.m. UTC
I vaugely recall some discussion about backporting the Ztso mappings
along with the RVWMO mappings. Now that the RVWMO mappings have been
backported for 13.3, is there interest in also backporting the Ztso
mappings?

Tested using for regressions using rv32gc/rv64gc glibc.

Jeff Law (1):
  [RISCV][committed] Remove spurious newline in ztso sequence

Patrick O'Neill (2):
  RISC-V: Add Ztso atomic mappings
  RISC-V: Specify -mabi for ztso testcases

 gcc/common/config/riscv/riscv-common.cc       |   6 +
 gcc/config/riscv/riscv-opts.h                 |   4 +
 gcc/config/riscv/riscv.cc                     |  20 +++-
 gcc/config/riscv/riscv.md                     |   2 +
 gcc/config/riscv/riscv.opt                    |   3 +
 gcc/config/riscv/sync-rvwmo.md                |  96 +++++++++++++++
 gcc/config/riscv/sync-ztso.md                 |  80 +++++++++++++
 gcc/config/riscv/sync.md                      | 111 ++++++------------
 .../riscv/amo-table-ztso-amo-add-1.c          |  15 +++
 .../riscv/amo-table-ztso-amo-add-2.c          |  15 +++
 .../riscv/amo-table-ztso-amo-add-3.c          |  15 +++
 .../riscv/amo-table-ztso-amo-add-4.c          |  15 +++
 .../riscv/amo-table-ztso-amo-add-5.c          |  15 +++
 .../riscv/amo-table-ztso-compare-exchange-1.c |  10 ++
 .../riscv/amo-table-ztso-compare-exchange-2.c |  10 ++
 .../riscv/amo-table-ztso-compare-exchange-3.c |  10 ++
 .../riscv/amo-table-ztso-compare-exchange-4.c |  10 ++
 .../riscv/amo-table-ztso-compare-exchange-5.c |  10 ++
 .../riscv/amo-table-ztso-compare-exchange-6.c |  10 ++
 .../riscv/amo-table-ztso-compare-exchange-7.c |  10 ++
 .../gcc.target/riscv/amo-table-ztso-fence-1.c |  14 +++
 .../gcc.target/riscv/amo-table-ztso-fence-2.c |  14 +++
 .../gcc.target/riscv/amo-table-ztso-fence-3.c |  14 +++
 .../gcc.target/riscv/amo-table-ztso-fence-4.c |  14 +++
 .../gcc.target/riscv/amo-table-ztso-fence-5.c |  15 +++
 .../gcc.target/riscv/amo-table-ztso-load-1.c  |  16 +++
 .../gcc.target/riscv/amo-table-ztso-load-2.c  |  16 +++
 .../gcc.target/riscv/amo-table-ztso-load-3.c  |  17 +++
 .../gcc.target/riscv/amo-table-ztso-store-1.c |  16 +++
 .../gcc.target/riscv/amo-table-ztso-store-2.c |  16 +++
 .../gcc.target/riscv/amo-table-ztso-store-3.c |  17 +++
 .../riscv/amo-table-ztso-subword-amo-add-1.c  |  10 ++
 .../riscv/amo-table-ztso-subword-amo-add-2.c  |  10 ++
 .../riscv/amo-table-ztso-subword-amo-add-3.c  |  10 ++
 .../riscv/amo-table-ztso-subword-amo-add-4.c  |  10 ++
 .../riscv/amo-table-ztso-subword-amo-add-5.c  |  10 ++
 36 files changed, 612 insertions(+), 74 deletions(-)
 create mode 100644 gcc/config/riscv/sync-rvwmo.md
 create mode 100644 gcc/config/riscv/sync-ztso.md
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-1.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-2.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-3.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-4.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-amo-add-5.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-1.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-2.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-3.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-4.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-5.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-6.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-compare-exchange-7.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-1.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-2.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-3.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-4.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-fence-5.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-1.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-2.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-load-3.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-1.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-2.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-store-3.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-1.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-2.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-3.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-4.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/amo-table-ztso-subword-amo-add-5.c

--
2.34.1

Comments

Jeff Law Oct. 4, 2023, 3:53 p.m. UTC | #1
On 10/3/23 16:26, Patrick O'Neill wrote:
> I vaugely recall some discussion about backporting the Ztso mappings
> along with the RVWMO mappings. Now that the RVWMO mappings have been
> backported for 13.3, is there interest in also backporting the Ztso
> mappings?
> 
> Tested using for regressions using rv32gc/rv64gc glibc.
> 
> Jeff Law (1):
>    [RISCV][committed] Remove spurious newline in ztso sequence
> 
> Patrick O'Neill (2):
>    RISC-V: Add Ztso atomic mappings
>    RISC-V: Specify -mabi for ztso testcases
I recall discussing Ztso mappings, but not the final conclusion.  I 
think the final decision comes down to the motivation behind the changes.

If they're primarily optimized sequences utilizing the stronger ordering 
guarantees from Ztso, then it's probably not a good candidate for 
gcc-13.  If the primary motivation is to make it easier to port code 
from targets with stronger memory models (ie x86), then the Ztso work is 
a reasonable candidate for backporting.

Jeff
Patrick O'Neill Oct. 10, 2023, 2:49 p.m. UTC | #2
On 10/4/23 08:53, Jeff Law wrote:
>
>
> On 10/3/23 16:26, Patrick O'Neill wrote:
>> I vaugely recall some discussion about backporting the Ztso mappings
>> along with the RVWMO mappings. Now that the RVWMO mappings have been
>> backported for 13.3, is there interest in also backporting the Ztso
>> mappings?
>>
>> Tested using for regressions using rv32gc/rv64gc glibc.
>>
>> Jeff Law (1):
>>    [RISCV][committed] Remove spurious newline in ztso sequence
>>
>> Patrick O'Neill (2):
>>    RISC-V: Add Ztso atomic mappings
>>    RISC-V: Specify -mabi for ztso testcases
> I recall discussing Ztso mappings, but not the final conclusion. I 
> think the final decision comes down to the motivation behind the changes.
>
> If they're primarily optimized sequences utilizing the stronger 
> ordering guarantees from Ztso, then it's probably not a good candidate 
> for gcc-13.  If the primary motivation is to make it easier to port 
> code from targets with stronger memory models (ie x86), then the Ztso 
> work is a reasonable candidate for backporting.
>
> Jeff

Discussed during the GCC patchworks meeting.

The Ztso mappings are a subset of RVWMO fences/ordering constraints
(it's an optimization change) [1].
This backport also makes tip-of-tree sync.md files match gcc 13.3+ which
simplifies future atomic-related backports.

If in the future someone needs Ztso/there is a need to backport we can
re-evaluate this backport then.

Thanks
Patrick

[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/391