Skip to content

Update Parallelism.cpp #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2022
Merged
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
9 changes: 5 additions & 4 deletions openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
FunctionTracingRAII();

uint32_t TId = mapping::getThreadIdInBlock();
bool IsMainInBlock = mapping::isMainThreadInBlock();

// Assert the parallelism level is zero if disabled by the user.
ASSERT((config::mayUseNestedParallelism() || icv::Level == 0) &&
Expand Down Expand Up @@ -115,14 +116,14 @@ void __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
// last or the other updates will cause a thread specific state to be
// created.
state::ValueRAII ParallelTeamSizeRAII(state::ParallelTeamSize, NumThreads,
1u, TId == 0, ident,
1u, IsMainInBlock, ident,
/* ForceTeamState */ true);
state::ValueRAII ActiveLevelRAII(icv::ActiveLevel, 1u, 0u, TId == 0,
state::ValueRAII ActiveLevelRAII(icv::ActiveLevel, 1u, 0u, IsMainInBlock,
ident, /* ForceTeamState */ true);
state::ValueRAII LevelRAII(icv::Level, 1u, 0u, TId == 0, ident,
state::ValueRAII LevelRAII(icv::Level, 1u, 0u, IsMainInBlock, ident,
/* ForceTeamState */ true);

// Synchronize all threads after the main thread (TId == 0) set up the
// Synchronize all threads after the main thread (IsMainInBlock) set up the
// team state properly.
synchronize::threadsAligned();

Expand Down