summaryrefslogtreecommitdiffstats
path: root/openmp/runtime
Commit message (Collapse)AuthorAgeFilesLines
...
* Add const to some variables to avoid const_castsJonas Hahnfeld2017-11-092-7/+6
| | | | | | | | | In these places the const attribute seems correct and doesn't need any other change, so let's do it. Differential Revision: https://reviews.llvm.org/D39756 llvm-svn: 317798
* Remove const from variables with dynamic memoryJonas Hahnfeld2017-11-0913-83/+70
| | | | | | | | | | | | | | | | | | | Allocated memory is typically not 'const' if it needs to be freed. This patch removes around 50 wrong const attributes, modifies the corresponding functions and finally gets rid of some const_casts. These have especially been strange for __kmp_str_fname_free() that added a 'const' to call __kmp_str_free() which removed it again. Two minor cleanups that I performed in this process: * __kmp_tool_libraries now lives in kmp_settings.cpp as it is used nowhere else. * __kmp_msg_empty was removed as it was never used and Clang now complained that it was assigned a string literal that is 'const char *'. Differential Revision: https://reviews.llvm.org/D39755 llvm-svn: 317797
* [OMPT] Fix test cancel_parallel.cJonas Hahnfeld2017-11-091-16/+14
| | | | | | | | | | | | | | | | | | | | | If a parallel region is cancelled, execution resumes at the end of the structured block. That is why this test cannot use the "normal" macros that print right after inserting the label. Instead it previously printed the addresses before the pragma and swapped the checks compared to the other tests. However, this does not work because FileChecks '*' is greedy so that RETURN_ADDRESS always matched the second address. This makes the test fail when an "overflow" occurrs and the first address matches the value of codeptr_ra. I discovered this on my MacBook but I'm unable to reproduce the failure with the current version. Nevertheless we should fix this problem to avoid that this test fails later after an unrelated change. Differential Revision: https://reviews.llvm.org/D39708 llvm-svn: 317787
* [OMPT] Add support for testing return addresses on POWERJonas Hahnfeld2017-11-091-16/+72
| | | | | | | | | | | | | | | | | | | Return addresses are determined based on the address of a label that is inserted directly after a pragma / API call. In some cases the tests can assume a known number of instructions between the addresses. However, the instructions and their encoded lengths depend on the target that the test is compiled on. Firstly, this patch refactors the macro print_current_address() to allow such target dependent modifications and adds information for the observed instructions on POWER. Secondly, it adapts the related macro print_fuzzy_address() to reuse much of "hacky" code and fixes the used formatting strings in the printf() call. Finally, it also adds documentation about how these macros are intended to work. Differential Revision: https://reviews.llvm.org/D39699 llvm-svn: 317786
* Cleanup version symbol macros and attributes/declspecsJonathan Peyton2017-11-0710-523/+371
| | | | | | | | | | | | 1) Get rid of xaliasify, xexpand and xversionify for KMP_EXPAND_NAME and KMP_VERSION_SYMBOL. KMP_VERSION_SYMBOL is a combination of xaliasify and xversionify. 2) Put all attribute and __declspec definitions in kmp_os.h Differential Revision: https://reviews.llvm.org/D39516 llvm-svn: 317636
* [OMPT] Fix null pointer in parallel/no_thread_num_clause.cJonas Hahnfeld2017-11-061-1/+1
| | | | | | | Looks like the implementation of printf on Darwin uses "0x0" instead of "(nil)" like glibc does. llvm-svn: 317515
* [OMPT] Fix callback.h for tests for changes in TR6Jonas Hahnfeld2017-11-061-4/+4
| | | | | | This was also lost in the last commit. llvm-svn: 317484
* [OMPT] Improve cast that was lost on commit, NFC.Jonas Hahnfeld2017-11-061-2/+2
| | | | llvm-svn: 317480
* Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)Joachim Protze2017-11-057-278/+186
| | | | | | | | | | | The TR6 document is expected to be publically released around November 15. This patch does not implement OMPT for libomptarget. Patch by Simon Convent and Joachim Protze Differential Revision: https://reviews.llvm.org/D39182 llvm-svn: 317436
* Rename fields of ompt_frame_tJoachim Protze2017-11-059-106/+98
| | | | | | | | | | This is part of the renaming of data types from OpenMP TR4 to TR6 Patch by Simon Convent Differential Revision: https://reviews.llvm.org/D39326 llvm-svn: 317435
* Revert "Rename fields of ompt_frame_t"Jonas Hahnfeld2017-11-039-98/+106
| | | | | | This reverts commit r317338 which discarded some recent commits. llvm-svn: 317347
* Revert "Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 ↵Jonas Hahnfeld2017-11-0324-247/+392
| | | | | | | | (TR6)" This reverts commit r317339 which discarded some recent commits. llvm-svn: 317346
* Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)Joachim Protze2017-11-0324-392/+247
| | | | | | | | | | | The TR6 document is expected to be publically released around November 15. This patch does not implement OMPT for libomptarget. Patch by Simon Convent and Joachim Protze Differential Revision: https://reviews.llvm.org/D39182 llvm-svn: 317339
* Rename fields of ompt_frame_tJoachim Protze2017-11-039-106/+98
| | | | | | | | | | This is part of the renaming of data types from OpenMP TR4 to TR6 Patch by Simon Convent Differential Revision: https://reviews.llvm.org/D39326 llvm-svn: 317338
* [OpenMP] Fix race condition in omp_init_lockJonathan Peyton2017-11-012-3/+46
| | | | | | | | | | | | | | | | | | | | | This is a partial fix for bug 34050. This prevents callers of omp_set_lock (which does not hold __kmp_global_lock) from ever seeing an uninitialized version of __kmp_i_lock_table.table. It does not solve a use-after-free race condition if omp_set_lock obtains a pointer to __kmp_i_lock_table.table before it is updated and then attempts to dereference afterwards. That race is far less likely and can be handled in a separate patch. The unit test usually segfaults on the current trunk revision. It passes with the patch. Patch by Adam Azarchs Differential Revision: https://reviews.llvm.org/D39439 llvm-svn: 317115
* Update implementation of OMPT to the specification OpenMP 5.0 Preview 1 (TR4).Joachim Protze2017-11-0191-1829/+7244
| | | | | | | | | | | | | | The code is tested to work with latest clang, GNU and Intel compiler. The implementation is optimized for low overhead when no tool is attached shifting the cost to execution with tool attached. This patch does not implement OMPT for libomptarget. Patch by Simon Convent and Joachim Protze Differential Revision: https://reviews.llvm.org/D38185 llvm-svn: 317085
* Fix fatal error message displayingJonathan Peyton2017-10-251-6/+15
| | | | | | | | | | | | | Replacing call to __kmp_msg(kmp_ms_fatal,...) with __kmp_fatal(...) caused an issue when incomplete message is displayed in case an error message is followed by another message (e.g. by a hint messa)ge. This is because __kmp_fatal() passes incomplete list of arguments to __kmp_msg(). Patch by Olga Malysheva Differential Revision: https://reviews.llvm.org/D39248 llvm-svn: 316623
* Disable threadprivate data cleanup if runtime is terminatingJonathan Peyton2017-10-241-0/+7
| | | | | | | | | | | The problem is due to the runtime's threadprivate cleanup code which tries to access data that was already destroyed by one of the root threads. __kmp_init_gtid is used as a checker here since it is set to false before actual resource cleanup is done in __kmp_cleanup(). Patch by Hansang Bae llvm-svn: 316452
* Restrict OMPT to OpenMP version 5.0 and remove old header filesJonathan Peyton2017-10-204-1519/+4
| | | | | | | | Patch by Simon Convent Differential Revision: https://reviews.llvm.org/D38876 llvm-svn: 316234
* Add license envirable for testing Intel compilersJonathan Peyton2017-10-201-0/+4
| | | | | | | | Patch by Simon Convent Differential Revision: https://reviews.llvm.org/D38881 llvm-svn: 316232
* Add C++ support for testcasesJonathan Peyton2017-10-204-3/+13
| | | | | | | | Patch by Simon Convent Differential Revision: https://reviews.llvm.org/D38878 llvm-svn: 316230
* Apply formatting changesJonathan Peyton2017-10-2067-268/+42
| | | | | | | | | | .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
* KMP_HW_SUBSET vs KMP_PLACE_THREADS rival envirables fixJonathan Peyton2017-10-061-5/+22
| | | | | | | | | | | | | | If both KMP_HW_SUBSET and KMP_PLACE_THREADS are set and KMP_PLACE_THREADS gets parsed first, then the current environment variable parser rejects both and neither get used. This patch uses the rivals mechanism that is used for other environment variable groups (e.g., KMP_STACKSIZE, GOMP_STACKSIZE, OMP_STACKSIZE). If both are set, then it tells the user that it is ignoring KMP_PLACE_THREADS in favor of KMP_HW_SUBSET. The message about deprecating KMP_PLACE_THREADS when it is set is still printed regardless. Differential Revision: https://reviews.llvm.org/D38292 llvm-svn: 315091
* [test] Fix uninitialized memory in omp_taskloop_grainsize.cJonas Hahnfeld2017-09-291-1/+2
| | | | | | result was never initialized to zero which sometimes failed the test. llvm-svn: 314513
* Remove unnecessary semicolonsJonathan Peyton2017-09-2727-509/+498
| | | | | | | | 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
* Allow printing of KMP_TOPOLOGY_METHOD when KMP_SETTINGS=trueJonathan Peyton2017-09-261-2/+0
| | | | llvm-svn: 314243
* Remove unused t_single_lockJonathan Peyton2017-09-262-2/+1
| | | | | | Add padding inside team structure to keep same structure size. llvm-svn: 314242
* Read blocktime value set by kmp_set_blocktime() before reading from ↵Jonathan Peyton2017-09-052-5/+9
| | | | | | | | | | KMP_BLOCKTIME Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D37403 llvm-svn: 312539
* Minor code cleanup of Klocwork issuesJonathan Peyton2017-09-0514-149/+126
| | | | | | | | | | | 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
* Use va_copy instead of __va_copy to fix building libomp against musl libcJonathan Peyton2017-08-191-1/+1
| | | | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=34040 Patch by Peter Levine Differential Revision: https://reviews.llvm.org/D36343 llvm-svn: 311269
* Remove BUILD_TVJonathan Peyton2017-08-175-81/+0
| | | | | | | | | | Cleanup code to remove BUILD_TV and unused code bracketed by it. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D36011 llvm-svn: 311114
* OMP_PROC_BIND: better spreadPaul Osmialowski2017-08-101-42/+108
| | | | | | | | | This change improves the way threads are spread across cores when OMP_PROC_BIND=spread is set and no unusual affinity masks are in use. Differential Revision: https://reviews.llvm.org/D36510 llvm-svn: 310670
* Exclude version symbols for static libompJonathan Peyton2017-08-021-0/+5
| | | | | | | | | | | | We use symbol versioning for GNU-compatibility but libgomp has versioned symbols only in the shared library but not in the static. Moreover, version symbols in the static library can cause an error at link time. Patch by Olga Malysheva Differential Revision: https://reviews.llvm.org/D36225 llvm-svn: 309877
* Move lock acquire/release functions in task deque cleanup codeJonathan Peyton2017-08-021-3/+2
| | | | | | | | | | | | | The original locations can be reached without initializing the lock variable (td_deque_lock), so it is potentially unsafe. It is guaranteed that the lock is initialized if the deque (td_deque) is not NULL, and lock functions can be safely called. Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D36017 llvm-svn: 309875
* Add new envirable KMP_TEAMS_THREAD_LIMITJonathan Peyton2017-08-025-10/+30
| | | | | | | | | | | | | | | | | | | | This change adds a new environment variable, KMP_TEAMS_THREAD_LIMIT, which is used to set a new global variable, __kmp_teams_max_nth, which is checked when determining the size and quantity of teams that will be created in the teams construct. Specifically, it is a limit on the total number of threads in a given teams construct. It differentiates the limits for the teams construct from the limits for regular parallel regions (KMP_DEVICE_THREAD_LIMIT/__kmp_max_nth and OMP_THREAD_LIMIT/__kmp_cg_max_nth). When each individual team is formed, it is still subject to those limits. After the clauses to the teams construct are parsed and calculated, we check to make sure we are within this limit, and if not, reduce num_threads per team and/or number of teams, accordingly. The default value is set to the number of available processors on the system. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D36009 llvm-svn: 309874
* Fix comments and build messages concerning TSXJonathan Peyton2017-07-283-7/+10
| | | | llvm-svn: 309418
* Fix implementation of OMP_THREAD_LIMITJonathan Peyton2017-07-277-20/+153
| | | | | | | | | | | | | | | | | | This change fixes the implementation of OMP_THREAD_LIMIT. The implementation of this previously was not restricted to a contention group (but it should be, according to the spec), and this is fixed here. A field is added to root thread to store a counter of the threads in the contention group. An extra check is added when reserving threads for a parallel region that checks this variable and compares to threadlimit-var, which is implemented as a new global variable, kmp_cg_max_nth. Associated settings changes were also made, and clean up of comments that referred to OMP_THREAD_LIMIT, but should refer to the new KMP_DEVICE_THREAD_LIMIT (added in an earlier patch). Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D35912 llvm-svn: 309319
* Introduce KMP_DEVICE_THREAD_LIMITJonathan Peyton2017-07-262-29/+28
| | | | | | | | | | | | | | | | | | | | | | | | This change drops in KMP_DEVICE_THREAD_LIMIT to replace KMP_MAX_THREADS. It's possible there will eventually be a OMP_DEVICE_THREAD_LIMIT, and we need something to distinguish from OMP_THREAD_LIMIT, which is currently implemented incorrectly (the fix for that will be added soon in a separate patch). KMP_ALL_THREADS is deprecated here, but we can keep the "all" option on KMP_DEVICE_THREAD_LIMIT to support that functionality. KMP_DEVICE_THREAD_LIMIT now has priority over its deprecated rival KMP_ALL_THREADS. I also cleaned up some comments that incorrectly referred to non-existent kmp_max_threads variable instead of kmp_max_nth. I've left the name of where this setting eventually ends up as __kmp_max_nth, for now. This change does not change much in the way of functionality. It does NOT change OMP_THREAD_LIMIT. It's just cleaning up and setting up for that. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D35860 llvm-svn: 309168
* Cleanup: __kmp_env_* variablesJonathan Peyton2017-07-254-44/+35
| | | | | | | | | | Removed unused __kmp_env_* variables. Also clangified other people's code. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D35808 llvm-svn: 309000
* OpenMP RTL cleanup: two PAUSEs per spin loop iteration replaced with single oneAndrey Churbanov2017-07-192-6/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D35490 llvm-svn: 308423
* For KMP_PAGE_SIZE, use getpagesize() on Unix, GetSystemInfo() on WindowsDimitry Andric2017-07-181-8/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: The kmp_os.h header is defining the `PAGE_SIZE` macro unconditionally, even while it is only used directly after its definition, for the Windows implementation of the `KMP_GET_PAGE_SIZE()` macro. On at least FreeBSD, but likely all other BSDs too, this macro conflicts with the one defined in system headers, so remove it, since nothing else uses it. Make all Unixes use `getpagesize()` instead, and use `GetSystemInfo()` for the Windows case. Reviewers: jlpeyton, jcownie, emaste, AndreyChurbanov Reviewed By: AndreyChurbanov Subscribers: AndreyChurbanov, hfinkel, zturner Differential Revision: https://reviews.llvm.org/D35072 llvm-svn: 308355
* Fix failing taskloop tests by omitting gccJonathan Peyton2017-07-182-0/+4
| | | | | | We do not have GOMP interface support for taskloop yet. llvm-svn: 308351
* Add recursive task scheduling strategy to taskloop implementationJonathan Peyton2017-07-187-95/+482
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Taskloop implementation is extended by using recursive task scheduling. Envirable KMP_TASKLOOP_MIN_TASKS added as a manual threshold for the user to switch from recursive to linear tasks scheduling. Details: * The calculations for the loop parameters are moved from __kmp_taskloop_linear upper level * Initial calculation is done in the __kmpc_taskloop, further range splitting is done in the __kmp_taskloop_recur. * Added threshold to switch from recursive to linear tasks scheduling; * One half of split range is scheduled as an internal task which just moves sub-range parameters to the stealing thread that continues recursive scheduling (if number of tasks still enough), the other half is processed recursively; * Internal task duplication routine fixed to assign parent task, that was not needed when all tasks were scheduled by same thread, but is needed now. Patch by Andrey Churbanov Differential Revision: https://reviews.llvm.org/D35273 llvm-svn: 308338
* Fix sporadic segfaults in tasking tests.Andrey Churbanov2017-07-181-1/+1
| | | | | | | | Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D35535 llvm-svn: 308298
* OpenMP RTL cleanup: nullify pointer after memory freeingAndrey Churbanov2017-07-181-1/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D35497 llvm-svn: 308274
* Removed "duplicates" from verbose affinity outputJonathan Peyton2017-07-171-5/+0
| | | | | | | | The internal details of this setting are not meant to be user visible and only create confusion. Differential Revision: https://reviews.llvm.org/D35269 llvm-svn: 308189
* OpenMP RTL cleanup: eliminated warnings with -Wcast-qual, patch 2.Andrey Churbanov2017-07-1716-215/+244
| | | | | | | | | Changes are: got all atomics to accept volatile pointers that allowed to simplify many type conversions. Windows specific code fixed correspondingly. Differential Revision: https://reviews.llvm.org/D35417 llvm-svn: 308164
* [GOMP] Fix (un)tied tasks with the GCCJonas Hahnfeld2017-07-131-2/+2
| | | | | | | | | The first bit is actually the "untied" flag. That is why the condition was wrong and has to be inverted to set the flag correctly. Found and initial patch by Simon Convent! llvm-svn: 307899
* Rename z_Linux_asm.s to z_Linux_asm.SDimitry Andric2017-07-112-3/+3
| | | | | | | | | | | | | | | | | | | | | Summary: On Unix, a .S file is normally an assembly source which must be preprocessed with a C preprocessor, while a .s file is "plain" assembly. The former is handled by the compiler driver (cc), the latter is directly passed to the assembler binary (as). Because z_Linux_asm.s is supposed to be preprocessed, rename it to .S, so it can be automatically picked up correctly by build systems. Reviewers: AndreyChurbanov, emaste, jlpeyton Reviewed By: AndreyChurbanov Subscribers: mgorny, openmp-commits Differential Revision: https://reviews.llvm.org/D35171 llvm-svn: 307680
* remove deprecated register storage class specifierEd Maste2017-07-077-148/+148
| | | | | | | | | | 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
OpenPOWER on IntegriCloud