Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv: Support 128-bit atomics for RV64 and 64-bit atomics for RV32 (Zacas extension) #173

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

taiki-e
Copy link
Owner

@taiki-e taiki-e commented Sep 1, 2024

This supports 128-bit atomics for riscv64 and 64-bit atomics for riscv32 with Zacas extension (ratified more than half a year ago) enabled.

Note:

  • Currently Zacas extension support is marked as experimental in LLVM: so -C target-feature=+experimental-zacas instead of -C target-feature=+zacas is needed for now.
    • As the name indicates, support for this extension on our part at this time will also be somewhat experimental.
    • Perhaps we cannot merge this PR until LLVM marks this as non-experimental.
      • Now marked as experimental on our end too. And now only enabled for LLVM 19 because it is more experimental in LLVM 17/18 and "experimental-zacas" feature may no longer exist when it is marked as non-experimental in LLVM 20.
  • The core part of runtime CPU feature detection has already been implemented for Linux/Android and tested for Linux on QEMU, but is test-only until zacas is marked as non-experimental by LLVM.
  • Zacas extension provides DWCAS, but there is no DW load/store instruction in the ratified atomic-related extensions AFAIK, so a load/store implementation at this time would not be very efficient.

FYI @ibraheemdev

@taiki-e taiki-e added the O-riscv Target: RISC-V architecture label Sep 1, 2024
@taiki-e taiki-e force-pushed the riscv64-zacas branch 3 times, most recently from aef1268 to cb69baa Compare September 1, 2024 05:49
@taiki-e taiki-e force-pushed the riscv64-zacas branch 2 times, most recently from 6f63126 to 4e95659 Compare September 7, 2024 07:49
taiki-e added a commit that referenced this pull request Sep 7, 2024
@taiki-e taiki-e force-pushed the riscv64-zacas branch 3 times, most recently from bb3edf4 to 00722a4 Compare September 18, 2024 17:18
@taiki-e taiki-e changed the title riscv64: Support 128-bit atomics (Zacas extension) riscv: Support 128-bit atomics on RV64 and 64-bit atomics on RV32 (Zacas extension) Sep 18, 2024
@taiki-e taiki-e changed the title riscv: Support 128-bit atomics on RV64 and 64-bit atomics on RV32 (Zacas extension) riscv: Support 128-bit atomics for RV64 and 64-bit atomics for RV32 (Zacas extension) Sep 18, 2024
@taiki-e taiki-e force-pushed the riscv64-zacas branch 2 times, most recently from e0ec885 to bcb83bf Compare September 18, 2024 17:50
@taiki-e taiki-e force-pushed the riscv64-zacas branch 8 times, most recently from 4769824 to 910f2a9 Compare September 18, 2024 19:14
@taiki-e taiki-e merged commit 343d10c into main Sep 18, 2024
105 checks passed
@taiki-e taiki-e deleted the riscv64-zacas branch September 18, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-riscv Target: RISC-V architecture
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant