Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 16 additions & 24 deletions clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,13 +922,6 @@ void CGOpenMPRuntimeGPU::emitNumThreadsClause(
OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
SourceLocation SeverityLoc, const Expr *Message,
SourceLocation MessageLoc) {
if (Modifier == OMPC_NUMTHREADS_strict) {
CGM.getDiags().Report(Loc,
diag::warn_omp_gpu_unsupported_modifier_for_clause)
<< "strict" << getOpenMPClauseName(OMPC_num_threads);
return;
}

// Nothing to do.
}

Expand Down Expand Up @@ -1236,9 +1229,9 @@ void CGOpenMPRuntimeGPU::emitParallelCall(
if (!CGF.HaveInsertPoint())
return;

auto &&ParallelGen = [this, Loc, OutlinedFn, CapturedVars, IfCond,
NumThreads](CodeGenFunction &CGF,
PrePostActionTy &Action) {
auto &&ParallelGen = [this, Loc, OutlinedFn, CapturedVars, IfCond, NumThreads,
NumThreadsModifier](CodeGenFunction &CGF,
PrePostActionTy &Action) {
CGBuilderTy &Bld = CGF.Builder;
llvm::Value *NumThreadsVal = NumThreads;
llvm::Function *WFn = WrapperFunctionsMap[OutlinedFn];
Expand Down Expand Up @@ -1289,21 +1282,20 @@ void CGOpenMPRuntimeGPU::emitParallelCall(
NumThreadsVal = Bld.CreateZExtOrTrunc(NumThreadsVal, CGF.Int32Ty);

assert(IfCondVal && "Expected a value");
RuntimeFunction FnID = OMPRTL___kmpc_parallel_51;
llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
llvm::Value *Args[] = {
RTLoc,
getThreadID(CGF, Loc),
IfCondVal,
NumThreadsVal,
llvm::ConstantInt::get(CGF.Int32Ty, -1),
FnPtr,
ID,
Bld.CreateBitOrPointerCast(CapturedVarsAddrs.emitRawPointer(CGF),
CGF.VoidPtrPtrTy),
llvm::ConstantInt::get(CGM.SizeTy, CapturedVars.size())};
CGF.EmitRuntimeCall(OMPBuilder.getOrCreateRuntimeFunction(
CGM.getModule(), OMPRTL___kmpc_parallel_51),
Args);
llvm::SmallVector<llvm::Value *, 10> Args(
{RTLoc, getThreadID(CGF, Loc), IfCondVal, NumThreadsVal,
llvm::ConstantInt::get(CGF.Int32Ty, -1), FnPtr, ID,
Bld.CreateBitOrPointerCast(CapturedVarsAddrs.emitRawPointer(CGF),
CGF.VoidPtrPtrTy),
llvm::ConstantInt::get(CGM.SizeTy, CapturedVars.size())});
if (NumThreadsModifier == OMPC_NUMTHREADS_strict) {
FnID = OMPRTL___kmpc_parallel_60;
Args.append({llvm::ConstantInt::get(CGM.Int32Ty, true)});
}
CGF.EmitRuntimeCall(
OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(), FnID), Args);
};

RegionCodeGenTy RCG(ParallelGen);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class CGOpenMPRuntimeGPU : public CGOpenMPRuntime {
/// \param NumThreads The value corresponding to the num_threads clause, if
/// any, or nullptr.
/// \param NumThreadsModifier The modifier of the num_threads clause, if
/// any, ignored otherwise. Currently unused on the device.
/// any, ignored otherwise.
/// \param Severity The severity corresponding to the num_threads clause, if
/// any, ignored otherwise. Currently unused on the device.
/// \param Message The message string corresponding to the num_threads clause,
Expand Down
7 changes: 3 additions & 4 deletions clang/test/AST/ByteCode/openmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ extern int omp_get_thread_num(void);

int test2() {
int x = 0;
int result[N] = {0};
int device_result[N] = {0};

#pragma omp parallel loop num_threads(strict: N) severity(warning) message("msg")
#pragma omp target parallel loop num_threads(strict: N)
for (int i = 0; i < N; i++) {
x = omp_get_thread_num();
result[i] = i + x;
device_result[i] = i + x;
}
}


108 changes: 0 additions & 108 deletions clang/test/OpenMP/amdgcn_parallel_num_threads_strict_messages.cpp

This file was deleted.

Loading