[Openmp-commits] [PATCH] D95485: [OpenMP] libomp: fix clang-cl build for vs2019
Andrey Churbanov via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Jan 26 14:58:47 PST 2021
AndreyChurbanov created this revision.
AndreyChurbanov added reviewers: jlpeyton, hbae, tlwilmar, Nawrin.
AndreyChurbanov added a project: OpenMP.
Herald added subscribers: jfb, guansong, yaxunl.
AndreyChurbanov requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Joseph Shen <joseph.smeng at gmail.com> reported build failure on Windows because of poor code with atomic variable.
The patch fixes 3 offending cases.
Also two formatting changes suggested by clang-format.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95485
Files:
openmp/runtime/src/z_Windows_NT_util.cpp
Index: openmp/runtime/src/z_Windows_NT_util.cpp
===================================================================
--- openmp/runtime/src/z_Windows_NT_util.cpp
+++ openmp/runtime/src/z_Windows_NT_util.cpp
@@ -239,9 +239,10 @@
old_f = flag->unset_sleeping();
KMP_DEBUG_ASSERT(old_f & KMP_BARRIER_SLEEP_STATE);
TCW_PTR(th->th.th_sleep_loc, NULL);
- KF_TRACE(50, ("__kmp_win32_cond_wait: exiting, condition "
- "fulfilled: flag's loc(%p): %u => %u\n",
- flag->get(), old_f, *(flag->get())));
+ KF_TRACE(50,
+ ("__kmp_win32_cond_wait: exiting, condition "
+ "fulfilled: flag's loc(%p): %u => %u\n",
+ flag->get(), (unsigned int)old_f, (unsigned int)flag->load()));
__kmp_win32_mutex_lock(&cv->waiters_count_lock_);
KMP_DEBUG_ASSERT(cv->waiters_count_ > 0);
@@ -380,8 +381,8 @@
}
KF_TRACE(5, ("__kmp_suspend_template: T#%d set sleep bit for flag's"
- " loc(%p)==%d\n",
- th_gtid, flag->get(), *(flag->get())));
+ " loc(%p)==%u\n",
+ th_gtid, flag->get(), (unsigned int)flag->load()));
if (flag->done_check_val(old_spin)) {
old_spin = flag->unset_sleeping();
@@ -493,7 +494,8 @@
if (!flag->is_sleeping_val(old_spin)) {
KF_TRACE(5, ("__kmp_resume_template: T#%d exiting, thread T#%d already "
"awake: flag's loc(%p): %u => %u\n",
- gtid, target_gtid, flag->get(), old_spin, *(flag->get())));
+ gtid, target_gtid, flag->get(), (unsigned int)old_spin,
+ (unsigned int)flag->load()));
__kmp_unlock_suspend_mx(th);
return;
}
@@ -591,7 +593,8 @@
}
void __kmp_affinity_determine_capable(const char *env_var) {
-// All versions of Windows* OS (since Win '95) support SetThreadAffinityMask().
+ // All versions of Windows* OS (since Win '95) support
+ // SetThreadAffinityMask().
#if KMP_GROUP_AFFINITY
KMP_AFFINITY_ENABLE(__kmp_num_proc_groups * sizeof(DWORD_PTR));
@@ -950,8 +953,7 @@
return 1e9 * __kmp_win32_tick * now.QuadPart;
}
-extern "C"
-void *__stdcall __kmp_launch_worker(void *arg) {
+extern "C" void *__stdcall __kmp_launch_worker(void *arg) {
volatile void *stack_data;
void *exit_val;
void *padding = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95485.319413.patch
Type: text/x-patch
Size: 2341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210126/ec628efa/attachment.bin>
More information about the Openmp-commits
mailing list