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
21 changes: 10 additions & 11 deletions clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,13 +925,11 @@ void CGOpenMPRuntimeGPU::emitNumThreadsClause(
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;
if (SeverityLoc.isValid())
emitSeverityClause(Severity, SeverityLoc);
if (MessageLoc.isValid())
emitMessageClause(CGF, Message, MessageLoc);
}

// Nothing to do.
}

void CGOpenMPRuntimeGPU::emitNumTeamsClause(CodeGenFunction &CGF,
Expand Down Expand Up @@ -1238,9 +1236,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 @@ -1291,8 +1289,9 @@ void CGOpenMPRuntimeGPU::emitParallelCall(
else
NumThreadsVal = Bld.CreateZExtOrTrunc(NumThreadsVal, CGF.Int32Ty);

// No strict prescriptiveness for the number of threads.
llvm::Value *StrictNumThreadsVal = llvm::ConstantInt::get(CGF.Int32Ty, 0);
// Forward whether the strict modifier is specified.
llvm::Value *StrictNumThreadsVal = llvm::ConstantInt::get(
CGM.Int32Ty, NumThreadsModifier == OMPC_NUMTHREADS_strict);

assert(IfCondVal && "Expected a value");
llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
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;
}
}


1,067 changes: 1,067 additions & 0 deletions clang/test/OpenMP/amdgcn_target_parallel_num_threads_codegen.cpp

Large diffs are not rendered by default.

11,479 changes: 5,803 additions & 5,676 deletions clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp

Large diffs are not rendered by default.

3,417 changes: 3,417 additions & 0 deletions clang/test/OpenMP/distribute_parallel_for_simd_num_threads_strict_codegen.cpp

Large diffs are not rendered by default.

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

This file was deleted.

Loading