-
Notifications
You must be signed in to change notification settings - Fork 163
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
Strengthen atomic_compare_exchange seq_cst failure mapping #445
Strengthen atomic_compare_exchange seq_cst failure mapping #445
Conversation
Happy to update formatting/verbage. An alternative format would to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this version is clear and concise.
Thanks for the review! |
The Zacas extension defines different ordering behavior when an amocas fails: > The memory operation performed by an AMOCAS.W/D/Q, when not successful, has > acquire semantics if aq bit is 1 but does not have release semantics, > regardless of rl. This requires a leading fence to maintain A6C compatability for both the RVWMO and Ztso memory models. The A7 mappings can use the non-fenced versions. See issue riscv-non-isa#444 for more context and litmus tests. Resolves riscv-non-isa#444.
da2ed14
to
f90df2d
Compare
Updated to address @hboehm's review by adding note-3 to the Ztso table. |
The discussion has concluded so I think this is OK to land. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM since @hboehm say OK :P
… to ABI change The psABI was updated to note that a leading fence must be present for amocas with seq_cst failure ordering. <riscv-non-isa/riscv-elf-psabi-doc#445>. shouldInsertFencesForAtomic only returns true for AtomicCmpXchg if Zacas is present, because doing so otherwise changes codegen due to how the atomic expansion pass handles this hook.
…hange A recent atomics ABI change / fix requiresthat for the "A6C" and A6S" atomics ABIs (i.e. both of those supported by LLVM currently), an additional fence is inserted for an atomic_compare_exchange with seq_cst failure ordering. <riscv-non-isa/riscv-elf-psabi-doc#445> This isn't trivial to support through the hooks used by AtomicExpandPass because that pass assumes that when fences are inserted, the original atomics ordering information can be removed from the instruction. Rather than try to change and complicate that API, this patch implements the needed fence insertion in RISCVCodeGenPrepare.
…hange A recent atomics ABI change / fix requiresthat for the "A6C" and A6S" atomics ABIs (i.e. both of those supported by LLVM currently), an additional fence is inserted for an atomic_compare_exchange with seq_cst failure ordering. <riscv-non-isa/riscv-elf-psabi-doc#445> This isn't trivial to support through the hooks used by AtomicExpandPass because that pass assumes that when fences are inserted, the original atomics ordering information can be removed from the instruction. Rather than try to change and complicate that API, this patch implements the needed fence insertion in RISCVCodeGenPrepare.
…hange (#101023) A recent atomics ABI change / fix requires that for the "A6C" and A6S" atomics ABIs (i.e. both of those supported by LLVM currently), an additional fence is inserted for an atomic_compare_exchange with seq_cst failure ordering. <riscv-non-isa/riscv-elf-psabi-doc#445> This isn't trivial to support through the hooks used by AtomicExpandPass because that pass assumes that when fences are inserted, the original atomics ordering information can be removed from the instruction. Rather than try to change and complicate that API, this patch implements the needed fence insertion through a small special purpose pass.
…hange (llvm#101023) A recent atomics ABI change / fix requires that for the "A6C" and A6S" atomics ABIs (i.e. both of those supported by LLVM currently), an additional fence is inserted for an atomic_compare_exchange with seq_cst failure ordering. <riscv-non-isa/riscv-elf-psabi-doc#445> This isn't trivial to support through the hooks used by AtomicExpandPass because that pass assumes that when fences are inserted, the original atomics ordering information can be removed from the instruction. Rather than try to change and complicate that API, this patch implements the needed fence insertion through a small special purpose pass.
The Zacas extension defines different ordering behavior when an amocas fails:
This requires a leading fence to maintain A6C compatability for both the RVWMO and Ztso memory models. The A7 mappings can use the non-fenced versions.
See issue #444 for more context and litmus tests.
Resolves #444.