summaryrefslogtreecommitdiffstats
path: root/openmp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Tests] [OpenMP] XFAIL also for ppc64le.Stefan Pintilie2018-12-182-2/+2
| | | | | | | Two tests were XFAILed for powerpc64le in r349512. They should have also been XFAILed for ppc64le. llvm-svn: 349521
* XFAIL Pair of OpenMP Tests for PowerPC LE LinuxStefan Pintilie2018-12-184-1/+3
| | | | | | | | | | | | | | | XFAIL two tests that fail on PowerPC LE Linux due to the change of default from PIC to no-PIC on that platform. A Bug has been opened for this: https://bugs.llvm.org/show_bug.cgi?id=40082 The tests are: runtime/test/ompt/misc/control_tool.c runtime/test/ompt/synchronization/taskwait.c llvm-svn: 349512
* [Tests] fix non-determinism failure in testcaseJoachim Protze2018-12-181-0/+1
| | | | llvm-svn: 349460
* [OMPT] First chunk of final OMPT 5.0 interface updatesJoachim Protze2018-12-1825-382/+392
| | | | | | | | | | | | | This patch updates the implementation of the ompt_frame_t, ompt_wait_id_t and ompt_state_t. The final version of the OpenMP 5.0 spec added the "t" for these types. Furthermore the structure for ompt_frame_t changed and allows to specify that the reenter frame belongs to the runtime. Patch partially prepared by Simon Convent Reviewers: hbae llvm-svn: 349458
* [OMPT] Add testcase for thread_num provided by implicit task eventsJoachim Protze2018-12-181-0/+61
| | | | llvm-svn: 349457
* [OpenMP] version the affinity format tests and fix one testJonathan Peyton2018-12-172-1/+15
| | | | llvm-svn: 349412
* [OpenMP] Add affinity format testsJonathan Peyton2018-12-1715-0/+940
| | | | llvm-svn: 349411
* [OpenMP] Fixes for LIBOMP_OMP_VERSION=45/40Roman Lebedev2018-12-1520-9/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I have discovered this because i wanted to experiment with building static libomp (with openmp-4.0 support only) for debugging purposes. There are three kinds of problems here: 1. `__kmp_compare_and_store_acq()` simply does not exist. It was added in D47903 by @jlpeyton. I'm guessing `__kmp_atomic_compare_store_acq()` was meant. 2. In `__kmp_is_ticket_lock_initialized()`, `lck->lk.initialized` is `std::atomic<bool>`, while `lck` is `kmp_ticket_lock_t *`. Naturally, they can't be equality-compared. Either, it should return the value read from `lck->lk.initialized`, or do what `__kmp_is_queuing_lock_initialized()` does, compare the passed pointer with the field in the struct pointed by the pointer. I think the latter is correct-er choice here. 3. Tests were not versioned. They assume that `LIBOMP_OMP_VERSION` is at the latest version. This does not touch LIBOMP_OMP_VERSION=30. That is still broken. Reviewers: jlpeyton, Hahnfeld, AndreyChurbanov Reviewed By: AndreyChurbanov Subscribers: guansong, jfb, openmp-commits, jlpeyton Tags: #openmp Differential Revision: https://reviews.llvm.org/D55496 llvm-svn: 349260
* [OpenMP] Fix transient divide by zero bug in 32-bit codeJonathan Peyton2018-12-131-4/+11
| | | | | | | | | | | | | | | | The value returned by __kmp_now_nsec() can overflow 32-bit values causing incorrect values to be returned. The overflow can end up causing a divide by zero error because in __kmp_initialize_system_tick(), the value (__kmp_now_nsec() - nsec) can end up being much larger than the numerator: 1e6 * (delay + (now - goal)) during a pathological timing where the current time calculated is much larger than nsec. When this happens, the value of __kmp_ticks_per_msec is set to zero which is then used as the denominator in the KMP_NOW_MSEC() macro leading to the divide by zero error. Differential Revision: https://reviews.llvm.org/D55300 llvm-svn: 349090
* [OpenMP] Implement OpenMP 5.0 affinity format functionalityJonathan Peyton2018-12-1323-129/+1024
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the affinity format functionality introduced in OpenMP 5.0. This patch adds: Two new environment variables: OMP_DISPLAY_AFFINITY=TRUE|FALSE OMP_AFFINITY_FORMAT=<string> and Four new API: 1) omp_set_affinity_format() 2) omp_get_affinity_format() 3) omp_display_affinity() 4) omp_capture_affinity() The affinity format functionality has two ICV's associated with it: affinity-display-var (bool) and affinity-format-var (string). The affinity-display-var enables/disables the functionality through the envirable OMP_DISPLAY_AFFINITY. The affinity-format-var is a formatted string with the special field types beginning with a '%' character similar to printf For example, the affinity-format-var could be: "OMP: host:%H pid:%P OStid:%i num_threads:%N thread_num:%n affinity:{%A}" The affinity-format-var is displayed by every thread implicitly at the beginning of a parallel region when any thread's affinity has changed (including a brand new thread being spawned), or explicitly using the omp_display_affinity() API. The omp_capture_affinity() function can capture the affinity-format-var in a char buffer. And omp_set|get_affinity_format() allow the user to set|get the affinity-format-var explicitly at runtime. omp_capture_affinity() and omp_get_affinity_format() both return the number of characters needed to hold the entire string it tried to make (not including NULL character). If not enough buffer space is available, both these functions truncate their output. Differential Revision: https://reviews.llvm.org/D55148 llvm-svn: 349089
* Fix for bugzilla https://bugs.llvm.org/show_bug.cgi?id=39970Andrey Churbanov2018-12-1310-4/+27
| | | | | | | | Broken tests fixed Differential Revision: https://reviews.llvm.org/D55598 llvm-svn: 349017
* [runtime] Disable KMP_HAVE_QUAD on NetBSD gccMichal Gorny2018-12-111-0/+3
| | | | | | | | | | | | | | | Disable KMP_HAVE_QUAD when building via gcc on NetBSD system, as the build fails due to unimplemented builtins: .../kmp_atomic.cpp.o: In function `__kmpc_atomic_cmplx16_mul': .../kmp_atomic.cpp:1332: undefined reference to `__multc3' .../kmp_atomic.cpp.o: In function `__kmpc_atomic_cmplx16_div': .../kmp_atomic.cpp:1334: undefined reference to `__divtc3' ... Differential Revision: https://reviews.llvm.org/D55478 llvm-svn: 348886
* [runtime] Use getloadavg() on NetBSD as wellMichal Gorny2018-12-111-1/+1
| | | | | | | | | | Switch NetBSD from reading /proc (which is broken) to getloadavg() (which is already used by Darwin). NetBSD discourages using procfs in favor of system API calls. Differential Revision: https://reviews.llvm.org/D55486 llvm-svn: 348885
* Implement __kmp_is_address_mapped() for NetBSDKamil Rytarowski2018-12-111-2/+35
| | | | | | | | | | | | | | | | | | Summary: Use the sysctl(3) function to check whether an address is mapped into the address space. Reviewers: mgorny, joerg, #openmp Reviewed By: mgorny Subscribers: openmp-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D55549 llvm-svn: 348874
* Implement __kmp_gettid() for NetBSDKamil Rytarowski2018-12-111-0/+3
| | | | | | | | | | | | | | | | Summary: _lwp_self() returns current Thread Id in a numeric version on NetBSD. Reviewers: joerg, mgorny, #openmp Reviewed By: mgorny Subscribers: llvm-commits, openmp-commits, #openmp Tags: #openmp Differential Revision: https://reviews.llvm.org/D55497 llvm-svn: 348873
* [test] [runtime] Permit omp_get_wtick() to return 0.01Michal Gorny2018-12-111-1/+1
| | | | | | | | | | | | | Increase the range for omp_get_wtick() test to allow for 0.01 (from <0.01). This is needed for NetBSD where it returns exactly that value due to CLOCKS_PER_SEC being 100. This should not cause a significant difference from e.g. FreeBSD where it is 128, and especially from Linux where CLOCKS_PER_SEC is apparently meaningless and sysconf(_SC_CLK_TCK) gives 100 as well. Differential Revision: https://reviews.llvm.org/D55493 llvm-svn: 348857
* [test] [runtime] Do not include alloca.h on NetBSDMichal Gorny2018-12-111-0/+4
| | | | | | | | | On NetBSD, alloca() is in stdlib.h and there is no alloca.h. Adjust the includes appopriately. Differential Revision: https://reviews.llvm.org/D55487 llvm-svn: 348856
* [runtime] [test] Use more portable short options to sort(1)Michal Gorny2018-12-111-1/+1
| | | | | | | | | | | | Pass `-n -s` instead of `--numeric --stable` to sort(1), as long options are not supported by NetBSD sort implementation. `-n` is defined by POSIX, so it should be fully portable. `-s` is used consistently at least in GNU sort and FreeBSD sort, and I honestly doubt it would cause issues with any other implementation supporting `--stable`. Differential Revision: https://reviews.llvm.org/D55479 llvm-svn: 348855
* [cmake] Use -std=gnu++11 to fix alloca() on NetBSDMichal Gorny2018-12-112-2/+6
| | | | | | | | | | Prefer using '-std=gnu++11' over '-std=c++11' when available, as NetBSD exposes the correct alloca() implementation only with gnu* C/C++ standards. Differential Revision: https://reviews.llvm.org/D55477 llvm-svn: 348854
* [OpenMP] Fix a few build issuesJonathan Peyton2018-12-102-3/+4
| | | | | | | | | | | | | | | | | | | | | Fix two build issues: 1) Recent commit 348756 accidentally included Unix clang compilers to use immintrin.h when only clang-cl should be using it leading to the following error: openmp-llvm/runtime/src/kmp_lock.cpp:2035:25: error: always_ inline function '_xbegin' requires target feature 'rtm', but would be inlined into function '__kmp_test_adaptive_lock_only' that is compiled without support for 'rtm' kmp_uint32 status = _xbegin(); This patch changes the guard to use immintrin.h to only use clang-cl instead of all clang 2) gcc-8 gives a warning about multiline comment in kmp_runtime.cpp: This patch just changes it to a two line comment openmp-llvm/runtime/src/kmp_runtime.cpp:7697:8: warning: multi-line comment [-Wcomment] #endif // KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD \ llvm-svn: 348783
* [OPENMP][NVPTX]Revert __kmpc_shuffle_int64 to its original form.Alexey Bataev2018-12-101-5/+0
| | | | | | | | | | | | | | Summary: Use the original shuffle implementation for __kmpc_shuffle_int64 since default implementation uses the same implementation. Reviewers: gtbercea Subscribers: guansong, caomhin, openmp-commits Differential Revision: https://reviews.llvm.org/D55514 llvm-svn: 348772
* [OPENMP][NVPTX]Enable fast shuffles on 64bit values only if CUDA >= 9.Alexey Bataev2018-12-101-1/+11
| | | | | | | | | | | | | | Summary: Shuffle on 64bit data is allowed only for CUDA >= 9.0. Also, fixed the constant for the mask, need one extra L in the end. Reviewers: gtbercea, kkwli0 Subscribers: guansong, caomhin, openmp-commits Differential Revision: https://reviews.llvm.org/D55440 llvm-svn: 348758
* Support clang compiling under windows-gnu and windows-msvcAndrey Churbanov2018-12-1018-33/+69
| | | | | | | | Patch by Peiyuan Song <squallatf@gmail.com> Differential Revision: https://reviews.llvm.org/D53422 llvm-svn: 348756
* Add OpenBSD support to OpenMPKamil Rytarowski2018-12-095-11/+22
| | | | | | | | | | | | | | | | Summary: This patch permits OpenMP to build and work (with both gcc and clang) on OpenBSD. It mostly follows what was done for FreeBSD and NetBSD, except OpenBSD does not have pthread_getattr_np support, so it follows OS X in that one instance. Reviewers: #openmp, krytarowski Reviewed By: krytarowski Subscribers: guansong, jfb, emaste, mgorny, krytarowski, #openmp Tags: #openmp Differential Revision: https://reviews.llvm.org/D34280 llvm-svn: 348726
* Add DragonFlyBSD support to OpenMPKamil Rytarowski2018-12-098-19/+43
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Additions mostly follow FreeBSD and NetBSD and are not intrusive. There is similar patch for OpenBSD: https://reviews.llvm.org/D34280 The -lm was being omitted due to -Wl,--as-needed in cmake rule, similar patch is in freebsd-ports/devel/llvm-devel port. Simple OpenMP programs compile and work as expected: $ clang-devel ~/omp_hello.c -fopenmp -I/usr/local/llvm-devel/include $ LD_LIBRARY_PATH=/usr/local/llvm-devel/lib OMP_NUM_THREADS=100 ./a.out The assertion in LLVMgold.so when -fopenmp was used together with -flto in 20170524 snapshot is no longer triggered on current svn-trunk and works fine as in llvm-4.0 with our local patches. Reviewers: #openmp, krytarowski Reviewed By: krytarowski Subscribers: dexonsmith, jfb, krytarowski, guansong, gregrodgers, emaste, mgorny, mehdi_amini Differential Revision: https://reviews.llvm.org/D35129 llvm-svn: 348725
* [OPENMP][NVPTX]Save registers for optimized builds with enabled logging.Alexey Bataev2018-12-071-18/+14
| | | | | | | | | | | | | | | | | Summary: Introduced special noinline function log that allows to save some registers for optimized builds but with enabled logging. Also, it increases the stability of the optimized builds with inlined runtime. Reviewers: gtbercea, kkwli0 Reviewed By: gtbercea Subscribers: caomhin, guansong, openmp-commits Differential Revision: https://reviews.llvm.org/D55436 llvm-svn: 348606
* [OPENMP][NVPTX]Correct type casting for printf args + simplified shfl64 ↵Alexey Bataev2018-12-0611-108/+140
| | | | | | | | | | | | | | | | function. Summary: Explicitly casted printf's args to the required types + simplified shfl64 function. Reviewers: gtbercea, kkwli0 Subscribers: guansong, jfb, caomhin, openmp-commits Differential Revision: https://reviews.llvm.org/D55379 llvm-svn: 348521
* [OPENMP][NVPTX]Fix __kmpc_flush to flush the memory per system, not per block.Alexey Bataev2018-12-061-1/+1
| | | | | | | | | | | | | | | Summary: According to the standard, after memory flushing the changes in the memory must be visible to all the threads in all teams. Patch fixes this. Reviewers: gtbercea, kkwli0 Subscribers: guansong, jfb, caomhin, openmp-commits Differential Revision: https://reviews.llvm.org/D55370 llvm-svn: 348491
* [OpenMP][libomptarget] Flush intermediate values during team reduction Gheorghe-Teodor Bercea2018-12-031-0/+1
| | | | | | | | | | | | | | Summary: Ensure intermediate values of a team reduction are flushed to memory. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: guansong, jfb, openmp-commits Differential Revision: https://reviews.llvm.org/D55219 llvm-svn: 348148
* [OPENMP][NVPTX]Make runtime compatible with the original runtime.Alexey Bataev2018-11-305-159/+87
| | | | | | | | | | | | | | | Summary: Reworked runtime to make it compatible with the requirements of the original runtime library. Also, simplified some code to reduce number of function calls. Reviewers: gtbercea, kkwli0 Subscribers: guansong, jfb, caomhin, openmp-commits Differential Revision: https://reviews.llvm.org/D55130 llvm-svn: 348003
* Revert r347799: Add omp_get_device_num() and update other device APIJonathan Peyton2018-11-2911-98/+47
| | | | | | | There is a conflict between libomptarget and libomp concerning some of the standard OpenMP device API which needs further intestigation. llvm-svn: 347932
* [OpenMP] Add stubs for Task affinity APIJonathan Peyton2018-11-293-0/+38
| | | | | | | | | | | | | This patch adds __kmpc_omp_reg_task_with_affinity to register affinity information for tasks. For now, the affinity information is not used, and the function always succeeds. This also adds the kmp_task_affinity_info_t structure to store the task affinity information. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D55026 llvm-svn: 347907
* [OpenMP] Rename ompt_mutex_impl_unknown to ompt_mutex_impl_noneJonathan Peyton2018-11-284-6/+6
| | | | | | | | | | | This change renames ompt_mutex_impl_unknown to ompt_mutex_impl_none, following the name change in the specification. Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D54347 llvm-svn: 347802
* [OpenMP] Minor cleanup of debug codeJonathan Peyton2018-11-281-2/+2
| | | | | | | | | | | * Fix calculation of string length. * Remove NULL-check of pointer which has been dereferenced. Patch by Andrey Churbanov Differential Revision: https://reviews.llvm.org/D54948 llvm-svn: 347801
* [OpenMP] Fixed possible array out of bound accessJonathan Peyton2018-11-281-0/+1
| | | | | | | | | | | | | There is low probability that array th_hot_teams can be accessed out of bound (when many nested levels are requested to keep hot teams via KMP_HOT_TEAMS_MAX_LEVEL). The patch adds the check of index that fixes the problem. Patch by Andrey Churbanov Differential Revision: https://reviews.llvm.org/D54950 llvm-svn: 347800
* [OpenMP] Add omp_get_device_num() and update several other device API functionsJonathan Peyton2018-11-2811-47/+98
| | | | | | | | | | | | | Add omp_get_device_num() function for 5.0 which returns the number of the device the current thread is running on. Also, did some cleanup and updating of device API functions to make them into weak functions that should be replaced with libomptarget functions when libomptarget is present. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D54342 llvm-svn: 347799
* [OpenMP][libomptarget] Add new version of SPMD deinit kernel function with ↵Gheorghe-Teodor Bercea2018-11-272-3/+8
| | | | | | | | | | | | | | | | argument Summary: To enable the compiler to optimize parts of the function that are not needed when runtime can be omitted, a new version of the SPMD deinit kernel function is needed. This function takes the runtime required flag as an argument. Reviewers: ABataev, kkwli0, caomhin Reviewed By: ABataev Subscribers: guansong, openmp-commits Differential Revision: https://reviews.llvm.org/D54969 llvm-svn: 347714
* [OPENMP][NVPTX]Basic support for reductions across the teams.Alexey Bataev2018-11-272-0/+24
| | | | | | | | | | | | | | | Summary: Added functions __kmpc_nvptx_teams_reduce_nowait_simple and __kmpc_nvptx_teams_end_reduce_nowait_simple to implement basic support for reductions across the teams. Reviewers: gtbercea, kkwli0 Subscribers: guansong, jfb, caomhin, openmp-commits Differential Revision: https://reviews.llvm.org/D54967 llvm-svn: 347710
* [OpenMP][libomptarget] Refactor SPMD and runtime requirement checkingGheorghe-Teodor Bercea2018-11-279-171/+262
| | | | | | | | | | | | | | Summary: Refactor the checking for SPMD mode and whether the runtime is initialized or not. This uses constant flags which enables the runtime to optimize out unused sections of code that depend on these flags. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: guansong, jfb, openmp-commits Differential Revision: https://reviews.llvm.org/D54960 llvm-svn: 347698
* [OPENMP][NVPTX]Improved lock/critical constructs.Alexey Bataev2018-11-203-24/+11
| | | | | | | | | | | | Summary: Improved support for critical constructs + omp_..._lock... constructs. Reviewers: gtbercea, kkwli0, caomhin Subscribers: guansong, jfb, openmp-commits Differential Revision: https://reviews.llvm.org/D54766 llvm-svn: 347342
* Fix for bugzilla https://bugs.llvm.org/show_bug.cgi?id=39137.Andrey Churbanov2018-11-141-0/+2
| | | | | | | | Do not write to internal structure if it keeps same value. Differential Revision: https://reviews.llvm.org/D54305 llvm-svn: 346862
* [OPENMP]Make lambda mapping follow reqs for PTR_AND_OBJ mapping.Alexey Bataev2018-11-081-5/+6
| | | | | | | | | | | | | | | Summary: The base pointer for the lambda mapping must point to the lambda capture placement and pointer must point to the captured variable itself. Patch fixes this problem. Reviewers: gtbercea Subscribers: guansong, openmp-commits, kkwli0, caomhin Differential Revision: https://reviews.llvm.org/D54260 llvm-svn: 346407
* Add Hurd support.Andrey Churbanov2018-11-076-11/+24
| | | | | | | | Patch by samuel.thibault@ens-lyon.org Differential Revision: https://reviews.llvm.org/D54079 llvm-svn: 346310
* Implementation of OpenMP 5.0 mutexinoutset task dependency type.Andrey Churbanov2018-11-076-199/+682
| | | | | | Differential Revision: https://reviews.llvm.org/D53380 llvm-svn: 346307
* [OPENMP][OFFLOADING]Change the lambda capturing flags.Alexey Bataev2018-11-021-1/+1
| | | | | | | | | | | | | | | Summary: The previously used combination `PTR_AND_OBJ | PRIVATE` could be used for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ | LITERAL`. Reviewers: gtbercea Subscribers: guansong, caomhin, openmp-commits Differential Revision: https://reviews.llvm.org/D54035 llvm-svn: 345981
* [OPENMP][NVPTX]Fixed/improved support for globalization in team contexts.Alexey Bataev2018-11-026-71/+102
| | | | | | | | | | | | | | | | | | | Summary: Current globalization scheme works correctly only for SPMD+lightweight runtime mode and does not work for full runtime. Patch improves support for the globalization scheme + reduces global memory consumption in lightweight runtime mode. Patch adds runtime functions to work with the statically allocated global memory. It allows to improve performance and memory consumption. This global memory must be allocated by the compiler. Reviewers: grokos, kkwli0, gtbercea, caomhin Subscribers: guansong, jfb, openmp-commits Differential Revision: https://reviews.llvm.org/D53943 llvm-svn: 345976
* [OpenMP][libomptarget] Add runtime function for pushing coalesced global recordsGheorghe-Teodor Bercea2018-11-015-35/+45
| | | | | | | | | | | | | | Summary: In the case of coalesced global records, we need to push the exact data size passed in. This patch fixes this by outlining the common functionality of the previous push function and by adding a separate entry point for coalesced pushes. The pop function remains unchanged. Reviewers: ABataev, grokos, caomhin Reviewed By: ABataev, grokos Subscribers: jholewinski, cfe-commits, Hahnfeld, guansong, jfb, openmp-commits Differential Revision: https://reviews.llvm.org/D53141 llvm-svn: 345867
* [LIBOMPTARGET] Add support for mapping of lambda captures.Alexey Bataev2018-10-301-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Added support for correct mapping of variables captured by reference in lambdas. That kind of mapping may appear only in target-executable regions and must follow the original lambda or another lambda capture for the same lambda. The expected data: base address - the address of the lambda, begin pointer - pointer to the address of the lambda capture, size - size of the captured variable. When OMP_TGT_MAPTYPE_PTR_AND_OBJ mapping type is seen in target-executable region, the target address of the last processed item is taken as the address of the original lambda `tgt_lambda_ptr`. Then, the pointer to capture on the device is calculated like `tgt_lambda_ptr + (host_begin_pointer - host_begin_base)` and the target-based address of the original variable (which host address is `*(void**)begin_pointer`) is written to that pointer. Reviewers: kkwli0, gtbercea, grokos Subscribers: openmp-commits Differential Revision: https://reviews.llvm.org/D51107 llvm-svn: 345608
* remove duplicate omp_control_tool export to fix windows buildAndrey Churbanov2018-10-251-3/+0
| | | | | | | | Patch by squallatf@gmail.com Differential Revision: https://reviews.llvm.org/D53480 llvm-svn: 345255
* [OpenMP] Convert KMP_DYNAMIC_LIB to a 0 or 1 guard everywhereJonathan Peyton2018-10-054-7/+7
| | | | llvm-svn: 343869
OpenPOWER on IntegriCloud