summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/z_Windows_NT_util.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fixed second issue reported in https://bugs.llvm.org/show_bug.cgi?id=41584.Andrey Churbanov2019-05-161-6/+16
| | | | | | | | | | | | | Added synchronization for possible concurrent initialization of mutexes by multiple threads. The need of synchronization caused by commit r357927 which added the use of mutexes at threads movement to/from common pool (earlier the mutexes were used only at suspend/resume). Patch by Johnny Peyton. Differential Revision: https://reviews.llvm.org/D61995 llvm-svn: 360919
* [OpenMP] Clean up load balancing dynamic modeJonathan Peyton2019-04-081-1/+1
| | | | | | | | | | | | | | | | This patch cleans up the bookkeeping code for the load balancing dynamic mode. When a thread is moved to or from the thread pool, the th_active_in_pool flag and the __kmp_thread_pool_active_nth global counter are both updated. This removes the need for the corrective code in the main wait loop. Another global counter, __kmp_thread_pool_nth, was removed completely, as it was only used for debugging, but was not under KMP_DEBUG. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D59508 llvm-svn: 357927
* [OpenMP] Fix hang on WindowsJonathan Peyton2019-04-041-21/+46
| | | | | | | | | | | | | | | | | | | | | | | | Debug dump on large machine shows when many OpenMP threads (401 in total) sleep on a barrier, one of the innermost nesting levels sleeps on a child's b_arrived flag whose value is equal to 4 and is equal to checker value. i.e., (1) sleep bit is 0, and (2) done_check() would return true if called. It is unclear how this might happen. It could be Windows Server 2016's error of EnterCriticalSection / LeaveCriticalSection, or error of WaitForSingleObject / SetEvent / ResetEvent, or error in the library which is very difficult to find. As a workaround, change INFINITE wait to timed wait, so that each thread awakens each 5 seconds (the timeout was chosen arbitrary to not disturb other threads much), check flag condition under the lock, and either go to sleep again or stop sleeping as a result of the check. Patch by Andrey Churbanov Differential Revision: https://reviews.llvm.org/D59793 llvm-svn: 357722
* [OpenMP] Make use of sched_yield optional in runtimeJonathan Peyton2019-02-281-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch cleans up the yielding code and makes it optional. An environment variable, KMP_USE_YIELD, was added. Yielding is still on by default (KMP_USE_YIELD=1), but can be turned off completely (KMP_USE_YIELD=0), or turned on only when oversubscription is detected (KMP_USE_YIELD=2). Note that oversubscription cannot always be detected by the runtime (for example, when the runtime is initialized and the process forks, oversubscription cannot be detected currently over multiple instances of the runtime). Because yielding can be controlled by user now, the library mode settings (from KMP_LIBRARY) for throughput and turnaround have been adjusted by altering blocktime, unless that was also explicitly set. In the original code, there were a number of places where a double yield might have been done under oversubscription. This version checks oversubscription and if that's not going to yield, then it does the spin check. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D58148 llvm-svn: 355120
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* [OpenMP] Add omp_pause_resource* APIJonathan Peyton2019-01-161-0/+24
| | | | | | | | | | | | Add omp_pause_resource and omp_pause_resource_all API and enum, plus stub for internal implementation. Implemented callable helper function to do local pause, and added basic functionality for hard and soft pause. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D55078 llvm-svn: 351372
* Support clang compiling under windows-gnu and windows-msvcAndrey Churbanov2018-12-101-0/+1
| | | | | | | | Patch by Peiyuan Song <squallatf@gmail.com> Differential Revision: https://reviews.llvm.org/D53422 llvm-svn: 348756
* [OpenMP] Convert KMP_DYNAMIC_LIB to a 0 or 1 guard everywhereJonathan Peyton2018-10-051-1/+1
| | | | llvm-svn: 343869
* [OpenMP] Use C++11 Atomics - barrier, tasking, and lock codeJonathan Peyton2018-07-091-2/+2
| | | | | | | | | | | | | | | | | These are preliminary changes that attempt to use C++11 Atomics in the runtime. We are expecting better portability with this change across architectures/OSes. Here is the summary of the changes. Most variables that need synchronization operation were converted to generic atomic variables (std::atomic<T>). Variables that are updated with combined CAS are packed into a single atomic variable, and partial read/write is done through unpacking/packing Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D47903 llvm-svn: 336563
* Apply formatting changesJonathan Peyton2017-10-201-2/+0
| | | | | | | | | | .clang-format's comments are removed and a (hopefully) final set of formatting changes are applied. Differential Revision: https://reviews.llvm.org/D38837 Differential Revision: https://reviews.llvm.org/D38920 llvm-svn: 316227
* Remove unnecessary semicolonsJonathan Peyton2017-09-271-26/+26
| | | | | | | | Removes semicolons after if {} blocks, function definitions, etc. I was able to apply the large OMPT patch cleanly on top of this one with no conflicts. llvm-svn: 314340
* Minor code cleanup of Klocwork issuesJonathan Peyton2017-09-051-23/+15
| | | | | | | | | | | Minor code cleanup of Klocwork issues. Fatal messages are given no return attribute. Define and use KMP_NORETURN to work for multiple C++ versions. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D37275 llvm-svn: 312538
* remove deprecated register storage class specifierEd Maste2017-07-071-1/+1
| | | | | | | | | | While importing libomp into the FreeBSD base system we encountered Clang warnings that "'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]". Differential Revision: https://reviews.llvm.org/D35124 llvm-svn: 307441
* Clang-format and whitespace cleanup of source codeJonathan Peyton2017-05-121-1362/+1168
| | | | | | | | | | | | | This patch contains the clang-format and cleanup of the entire code base. Some of clang-formats changes made the code look worse in places. A best effort was made to resolve the bulk of these problems, but many remain. Most of the problems were mangling line-breaks and tabbing of comments. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D32659 llvm-svn: 302929
* Follow up to r289732: Update comments in source files to reference .cpp filesJonathan Peyton2016-12-141-1/+1
| | | | | | Patch by Hansang Bae llvm-svn: 289739
* Change source files from .c to .cppJonathan Peyton2016-12-141-0/+1772
Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D26688 llvm-svn: 289732
OpenPOWER on IntegriCloud