[llvm] [NVPTX] add support for 128-bit atomics (PR #154852)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 11:47:29 PDT 2025
================
@@ -1026,15 +1026,19 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
setOperationAction(ISD::ADDRSPACECAST, {MVT::i32, MVT::i64}, Custom);
setOperationAction(ISD::ATOMIC_LOAD_SUB, {MVT::i32, MVT::i64}, Expand);
- // No FPOW or FREM in PTX.
+
+ // atom.b128 is legal in PTX but since we don't represent i128 as a legal
+ // type, we need to custom lower it.
+ setOperationAction({ISD::ATOMIC_CMP_SWAP, ISD::ATOMIC_SWAP}, MVT::i128,
+ Custom);
// Now deduce the information based on the above mentioned
// actions
computeRegisterProperties(STI.getRegisterInfo());
// PTX support for 16-bit CAS is emulated. Only use 32+
setMinCmpXchgSizeInBits(STI.getMinCmpXchgSizeInBits());
- setMaxAtomicSizeInBitsSupported(64);
+ setMaxAtomicSizeInBitsSupported(128);
----------------
gonzalobg wrote:
@akshayrdeodhar for vis. My preference would be to make this compute capability dependent. If sm >= 90, then 128, else 64. If a 128-bit operation is requested on a compute capability that has 64, we should error.
https://github.com/llvm/llvm-project/pull/154852
More information about the llvm-commits
mailing list