Skip to content

Commit 671d007

Browse files
ronliebritter-x2a
authored andcommitted
swdev-512633-gfx940-gfx941
remove gfx940 and gfx941 from offload. openmp swdev-512633-gfx940-gfx941
1 parent 28de2e0 commit 671d007

File tree

9 files changed

+2
-821
lines changed

9 files changed

+2
-821
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,13 +1694,6 @@ class CGOpenMPRuntime {
16941694
return std::make_pair(false, RValue::get(nullptr));
16951695
}
16961696

1697-
/// Return whether the current architecture must emit CAS loop runtime call
1698-
/// for given type and atomic operation
1699-
virtual bool mustEmitSafeAtomic(CodeGenFunction &CGF, LValue X, RValue Update,
1700-
BinaryOperatorKind BO) {
1701-
return false;
1702-
}
1703-
17041697
/// Used for AMDGPU architectures where certain atomics must be lowered
17051698
/// to a CAS loop.
17061699
virtual std::pair<bool, RValue> emitAtomicCASLoop(CodeGenFunction &CGF,

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,8 +2545,6 @@ void CGOpenMPRuntimeGPU::processRequiresDirective(const OMPRequiresDecl *D) {
25452545
case OffloadArch::GFX90a:
25462546
case OffloadArch::GFX90c:
25472547
case OffloadArch::GFX9_4_GENERIC:
2548-
case OffloadArch::GFX940:
2549-
case OffloadArch::GFX941:
25502548
case OffloadArch::GFX942:
25512549
case OffloadArch::GFX950:
25522550
case OffloadArch::GFX10_1_GENERIC:
@@ -3380,58 +3378,6 @@ void CGOpenMPRuntimeGPU::emitFlush(CodeGenFunction &CGF, ArrayRef<const Expr *>,
33803378
}
33813379
}
33823380

3383-
// The only allowed atomicrmw is add on int 32 and 64 bits, cmp_and_swap, swap.
3384-
bool CGOpenMPRuntimeGPU::mustEmitSafeAtomic(CodeGenFunction &CGF, LValue X,
3385-
RValue Update,
3386-
BinaryOperatorKind BO) {
3387-
ASTContext &Context = CGF.getContext();
3388-
OffloadArch Arch = getOffloadArch(CGM);
3389-
3390-
if (!Context.getTargetInfo().getTriple().isAMDGCN() ||
3391-
!CGF.CGM.getLangOpts().OpenMPIsTargetDevice)
3392-
return false;
3393-
3394-
if (Arch != OffloadArch::GFX941)
3395-
return false;
3396-
3397-
// Non simple types cannot be used in atomicRMW and are handled elsewhere
3398-
if (!X.isSimple())
3399-
return false;
3400-
3401-
// Integer types are lowered by backend to atomic ISA (32 and 64 bits) or to
3402-
// CAS loop (all other bit widths).
3403-
if (BO == BO_Add && Update.getScalarVal()->getType()->isIntegerTy())
3404-
return false;
3405-
3406-
// For all other operations, integer types that are not 32 or 64 bits are
3407-
// already converted to CAS loop by clang codegen or backend. This allows for
3408-
// simpler handling in devicertl call.
3409-
if (Update.getScalarVal()->getType()->isIntegerTy() &&
3410-
(Context.getTypeSize(X.getType()) < 32 ||
3411-
Context.getTypeSize(X.getType()) > 64))
3412-
return false;
3413-
3414-
// float and double have a atomic ISA for min, max, and add that need to be
3415-
// bypassed. All other operations on float and double are lowered to cas loop
3416-
// by the backend
3417-
if ((Update.getScalarVal()->getType()->isFloatTy() ||
3418-
Update.getScalarVal()->getType()->isDoubleTy()) &&
3419-
!((BO == BO_Add) || (BO == BO_LT) || (BO == BO_GT)))
3420-
return false;
3421-
3422-
// For all types, the ISA only supports certain operations in a "native" way.
3423-
// All others are lowered to a CAS loop by the backend
3424-
if (!((BO == BO_Add) || (BO == BO_Sub) || (BO == BO_LT) || (BO == BO_GT) ||
3425-
(BO == BO_And) || (BO == BO_Or) || (BO == BO_Xor)))
3426-
return false;
3427-
3428-
// all other cases must be lowered to safe CAS loop
3429-
// which is hidden in a runtime function that uses cmpxchg directly and not
3430-
// atomicrmw. This is effectively bypassing the backend on the decision of
3431-
// what atomic to use.
3432-
return true;
3433-
}
3434-
34353381
std::pair<bool, RValue>
34363382
CGOpenMPRuntimeGPU::emitAtomicCASLoop(CodeGenFunction &CGF, LValue X,
34373383
RValue Update, BinaryOperatorKind BO) {

clang/lib/CodeGen/CGOpenMPRuntimeGPU.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,6 @@ class CGOpenMPRuntimeGPU : public CGOpenMPRuntime {
208208
BinaryOperatorKind BO,
209209
bool IsXBinopExpr) override;
210210

211-
/// Return whether the current architecture must emit CAS loop runtime call
212-
/// for given type and atomic operation
213-
bool mustEmitSafeAtomic(CodeGenFunction &CGF, LValue X, RValue Update,
214-
BinaryOperatorKind BO) override;
215-
216211
// Emit call to CAS loop
217212
std::pair<bool, RValue> emitAtomicCASLoop(CodeGenFunction &CGF, LValue X,
218213
RValue Update,

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7089,12 +7089,6 @@ emitOMPAtomicRMW(CodeGenFunction &CGF, LValue X, RValue Update,
70897089
bool IsXLHSInRHSPart, const Expr *Hint, SourceLocation Loc) {
70907090
ASTContext &Context = CGF.getContext();
70917091

7092-
if (CGF.CGM.getOpenMPRuntime().mustEmitSafeAtomic(CGF, X, Update, BO)) {
7093-
// this will force emission of cmpxchg in the caller using
7094-
// clang machinery
7095-
return std::make_pair(false, RValue::get(nullptr));
7096-
}
7097-
70987092
bool useFPAtomics = canUseAMDGPUFastFPAtomics(CGF, X, Update, BO, Hint, Loc);
70997093
if (useFPAtomics) {
71007094
auto Ret = CGF.CGM.getOpenMPRuntime().emitFastFPAtomicCall(
@@ -7452,14 +7446,6 @@ static void emitOMPAtomicCompareExpr(
74527446

74537447
llvm::Value *EVal = EmitRValueWithCastIfNeeded(X, E);
74547448

7455-
if (CGF.CGM.getOpenMPRuntime().mustEmitSafeAtomic(
7456-
CGF, XLVal, RValue::get(EVal),
7457-
cast<BinaryOperator>(CE)->getOpcode())) {
7458-
CGF.CGM.getOpenMPRuntime().emitAtomicCASLoop(
7459-
CGF, XLVal, RValue::get(EVal), cast<BinaryOperator>(CE)->getOpcode());
7460-
return;
7461-
}
7462-
74637449
// Check if fast AMDGPU FP atomics can be used for the current operation:
74647450
bool canUseFastAtomics = canUseAMDGPUFastFPAtomics(
74657451
CGF, XLVal, RValue::get(EVal), cast<BinaryOperator>(CE)->getOpcode(),

0 commit comments

Comments
 (0)