summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
Commit message (Collapse)AuthorAgeFilesLines
...
* [STATS] Fix stats lock problem to be compatible with new hinted lock codeJonathan Peyton2015-12-172-1/+4
| | | | llvm-svn: 255901
* Fix broken visual studio builds by disabling KMP_USE_TSX.Jonathan Peyton2015-12-141-1/+2
| | | | | | Visual studio can't handle the asm extension in the KMP_USE_TSX code sections. llvm-svn: 255514
* Hinted lock (OpenMP 4.5 feature) Updates/Fixes Part 3Jonathan Peyton2015-12-1116-357/+331
| | | | | | | | | | | | | | | | | | | | | | | | This change set includes all changes to make the code conform to the OMP 4.5 specification: * Removed hint / hinted_init definitions from include/40 files * Hint values are powers of 2 to enable composition (4.5 spec) * Hinted lock initialization functions were renamed (4.5 spec) kmp_init_lock_hinted -> omp_init_lock_with_hint kmp_init_nest_lock_hinted -> omp_init_nest_lock_with_hint * __kmpc_critical_section_with_hint was added to support a critical section with a hint (4.5 spec) * __kmp_map_hint_to_lock was added to convert a hint (possibly a composite) to an internal lock type * kmpc_init_lock_with_hint and kmpc_init_nest_lock_with_hint were added as internal entries for the hinted lock initializers. The preivous internal functions (__kmp_init*) were moved to kmp_csupport.c and reused in multiple places * Added the two init functions to dllexports * KMP_USE_DYNAMIC_LOCK is turned on if OMP_41_ENABLED is turned on Differential Revision: http://reviews.llvm.org/D15205 llvm-svn: 255376
* Hinted lock (OpenMP 4.5 feature) Updates/Fixes Part 2Jonathan Peyton2015-12-1113-222/+376
| | | | | | | | | | | | | | | | | | | * Added a new user TSX lock implementation, RTM, This implementation is a light-weight version of the adaptive lock implementation, omitting the back-off logic for deciding when to specualte (or not). The fall-back lock is still the queuing lock. * Changed indirect lock table management. The data for indirect lock management was encapsulated in the "kmp_indirect_lock_table_t" type. Also, the lock table dimension was changed to 2D (was linear), and each entry is a kmp_indirect_lock_t object now (was a pointer to an object). * Some clean up in the critical section code * Removed the limits of the tuning parameters read from KMP_ADAPTIVE_LOCK_PROPS * KMP_USE_DYNAMIC_LOCK=1 also turns on these two switches: KMP_USE_TSX, KMP_USE_ADAPTIVE_LOCKS Differential Revision: http://reviews.llvm.org/D15204 llvm-svn: 255375
* Hinted lock (OpenMP 4.5 feature) Updates/FixesJonathan Peyton2015-12-113-140/+159
| | | | | | | | | | | | | There are going to be two more patches which bring this feature up to date and in line with OpenMP 4.5. * Renamed jump tables for the lock functions (and some clean up). * Renamed some macros to be in KMP_ namespace. * Return type of unset functions changed from void to int. * Enabled use of _xebgin() et al. intrinsics for accessing TSX instructions. Differential Revision: http://reviews.llvm.org/D15199 llvm-svn: 255373
* Replace DYNA_* names with KMP_* namesJonathan Peyton2015-12-035-213/+213
| | | | llvm-svn: 254637
* Fix honoring of OMP_THREAD_LIMIT in the teams constructJonathan Peyton2015-11-301-7/+36
| | | | | | | | | | | | Fix for crash in the teams construct in case user sets OMP_THREAD_LIMIT to a number less than the number of processors. Now the number of threads will be silently reduced if the user didn't specify teams parameters or with a warning if the user specified teams parameters conflicting with OMP_THREAD_LIMIT. Differential Revision: http://reviews.llvm.org/D14732 llvm-svn: 254322
* Fix crash when __kmp_task_team_setup called for single threaded teamJonathan Peyton2015-11-301-20/+21
| | | | | | | | | | | The task_team pointer is dereferenced unconditionally which causes a SEGFAULT when it is NULL (e.g. for serialized parallel, that can happen for "teams" construct or for "target nowait"). The solution is to skip second task team setup for single thread team. Differential Revision: http://reviews.llvm.org/D14729 llvm-svn: 254321
* Adding Hwloc library option for affinity mechanismJonathan Peyton2015-11-3010-129/+702
| | | | | | | | | | | | | | | | | | | These changes allow libhwloc to be used as the topology discovery/affinity mechanism for libomp. It is supported on Unices. The code additions: * Canonicalize KMP_CPU_* interface macros so bitmask operations are implementation independent and work with both hwloc bitmaps and libomp bitmaps. So there are new KMP_CPU_ALLOC_* and KMP_CPU_ITERATE() macros and the like. These are all in kmp.h and appropriately placed. * Hwloc topology discovery code in kmp_affinity.cpp. This uses the hwloc interface to create a libomp address2os object which the rest of libomp knows how to handle already. * To build, use -DLIBOMP_USE_HWLOC=on and -DLIBOMP_HWLOC_INSTALL_DIR=/path/to/install/dir [default /usr/local]. If CMake can't find the library or hwloc.h, then it will tell you and exit. Differential Revision: http://reviews.llvm.org/D13991 llvm-svn: 254320
* Add newlines to debug TRACE messages in kmp_taskdeps.cppJonathan Peyton2015-11-161-2/+2
| | | | llvm-svn: 253265
* Add missing KMP_NESTED_HOT_TEAMS guardsJonathan Peyton2015-11-161-0/+6
| | | | llvm-svn: 253264
* Add debug trace message for hierarchical barrierJonathan Peyton2015-11-121-0/+2
| | | | | | Trace when thread is waiting at join phase for oncore children. llvm-svn: 252954
* Remove outdated commentJonathan Peyton2015-11-121-3/+0
| | | | llvm-svn: 252953
* Fix for ittnotify loop reportingJonathan Peyton2015-11-121-1/+3
| | | | | | | | Fix ittnotify loop metadata reporting for schedule(runtime) and chunked schedule set via OMP_SCHEDULE. The bug was that chunk=1 reported always. llvm-svn: 252952
* [OMPT] Add ompt_event_task_switch event into OMPT/OpenMPJonathan Peyton2015-11-115-13/+37
| | | | | | | | | | | | The patch adds support for ompt_event_task_switch into LLVM/OpenMP. Note that the patch has also updated the signature of ompt_event_task_switch to ompt_task_pair_callback_t (rather than the previous ompt_task_switch_callback_t). Patch by Harald Servat Differential Revision: http://reviews.llvm.org/D14566 llvm-svn: 252761
* [OMPT] Remove unnecessary header in ompt-general.cJonathan Peyton2015-11-111-1/+0
| | | | | | | | Patch by Harald Servat Differential Revision: http://reviews.llvm.org/D14565 llvm-svn: 252756
* Fixes to wait-loop codeJonathan Peyton2015-11-094-4/+10
| | | | | | | | | | | | | 1) Add get_ptr_type() method to all wait flag types. 2) Flag in sleep_loc may change type by the time the resume is called from __kmp_null_resume_wrapper. We use get_ptr_type to obtain the real type and compare it to the casted object received. If they don't match, we know the flag has changed (already resumed and replaced by another flag). If they match, it doesn't hurt to go ahead and resume it. Differential Revision: http://reviews.llvm.org/D14458 llvm-svn: 252487
* Fixes and improvements to tasking in barriersJonathan Peyton2015-11-092-2/+6
| | | | | | | | | | | | | | | 1) When the number of threads in a team increases, new threads need to have all their barrier struct fields initialized. We were missing the parent_bar and team fields. 2) For non-forkjoin barriers, we now do the __kmp_task_team_setup before the gather. The setup now sets up the task_team that all the threads will switch to after the barrier, but it needs to be done before other threads do the switch. 3) Remove an unneeded assignment of tt_found_tasks in task team free function. Differential Revision: http://reviews.llvm.org/D14456 llvm-svn: 252486
* Improvements to machine_hierarchy code for re-sizingJonathan Peyton2015-11-092-36/+40
| | | | | | | | | | | | | These changes include: 1) Machine hierarchy now uses the base_num_threads field to indicate the maximum number of threads the current hierarchy can handle without a resize. 2) In __kmp_get_hierarchy, we need to get depth after any potential resize is done. 3) Cleanup of hierarchy resize code to support 1 above. Differential Revision: http://reviews.llvm.org/D14455 llvm-svn: 252475
* [OMPT] Add OMPT events for the OpenMP taskwait construct.Jonathan Peyton2015-11-092-2/+27
| | | | llvm-svn: 252472
* Fix for zero chunk sizeJonathan Peyton2015-11-061-0/+3
| | | | | | | | Setting dynamic schedule with chunk size 0 via omp_set_schedule(dynamic,0) and then using "schedule (runtime)" causes infinite loop because for the chunked dynamic schedule we didn't correct zero chunk to the default (1). llvm-svn: 252338
* Improve OMPT initialization codeJonathan Peyton2015-11-053-10/+24
| | | | | | | | | | | | | | | | | Use of #ifdef OMPT_DEBUG was causing messages to be generated under normal operation when the OpenMP library was compiled with KMP_DEBUG enabled. Elsewhere, KMP_DEBUG evaluates assertions, but never produces messages during normal operation. To avoid this inconsistency, set OMPT_DEBUG using a cmake variable LIBOMP_OMPT_DEBUG. While I was editing the associated ompt-specific.h and ompt-general.c files, make the spacing and comments consistent. Patch by John Mellor-Crummey Differential Revision: http://reviews.llvm.org/D14355 llvm-svn: 252173
* Remove incorrect debug assert.Jonathan Peyton2015-11-041-1/+0
| | | | | | in __kmp_free_team(), the team's number of processors can be == 1. llvm-svn: 252086
* Remove some empty lines.Jonathan Peyton2015-11-045-21/+0
| | | | llvm-svn: 252084
* Refactor of task_team code.Jonathan Peyton2015-11-045-242/+131
| | | | | | | | | | This is a refactoring of the task_team code that more elegantly handles the two task_team case. Two task_teams per team are kept in use for the lifetime of the team. Thus no reference counting is needed. Differential Revision: http://reviews.llvm.org/D13993 llvm-svn: 252082
* [OMPT] Adding missing free() calls to ompt_tool_windows() function.Jonathan Peyton2015-10-301-0/+4
| | | | llvm-svn: 251719
* [OMPT] Windows Support for OMPTJonathan Peyton2015-10-294-7/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that the ompt_tool() function (which must be implemented by a performance tool) should be defined in the RTL as well to cover the case when the tool is not present in the address space of the process. This functionality is accomplished with weak symbols in Unices. Unfortunately, Windows does not support weak symbols. The solution in these changes is to grab the list of all modules loaded by the process and then search for symbol "ompt_tool()" within them. The function ompt_tool_windows() performs the search of the ompt_tool symbol. If ompt_tool is found, then its return value is used to initialize the tool. If ompt_tool is not found, then ompt_tool_windows() returns NULL and OMPT is thus, disabled. While doing these changes, the OMPT_SUPPORT detection in CMake was changed to test for the required featuers for OMPT_SUPPORT, namely: builtin_frame_address() existence, weak attribute existence and psapi.dll existence. For LIBOMP_HAVE_OMPT_SUPPORT to be true, it must be that the builtin_frame_address() intrinsic exists AND one of: either weak attributes exist or psapi.dll exists. Also, since Process Status API is used I had to add new dependency -- psapi.dll to the library dependency micro test. Differential Revision: http://reviews.llvm.org/D14027 llvm-svn: 251654
* Removed zeroing th.th_task_state for master thread at start of nested parallel.Jonathan Peyton2015-10-201-9/+7
| | | | | | | | | | | The th.th_task_state for the master thread at the start of a nested parallel should not be zeroed in __kmp_allocate_team() because it is later put in the stack of states in __kmp_fork_call() for further re-use after exiting the nested region. It is zeroed after being put in the stack. Differential Revision: http://reviews.llvm.org/D13702 llvm-svn: 250847
* Removed '@' from delimiters, added it as offset designator.Jonathan Peyton2015-10-202-24/+77
| | | | | | | | | | | | Moved '@' from delimiters to offset designators for the KMP_PLACE_THREADS environment variable. Only one of: postfix "o" or prefix @, should be used in the value of KMP_PLACE_THREADS. For example, '2s@2,4c@2,1t'. This is also the format of KMP_SETTINGS=1 output now (removed "o" from there). e.g., 2s,2o,4c,2o,1t. Differential Revision: http://reviews.llvm.org/D13701 llvm-svn: 250846
* Fix OMP_PLACES negation operator parsing (!place)Jonathan Peyton2015-10-191-1/+1
| | | | | | | Just moved the *scan++ line up before the recursive call. Otherwise, infinite recursion occurs and leads to a segmentation fault. llvm-svn: 250729
* Clean-up cancellation state flag between parallel regionsJonathan Peyton2015-10-191-0/+4
| | | | | | | | Without this fix, cancellation requests in one parallel region cause cancellation of the second region even though the second one was not intended to be cancelled. llvm-svn: 250727
* On FreeBSD, PTHREADS_THREADS_MAX does not fit into an int, leading toDimitry Andric2015-10-191-2/+2
| | | | | | | | | | | | | | | | | | | | warnings similar to the following: runtime/src/kmp_global.c:117:35: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551615 to -1 [-Wconstant-conversion] int __kmp_sys_max_nth = KMP_MAX_NTH; ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~ runtime/src/kmp.h:849:34: note: expanded from macro 'KMP_MAX_NTH' # define KMP_MAX_NTH PTHREAD_THREADS_MAX ^~~~~~~~~~~~~~~~~~~ Clamp KMP_MAX_NTH to INT_MAX to avoid these warnings. Also use INT_MAX whenever PTHREAD_THREADS_MAX is not defined at all. Differential Revision: http://reviews.llvm.org/D13827 llvm-svn: 250708
* [OMPT] Add OMPT events for API lockingJonathan Peyton2015-10-164-73/+142
| | | | | | | | | | | | | | | | | | | | | This fix implements the following OMPT events for the API locking routines: * ompt_event_acquired_lock * ompt_event_acquired_nest_lock_first * ompt_event_acquired_nest_lock_next * ompt_event_init_lock * ompt_event_init_nest_lock * ompt_event_destroy_lock * ompt_event_destroy_nest_lock For the acquired events the depths of the locks ist required, so a return value was added similiar to the return values we already have for the release lock routines. Patch by Tim Cramer Differential Revision: http://reviews.llvm.org/D13689 llvm-svn: 250526
* Detect final task in GOMP interface.Jonathan Peyton2015-10-131-0/+4
| | | | llvm-svn: 250198
* [OMPT] Reduce overhead of OMPTJonathan Peyton2015-10-093-6/+14
| | | | | | | | | | | * Avoid computing state needed only by OMPT unless the ompt_enabled flag is set. * Properly handle a corner case in OMPT where team == NULL. Patch by John Mellor-Crummey Differential Revision: http://reviews.llvm.org/D13502 llvm-svn: 249857
* [OMPT] Initialize task fields only if neededJonathan Peyton2015-10-092-20/+12
| | | | | | | | | | | | | | Because __kmp_task_init_ompt is called for every initial task in each thread and always generated task ids, this was a big performance issue on bigger systems even without any tool attached. After changing the initialization interface to ompt_tool, we can now rely on already knowing whether a tool is attached and OMPT is enabled at this point. Patch by Jonas Hahnfeld Differential Revision: http://reviews.llvm.org/D13494 llvm-svn: 249855
* Formatting/Whitespace/Comment changes associated with wait/release improvements.Jonathan Peyton2015-10-086-39/+36
| | | | llvm-svn: 249725
* Debug trace and assert statement changes for wait/release improvements.Jonathan Peyton2015-10-084-26/+28
| | | | | | | These changes improve/update the trace messages and debug asserts related to the previous wait/release checkin. llvm-svn: 249717
* OpenMP Wait/release improvements.Jonathan Peyton2015-10-085-41/+51
| | | | | | | | | | These changes improve the wait/release mechanism for threads spinning in barriers that are handling tasks while spinnin by providing feedback to the barriers about any task stealing that occurs. Differential Revision: http://reviews.llvm.org/D13353 llvm-svn: 249711
* Added sockets to the syntax of KMP_PLACE_THREADS environment variable.Jonathan Peyton2015-10-086-104/+221
| | | | | | | | | | | | | | | | | | | Added (optional) sockets to the syntax of the KMP_PLACE_THREADS environment variable. Some limitations: * The number of sockets and then optional offset should be specified first (before other parameters). * The letter designation is mandatory for sockets and then for other parameters. * If number of cores is specified first, then the number of sockets is defaulted to all sockets on the machine; also, the old syntax is partially supported if sockets are skipped. * If number of threads per core is specified first, then the number of sockets and cores per socket are defaulted to all sockets and all cores per socket respectively. * The number of cores per socket cannot be specified before sockets or after threads per core. * The number of threads per core can be specified before or after core-offset (old syntax required it to be before core-offset); * Parameters delimiter can be: empty, comma, lower-case x; * Spaces are allowed around numbers, around letters, around delimiter. Approximate shorthand specification: KMP_PLACE_THREADS="[num_sockets(S|s)[[delim]offset(O|o)][delim]][num_cores_per_socket(C|c)[[delim]offset(O|o)][delim]][num_threads_per_core(T|t)]" Differential Revision: http://reviews.llvm.org/D13175 llvm-svn: 249708
* Fix memory corruption in Windows debug libraryJonathan Peyton2015-09-252-6/+6
| | | | | | | | This patch adjusts the buffer size when reducing the buffer used for printing. This solves the memory corruption in Windows debug library, and potential memory corruption in other builds. llvm-svn: 248588
* [OpenMP Testsuite] Mac rpath specified when compiling testsJonathan Peyton2015-09-241-2/+0
| | | | llvm-svn: 248500
* Fix stats build problem.Jonathan Peyton2015-09-242-4/+1
| | | | | | | | This change removes the KMP_STATS_ENABLED macro inside kmp_stats.cpp since it is only compiled anyways when LIBOMP_STATS=on. Also, include kmp_config.h in kmp_stats.h to ensure KMP_STATS_ENABLED is defined. llvm-svn: 248494
* OpenMP Initial testsuite change to purely llvm-lit based testingJonathan Peyton2015-09-211-0/+20
| | | | | | | | | | | | | | | This change introduces a check-libomp target which is based upon llvm's lit test infrastructure. Each test (generated from the University of Houston's OpenMP testsuite) is compiled and then run. For each test, an exit status of 0 indicates success and non-zero indicates failure. This way, FileCheck is not needed. I've added a bit of logic to generate symlinks (libiomp5 and libgomp) in the build tree so that gcc can be tested as well. When building out-of- tree builds, the user will have to provide llvm-lit either by specifying -DLIBOMP_LLVM_LIT_EXECUTABLE or having llvm-lit in their PATH. Differential Revision: http://reviews.llvm.org/D11821 llvm-svn: 248211
* Use sysconf for the number of cores on FreeBSD too.Joerg Sonnenberger2015-09-211-13/+2
| | | | llvm-svn: 248209
* Add basic NetBSD support.Joerg Sonnenberger2015-09-216-15/+25
| | | | llvm-svn: 248204
* Assume that all Unix-like systems will want to handle signals andJoerg Sonnenberger2015-09-211-1/+1
| | | | | | simplify conditional. llvm-svn: 248199
* Darwin is the exception when it comes to accessing environ, all otherJoerg Sonnenberger2015-09-211-4/+2
| | | | | | Unix-like systems can follow the same code path. llvm-svn: 248198
* [OMPT] Simplify control variable logic for OMPTJonathan Peyton2015-09-2112-157/+122
| | | | | | | | | | | | | | | Prior to this change, OMPT had a status flag ompt_status, which could take several values. This was due to an earlier OMPT design that had several levels of enablement (ready, disabled, tracking state, tracking callbacks). The current OMPT design has OMPT support either on or off. This revision replaces ompt_status with a boolean flag ompt_enabled, which simplifies the runtime logic for OMPT. Patch by John Mellor-Crummey Differential Revision: http://reviews.llvm.org/D12999 llvm-svn: 248189
* [OMPT] Overhaul OMPT initialization interfaceJonathan Peyton2015-09-219-158/+195
| | | | | | | | | | | | | | | | | | | | | | | | The OMPT specification has changed. This revision brings the LLVM OpenMP implementation up to date. Technical overview of changes: Previously, a public weak symbol ompt_initialize was called after the OpenMP runtime is initialized. The new interface calls a global weak symbol ompt_tool prior to initialization. If a tool is present, ompt_tool returns a pointer to a function that matches the signature for ompt_initialize. After OpenMP is initialized the function pointer is called to initialize a tool. Knowing that OMPT will be enabled before initialization allows OMPT support to be initialized as part of initialization instead of back patching initialization of OMPT support after the fact. Post OpenMP initialization support has been generalized moves from ompt-specific.c into ompt-general.c, since the OMPT initialization logic is no longer implementation specific. Patch by John Mellor-Crummey Differential Revision: http://reviews.llvm.org/D12998 llvm-svn: 248187
OpenPOWER on IntegriCloud