[NVPTX] Support __scoped_atomic_* operations in NVPTX (#184737)

Summary:
All the infrastructure for this is here, it's just no one's turned it
on.
This commit is contained in:
Joseph Huber 2026-03-11 07:53:57 -05:00 committed by GitHub
parent 71608f4ce3
commit d8a74676d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1452 additions and 130 deletions

View File

@ -8,6 +8,7 @@
#include "ABIInfoImpl.h"
#include "TargetInfo.h"
#include "clang/Basic/SyncScope.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/CallingConv.h"
@ -50,6 +51,9 @@ public:
CodeGen::CodeGenModule &M) const override;
bool shouldEmitStaticExternCAliases() const override;
StringRef getLLVMSyncScopeStr(const LangOptions &LangOpts, SyncScope Scope,
llvm::AtomicOrdering Ordering) const override;
llvm::Constant *getNullPointer(const CodeGen::CodeGenModule &CGM,
llvm::PointerType *T,
QualType QT) const override;
@ -299,6 +303,35 @@ bool NVPTXTargetCodeGenInfo::shouldEmitStaticExternCAliases() const {
return false;
}
StringRef NVPTXTargetCodeGenInfo::getLLVMSyncScopeStr(
const LangOptions &LangOpts, SyncScope Scope,
llvm::AtomicOrdering Ordering) const {
switch (Scope) {
case SyncScope::HIPSingleThread:
case SyncScope::SingleScope:
return "singlethread";
case SyncScope::HIPWavefront:
case SyncScope::OpenCLSubGroup:
case SyncScope::WavefrontScope:
case SyncScope::HIPWorkgroup:
case SyncScope::OpenCLWorkGroup:
case SyncScope::WorkgroupScope:
return "block";
case SyncScope::HIPCluster:
case SyncScope::ClusterScope:
return "cluster";
case SyncScope::HIPAgent:
case SyncScope::OpenCLDevice:
case SyncScope::DeviceScope:
return "device";
case SyncScope::SystemScope:
case SyncScope::HIPSystem:
case SyncScope::OpenCLAllSVMDevices:
return "";
}
llvm_unreachable("Unknown SyncScope enum");
}
llvm::Constant *
NVPTXTargetCodeGenInfo::getNullPointer(const CodeGen::CodeGenModule &CGM,
llvm::PointerType *PT,

File diff suppressed because it is too large Load Diff