aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:52:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:52:04 +0000
commit1756886afc900127720de68088f9adff3108ef61 (patch)
treed4c46dc43cbf2f632d3c575a6d01716370a7b45b
parent4254a3821b2072ba01f8f7e3347ac862d324babc (diff)
downloadsrc-1756886afc900127720de68088f9adff3108ef61.tar.gz
src-1756886afc900127720de68088f9adff3108ef61.zip
Notes
Notes: svn path=/vendor/llvm-openmp/dist/; revision=351292 svn path=/vendor/llvm-openmp/openmp-release_900-r372316/; revision=352532; tag=vendor/llvm-openmp/openmp-release_900-r372316
-rw-r--r--LICENSE.txt287
-rw-r--r--runtime/src/dllexports98
-rw-r--r--runtime/src/exports_so.txt11
-rw-r--r--runtime/src/extractExternal.cpp7
-rw-r--r--runtime/src/i18n/en_US.txt10
-rw-r--r--runtime/src/include/30/omp.h.var165
-rw-r--r--runtime/src/include/30/omp_lib.f.var644
-rw-r--r--runtime/src/include/30/omp_lib.f90.var365
-rw-r--r--runtime/src/include/30/omp_lib.h.var649
-rw-r--r--runtime/src/include/40/omp.h.var161
-rw-r--r--runtime/src/include/40/omp_lib.f.var774
-rw-r--r--runtime/src/include/40/omp_lib.f90.var455
-rw-r--r--runtime/src/include/40/omp_lib.h.var567
-rw-r--r--runtime/src/include/45/omp.h.var197
-rw-r--r--runtime/src/include/45/omp_lib.f.var861
-rw-r--r--runtime/src/include/45/omp_lib.f90.var524
-rw-r--r--runtime/src/include/45/omp_lib.h.var645
-rw-r--r--runtime/src/include/omp-tools.h.var (renamed from runtime/src/include/50/omp-tools.h.var)15
-rw-r--r--runtime/src/include/omp.h.var (renamed from runtime/src/include/50/omp.h.var)168
-rw-r--r--runtime/src/include/omp_lib.f.var (renamed from runtime/src/include/50/omp_lib.f.var)145
-rw-r--r--runtime/src/include/omp_lib.f90.var (renamed from runtime/src/include/50/omp_lib.f90.var)124
-rw-r--r--runtime/src/include/omp_lib.h.var (renamed from runtime/src/include/50/omp_lib.h.var)176
-rw-r--r--runtime/src/kmp.h839
-rw-r--r--runtime/src/kmp_affinity.cpp77
-rw-r--r--runtime/src/kmp_affinity.h7
-rw-r--r--runtime/src/kmp_alloc.cpp397
-rw-r--r--runtime/src/kmp_atomic.cpp95
-rw-r--r--runtime/src/kmp_atomic.h21
-rw-r--r--runtime/src/kmp_barrier.cpp312
-rw-r--r--runtime/src/kmp_cancel.cpp13
-rw-r--r--runtime/src/kmp_config.h.cmake12
-rw-r--r--runtime/src/kmp_csupport.cpp269
-rw-r--r--runtime/src/kmp_debug.cpp7
-rw-r--r--runtime/src/kmp_debug.h7
-rw-r--r--runtime/src/kmp_debugger.cpp13
-rw-r--r--runtime/src/kmp_debugger.h7
-rw-r--r--runtime/src/kmp_dispatch.cpp152
-rw-r--r--runtime/src/kmp_dispatch.h30
-rw-r--r--runtime/src/kmp_dispatch_hier.h52
-rw-r--r--runtime/src/kmp_environment.cpp7
-rw-r--r--runtime/src/kmp_environment.h7
-rw-r--r--runtime/src/kmp_error.cpp38
-rw-r--r--runtime/src/kmp_error.h7
-rw-r--r--runtime/src/kmp_ftn_cdecl.cpp7
-rw-r--r--runtime/src/kmp_ftn_entry.h141
-rw-r--r--runtime/src/kmp_ftn_extra.cpp7
-rw-r--r--runtime/src/kmp_ftn_os.h85
-rw-r--r--runtime/src/kmp_ftn_stdcall.cpp7
-rw-r--r--runtime/src/kmp_global.cpp101
-rw-r--r--runtime/src/kmp_gsupport.cpp100
-rw-r--r--runtime/src/kmp_i18n.cpp7
-rw-r--r--runtime/src/kmp_i18n.h7
-rw-r--r--runtime/src/kmp_import.cpp7
-rw-r--r--runtime/src/kmp_io.cpp7
-rw-r--r--runtime/src/kmp_io.h7
-rw-r--r--runtime/src/kmp_itt.cpp7
-rw-r--r--runtime/src/kmp_itt.h9
-rw-r--r--runtime/src/kmp_itt.inl7
-rw-r--r--runtime/src/kmp_lock.cpp69
-rw-r--r--runtime/src/kmp_lock.h46
-rw-r--r--runtime/src/kmp_omp.h15
-rw-r--r--runtime/src/kmp_os.h111
-rw-r--r--runtime/src/kmp_platform.h7
-rw-r--r--runtime/src/kmp_runtime.cpp741
-rw-r--r--runtime/src/kmp_safe_c_api.h7
-rw-r--r--runtime/src/kmp_sched.cpp79
-rw-r--r--runtime/src/kmp_settings.cpp508
-rw-r--r--runtime/src/kmp_settings.h9
-rw-r--r--runtime/src/kmp_stats.cpp16
-rw-r--r--runtime/src/kmp_stats.h44
-rw-r--r--runtime/src/kmp_stats_timing.cpp7
-rw-r--r--runtime/src/kmp_stats_timing.h7
-rw-r--r--runtime/src/kmp_str.cpp7
-rw-r--r--runtime/src/kmp_str.h7
-rw-r--r--runtime/src/kmp_stub.cpp69
-rw-r--r--runtime/src/kmp_stub.h10
-rw-r--r--runtime/src/kmp_taskdeps.cpp15
-rw-r--r--runtime/src/kmp_taskdeps.h11
-rw-r--r--runtime/src/kmp_tasking.cpp675
-rw-r--r--runtime/src/kmp_taskq.cpp2029
-rw-r--r--runtime/src/kmp_threadprivate.cpp7
-rw-r--r--runtime/src/kmp_utility.cpp7
-rw-r--r--runtime/src/kmp_version.cpp24
-rw-r--r--runtime/src/kmp_version.h7
-rw-r--r--runtime/src/kmp_wait_release.cpp7
-rw-r--r--runtime/src/kmp_wait_release.h119
-rw-r--r--runtime/src/kmp_wrapper_getpid.h10
-rw-r--r--runtime/src/kmp_wrapper_malloc.h7
-rw-r--r--runtime/src/libomp.rc.var7
-rw-r--r--runtime/src/ompt-event-specific.h12
-rw-r--r--runtime/src/ompt-general.cpp23
-rw-r--r--runtime/src/ompt-internal.h13
-rw-r--r--runtime/src/ompt-specific.cpp64
-rw-r--r--runtime/src/ompt-specific.h9
-rw-r--r--runtime/src/test-touch.c7
-rw-r--r--runtime/src/thirdparty/ittnotify/disable_warnings.h7
-rw-r--r--runtime/src/thirdparty/ittnotify/ittnotify.h7
-rw-r--r--runtime/src/thirdparty/ittnotify/ittnotify_config.h7
-rw-r--r--runtime/src/thirdparty/ittnotify/ittnotify_static.c7
-rw-r--r--runtime/src/thirdparty/ittnotify/ittnotify_static.h7
-rw-r--r--runtime/src/thirdparty/ittnotify/ittnotify_types.h7
-rw-r--r--runtime/src/thirdparty/ittnotify/legacy/ittnotify.h7
-rw-r--r--runtime/src/tsan_annotations.cpp7
-rw-r--r--runtime/src/tsan_annotations.h7
-rw-r--r--runtime/src/z_Linux_asm.S183
-rw-r--r--runtime/src/z_Linux_util.cpp113
-rw-r--r--runtime/src/z_Windows_NT-586_asm.asm7
-rw-r--r--runtime/src/z_Windows_NT-586_util.cpp7
-rw-r--r--runtime/src/z_Windows_NT_util.cpp132
109 files changed, 4048 insertions, 11192 deletions
diff --git a/LICENSE.txt b/LICENSE.txt
index 0021792a1b85..990756638292 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,241 @@
==============================================================================
+The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
+==============================================================================
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+---- LLVM Exceptions to the Apache 2.0 License ----
+
+As an exception, if, as a result of your compiling your source code, portions
+of this Software are embedded into an Object form of such source code, you
+may redistribute such embedded portions in such Object form without complying
+with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
+
+In addition, if you combine or link compiled forms of this Software with
+software that is licensed under the GPLv2 ("Combined Software") and if a
+court of competent jurisdiction determines that the patent provision (Section
+3), the indemnity provision (Section 9) or other Section of the License
+conflicts with the conditions of the GPLv2, you may retroactively and
+prospectively choose to deem waived or otherwise exclude such Section(s) of
+the License, but only in their entirety and only with respect to the Combined
+Software.
+
+==============================================================================
+Software from third parties included in the LLVM Project:
+==============================================================================
+The LLVM Project contains third party software which is under different license
+terms. All such code will be identified clearly using at least one of two
+mechanisms:
+1) It will be in a separate directory tree with its own `LICENSE.txt` or
+ `LICENSE` file at the top containing the specific license and restrictions
+ which apply to that software, or
+2) It will contain specific license and restriction terms at the top of every
+ file.
+
+==============================================================================
+Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
+==============================================================================
The software contained in this directory tree is dual licensed under both the
University of Illinois "BSD-Like" license and the MIT license. As a user of
@@ -122,53 +359,3 @@ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE.
==============================================================================
-
-ARM Limited
-
-Software Grant License Agreement ("Agreement")
-
-Except for the license granted herein to you, ARM Limited ("ARM") reserves all
-right, title, and interest in and to the Software (defined below).
-
-Definition
-
-"Software" means the code and documentation as well as any original work of
-authorship, including any modifications or additions to an existing work, that
-is intentionally submitted by ARM to llvm.org (http://llvm.org) ("LLVM") for
-inclusion in, or documentation of, any of the products owned or managed by LLVM
-(the "Work"). For the purposes of this definition, "submitted" means any form of
-electronic, verbal, or written communication sent to LLVM or its
-representatives, including but not limited to communication on electronic
-mailing lists, source code control systems, and issue tracking systems that are
-managed by, or on behalf of, LLVM for the purpose of discussing and improving
-the Work, but excluding communication that is conspicuously marked otherwise.
-
-1. Grant of Copyright License. Subject to the terms and conditions of this
- Agreement, ARM hereby grants to you and to recipients of the Software
- distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
- royalty-free, irrevocable copyright license to reproduce, prepare derivative
- works of, publicly display, publicly perform, sublicense, and distribute the
- Software and such derivative works.
-
-2. Grant of Patent License. Subject to the terms and conditions of this
- Agreement, ARM hereby grants you and to recipients of the Software
- distributed by LLVM a perpetual, worldwide, non-exclusive, no-charge,
- royalty-free, irrevocable (except as stated in this section) patent license
- to make, have made, use, offer to sell, sell, import, and otherwise transfer
- the Work, where such license applies only to those patent claims licensable
- by ARM that are necessarily infringed by ARM's Software alone or by
- combination of the Software with the Work to which such Software was
- submitted. If any entity institutes patent litigation against ARM or any
- other entity (including a cross-claim or counterclaim in a lawsuit) alleging
- that ARM's Software, or the Work to which ARM has contributed constitutes
- direct or contributory patent infringement, then any patent licenses granted
- to that entity under this Agreement for the Software or Work shall terminate
- as of the date such litigation is filed.
-
-Unless required by applicable law or agreed to in writing, the software is
-provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
-either express or implied, including, without limitation, any warranties or
-conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-PARTICULAR PURPOSE.
-
-==============================================================================
diff --git a/runtime/src/dllexports b/runtime/src/dllexports
index 9885f87bf484..f76619ec0e3c 100644
--- a/runtime/src/dllexports
+++ b/runtime/src/dllexports
@@ -1,10 +1,9 @@
#
#//===----------------------------------------------------------------------===//
#//
-#// The LLVM Compiler Infrastructure
-#//
-#// This file is dual licensed under the MIT and the University of Illinois Open
-#// Source Licenses. See LICENSE.txt for details.
+#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+#// See https://llvm.org/LICENSE.txt for license information.
+#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#//
#//===----------------------------------------------------------------------===//
#
@@ -159,7 +158,7 @@
#
# Regular entry points
- __kmp_wait_yield_4
+ __kmp_wait_4
__kmp_fork_call
__kmp_invoke_microtask
%ifdef KMP_USE_MONITOR
@@ -182,7 +181,6 @@
__kmp_printf
%endif
-
%ifdef USE_DEBUGGER
__kmp_debugging DATA
__kmp_omp_debug_struct_info DATA
@@ -191,14 +189,9 @@
# Symbols for MS mutual detection:
_You_must_link_with_exactly_one_OpenMP_library DATA
_You_must_link_with_Intel_OpenMP_library DATA
- %ifdef msvc_compat
- _You_must_link_with_Microsoft_OpenMP_library DATA
- %endif
-
__kmp_wait_64
__kmp_release_64
-
# VT_getthid 1
# vtgthid 2
@@ -228,8 +221,8 @@
__kmpc_end_ordered 125
__kmpc_end_serialized_parallel 126
__kmpc_end_single 127
- __kmpc_end_taskq 128
- __kmpc_end_taskq_task 129
+# __kmpc_end_taskq 128
+# __kmpc_end_taskq_task 129
__kmpc_flush 130
__kmpc_for_static_fini 135
__kmpc_for_static_init_4 136
@@ -246,10 +239,10 @@
__kmpc_push_num_threads 148
__kmpc_serialized_parallel 150
__kmpc_single 151
- __kmpc_task 152
- __kmpc_task_buffer 153
- __kmpc_taskq 154
- __kmpc_taskq_task 155
+# __kmpc_task 152
+# __kmpc_task_buffer 153
+# __kmpc_taskq 154
+# __kmpc_taskq_task 155
__kmpc_threadprivate 156
__kmpc_threadprivate_cached 157
__kmpc_threadprivate_register 158
@@ -286,16 +279,12 @@
__kmpc_reduce 189
__kmpc_end_reduce 190
-# OpenMP 3.0
-
-%ifdef OMP_30
__kmpc_omp_task_alloc 191
__kmpc_omp_task 192
__kmpc_omp_taskwait 193
__kmpc_omp_task_begin_if0 196
__kmpc_omp_task_complete_if0 197
__kmpc_omp_task_parts 198
-%endif # OMP_30
# __omp_collector_api 199
@@ -327,9 +316,7 @@ kmpc_set_stacksize_s 222
# kmpc_set_stats 217
kmpc_set_defaults 224
-# OMP 3.0 entry points for unsigned loop iteration variables
%ifndef stub
- %ifdef OMP_30
__kmpc_for_static_init_8u 225
__kmpc_dispatch_init_8u 226
__kmpc_dispatch_next_8u 227
@@ -338,7 +325,6 @@ kmpc_set_defaults 224
__kmpc_dispatch_init_4u 230
__kmpc_dispatch_next_4u 231
__kmpc_dispatch_fini_4u 232
- %endif # OMP_30
%endif
%ifndef stub
@@ -346,17 +332,12 @@ kmpc_set_defaults 224
__kmpc_get_parent_taskid 234
%endif
-# OpenMP 3.1 entry points
%ifndef stub
- %ifdef OMP_30
__kmpc_omp_taskyield 235
- %endif # OMP_30
# __kmpc_place_threads 236
%endif
-# OpenMP 4.0 entry points
%ifndef stub
- %ifdef OMP_40
__kmpc_push_proc_bind 237
__kmpc_taskgroup 238
__kmpc_end_taskgroup 239
@@ -379,12 +360,9 @@ kmpc_set_defaults 224
__kmpc_team_static_init_4u 256
__kmpc_team_static_init_8 257
__kmpc_team_static_init_8u 258
- %endif # OMP_40
%endif
-# OpenMP 4.5 entry points
%ifndef stub
- %ifdef OMP_45
__kmpc_proxy_task_completed 259
__kmpc_proxy_task_completed_ooo 260
__kmpc_doacross_init 261
@@ -393,20 +371,22 @@ kmpc_set_defaults 224
__kmpc_doacross_fini 264
__kmpc_taskloop 266
__kmpc_critical_with_hint 270
- %endif
%endif
kmpc_aligned_malloc 265
kmpc_set_disp_num_buffers 267
-# OpenMP 5.0 entry points
%ifndef stub
- %ifdef OMP_50
__kmpc_task_reduction_init 268
__kmpc_task_reduction_get_th_data 269
-# USED FOR 4.5 __kmpc_critical_with_hint 270
+# USED ABOVE __kmpc_critical_with_hint 270
__kmpc_get_target_offload 271
- __kmpc_omp_reg_task_with_affinity 272
- %endif
+ __kmpc_omp_reg_task_with_affinity 272
+ __kmpc_pause_resource 273
+ __kmpc_task_reduction_modifier_init 274
+ __kmpc_task_reduction_modifier_fini 275
+ __kmpc_task_allow_completion_event 276
+ __kmpc_taskred_init 277
+ __kmpc_taskred_modifier_init 278
%endif
# User API entry points that have both lower- and upper- case versions for Fortran.
@@ -464,7 +444,6 @@ kmp_aligned_malloc 747
kmp_set_warnings_on 779
kmp_set_warnings_off 780
-%ifdef OMP_30
omp_get_active_level 789
omp_get_level 790
omp_get_ancestor_thread_num 791
@@ -489,17 +468,9 @@ kmp_set_warnings_off 780
kmpc_unset_affinity_mask_proc 858
kmp_get_affinity_mask_proc 859
kmpc_get_affinity_mask_proc 860
-%endif # OMP_30
-# OpenMP 3.1
-
-%ifdef OMP_30
omp_in_final 861
-%endif # OMP_30
-
-# OpenMP 40
-%ifdef OMP_40
omp_get_proc_bind 862
#omp_set_proc_bind 863
#omp_curr_proc_bind 864
@@ -511,11 +482,7 @@ kmp_set_warnings_off 780
omp_set_default_device 879
omp_get_default_device 880
omp_get_num_devices 881
-%endif # OMP_40
-# OpenMP 45
-
-%ifdef OMP_45
omp_init_lock_with_hint 870
omp_init_nest_lock_with_hint 871
omp_get_max_task_priority 872
@@ -535,17 +502,25 @@ kmp_set_warnings_off 780
omp_target_associate_ptr 888
omp_target_disassociate_ptr 889
%endif
-%endif # OMP_45
kmp_set_disp_num_buffers 890
-%ifdef OMP_50
omp_control_tool 891
omp_set_default_allocator 892
omp_get_default_allocator 893
omp_alloc 894
omp_free 895
omp_get_device_num 896
+ omp_init_allocator 897
+ omp_destroy_allocator 898
+ %ifndef stub
+ __kmpc_set_default_allocator
+ __kmpc_get_default_allocator
+ __kmpc_alloc
+ __kmpc_free
+ __kmpc_init_allocator
+ __kmpc_destroy_allocator
+ %endif
omp_set_affinity_format 748
omp_get_affinity_format 749
omp_display_affinity 750
@@ -554,8 +529,12 @@ kmp_set_disp_num_buffers 890
ompc_get_affinity_format 753
ompc_display_affinity 754
ompc_capture_affinity 755
+ omp_pause_resource 756
+ omp_pause_resource_all 757
+ omp_get_supported_active_levels 758
+ omp_fulfill_event 759
- OMP_NULL_ALLOCATOR DATA
+ omp_null_allocator DATA
omp_default_mem_alloc DATA
omp_large_cap_mem_alloc DATA
omp_const_mem_alloc DATA
@@ -564,7 +543,12 @@ kmp_set_disp_num_buffers 890
omp_cgroup_mem_alloc DATA
omp_pteam_mem_alloc DATA
omp_thread_mem_alloc DATA
-%endif # OMP_50
+
+ omp_default_mem_space DATA
+ omp_large_cap_mem_space DATA
+ omp_const_mem_space DATA
+ omp_high_bw_mem_space DATA
+ omp_low_lat_mem_space DATA
%ifndef stub
# Ordinals between 900 and 999 are reserved
@@ -1014,8 +998,6 @@ kmp_set_disp_num_buffers 890
__kmpc_atomic_float10_div_cpt_fp
%endif
- %ifdef OMP_40
-
# ATOMIC extensions for OpenMP 4.0 spec (x86 and x64 only)
__kmpc_atomic_fixed1_swp 2412
@@ -1190,8 +1172,6 @@ kmp_set_disp_num_buffers 890
__kmpc_atomic_float10_sub_cpt_rev_fp
__kmpc_atomic_float10_div_cpt_rev_fp
%endif
- %endif # OMP_40
-
%endif # arch_64
diff --git a/runtime/src/exports_so.txt b/runtime/src/exports_so.txt
index dc9effe9f62b..f7de5fd6474f 100644
--- a/runtime/src/exports_so.txt
+++ b/runtime/src/exports_so.txt
@@ -3,10 +3,9 @@
#
#//===----------------------------------------------------------------------===//
#//
-#// The LLVM Compiler Infrastructure
-#//
-#// This file is dual licensed under the MIT and the University of Illinois Open
-#// Source Licenses. See LICENSE.txt for details.
+#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+#// See https://llvm.org/LICENSE.txt for license information.
+#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#//
#//===----------------------------------------------------------------------===//
#
@@ -39,7 +38,6 @@ VERSION {
_You_must_link_with_*; # Mutual detection/MS compatibility symbols.
-
#
# Debugger support.
#
@@ -55,7 +53,6 @@ VERSION {
___kmp_allocate;
___kmp_free;
__kmp_thread_pool;
- __kmp_thread_pool_nth;
__kmp_reset_stats;
@@ -84,7 +81,7 @@ VERSION {
__kmp_reap_worker;
__kmp_release_64;
__kmp_wait_64;
- __kmp_wait_yield_4;
+ __kmp_wait_4;
# ittnotify symbols to be used by debugger
__kmp_itt_fini_ittlib;
diff --git a/runtime/src/extractExternal.cpp b/runtime/src/extractExternal.cpp
index ba20373a6a41..b3e55b555d28 100644
--- a/runtime/src/extractExternal.cpp
+++ b/runtime/src/extractExternal.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/i18n/en_US.txt b/runtime/src/i18n/en_US.txt
index 3e5283ed38f7..822f73c0ef1d 100644
--- a/runtime/src/i18n/en_US.txt
+++ b/runtime/src/i18n/en_US.txt
@@ -3,10 +3,9 @@
#
#//===----------------------------------------------------------------------===//
#//
-#// The LLVM Compiler Infrastructure
-#//
-#// This file is dual licensed under the MIT and the University of Illinois Open
-#// Source Licenses. See LICENSE.txt for details.
+#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+#// See https://llvm.org/LICENSE.txt for license information.
+#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#//
#//===----------------------------------------------------------------------===//
#
@@ -426,7 +425,7 @@ AffHWSubsetManyTiles "KMP_HW_SUBSET ignored: too many L2 Caches requeste
AffHWSubsetManyProcs "KMP_HW_SUBSET ignored: too many Procs requested."
HierSchedInvalid "Hierarchy ignored: unsupported level: %1$s."
AffFormatDefault "OMP: pid %1$s tid %2$s thread %3$s bound to OS proc set {%4$s}"
-
+APIDeprecated "%1$s routine deprecated, please use %2$s instead."
# --------------------------------------------------------------------------------------------------
-*- HINTS -*-
@@ -490,4 +489,3 @@ SystemLimitOnThreads "System-related limit on the number of threads."
# --------------------------------------------------------------------------------------------------
# end of file #
# --------------------------------------------------------------------------------------------------
-
diff --git a/runtime/src/include/30/omp.h.var b/runtime/src/include/30/omp.h.var
deleted file mode 100644
index 10bd890cab01..000000000000
--- a/runtime/src/include/30/omp.h.var
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * include/30/omp.h.var
- */
-
-
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
-//
-//===----------------------------------------------------------------------===//
-
-
-#ifndef __OMP_H
-# define __OMP_H
-
-# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
-# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
-# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
-# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
-
-# ifdef __cplusplus
- extern "C" {
-# endif
-
-# define omp_set_num_threads ompc_set_num_threads
-# define omp_set_dynamic ompc_set_dynamic
-# define omp_set_nested ompc_set_nested
-# define omp_set_max_active_levels ompc_set_max_active_levels
-# define omp_set_schedule ompc_set_schedule
-# define omp_get_ancestor_thread_num ompc_get_ancestor_thread_num
-# define omp_get_team_size ompc_get_team_size
-
-
-# define kmp_set_stacksize kmpc_set_stacksize
-# define kmp_set_stacksize_s kmpc_set_stacksize_s
-# define kmp_set_blocktime kmpc_set_blocktime
-# define kmp_set_library kmpc_set_library
-# define kmp_set_defaults kmpc_set_defaults
-# define kmp_set_affinity_mask_proc kmpc_set_affinity_mask_proc
-# define kmp_unset_affinity_mask_proc kmpc_unset_affinity_mask_proc
-# define kmp_get_affinity_mask_proc kmpc_get_affinity_mask_proc
-
-# define kmp_malloc kmpc_malloc
-# define kmp_calloc kmpc_calloc
-# define kmp_realloc kmpc_realloc
-# define kmp_free kmpc_free
-
-
-# if defined(_WIN32)
-# define __KAI_KMPC_CONVENTION __cdecl
-# else
-# define __KAI_KMPC_CONVENTION
-# endif
-
- /* schedule kind constants */
- typedef enum omp_sched_t {
- omp_sched_static = 1,
- omp_sched_dynamic = 2,
- omp_sched_guided = 3,
- omp_sched_auto = 4
- } omp_sched_t;
-
- /* set API functions */
- extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int);
- extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int);
- extern void __KAI_KMPC_CONVENTION omp_set_nested (int);
- extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int);
- extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int);
-
- /* query API functions */
- extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void);
- extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void);
- extern int __KAI_KMPC_CONVENTION omp_get_nested (void);
- extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void);
- extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void);
- extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void);
- extern int __KAI_KMPC_CONVENTION omp_in_parallel (void);
- extern int __KAI_KMPC_CONVENTION omp_in_final (void);
- extern int __KAI_KMPC_CONVENTION omp_get_active_level (void);
- extern int __KAI_KMPC_CONVENTION omp_get_level (void);
- extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int);
- extern int __KAI_KMPC_CONVENTION omp_get_team_size (int);
- extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void);
- extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void);
- extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *);
-
- /* lock API functions */
- typedef struct omp_lock_t {
- void * _lk;
- } omp_lock_t;
-
- extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *);
- extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *);
-
- /* nested lock API functions */
- typedef struct omp_nest_lock_t {
- void * _lk;
- } omp_nest_lock_t;
-
- extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *);
- extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *);
-
- /* time API functions */
- extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
- extern double __KAI_KMPC_CONVENTION omp_get_wtick (void);
-
-# include <stdlib.h>
- /* kmp API functions */
- extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
- extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
- extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
- extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
- extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
-
- /* affinity API functions */
- typedef void * kmp_affinity_mask_t;
-
- extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
- extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
- extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
-
- extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
- extern void __KAI_KMPC_CONVENTION kmp_free (void *);
-
- extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
- extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
-
-# undef __KAI_KMPC_CONVENTION
-
- /* Warning:
- The following typedefs are not standard, deprecated and will be removed in a future release.
- */
- typedef int omp_int_t;
- typedef double omp_wtime_t;
-
-# ifdef __cplusplus
- }
-# endif
-
-#endif /* __OMP_H */
-
diff --git a/runtime/src/include/30/omp_lib.f.var b/runtime/src/include/30/omp_lib.f.var
deleted file mode 100644
index 298df8d299bc..000000000000
--- a/runtime/src/include/30/omp_lib.f.var
+++ /dev/null
@@ -1,644 +0,0 @@
-! include/30/omp_lib.f.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
-!***
-!*** Some of the directives for the following routine extend past column 72,
-!*** so process this file in 132-column mode.
-!***
-
-!dec$ fixedformlinesize:132
-
- module omp_lib_kinds
-
- integer, parameter :: omp_integer_kind = 4
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = 4
- integer, parameter :: omp_lock_kind = int_ptr_kind()
- integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = int_ptr_kind()
- integer, parameter :: kmp_size_t_kind = int_ptr_kind()
- integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
-
- end module omp_lib_kinds
-
- module omp_lib
-
- use omp_lib_kinds
-
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(nthreads)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) nthreads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(enable)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) enable
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(enable)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) enable
- end subroutine omp_set_nested
-
- function omp_get_num_threads()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_get_dynamic()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_team_size
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, modifier)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) modifier
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, modifier)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) modifier
- end subroutine omp_get_schedule
-
- function omp_get_wtime()
- double precision omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick ()
- double precision omp_get_wtick
- end function omp_get_wtick
-
- subroutine omp_init_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_unset_lock
-
- function omp_test_lock(lockvar)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) lockvar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(lockvar)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) lockvar
- end function omp_test_nest_lock
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial()
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround()
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput()
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string)
- character*(*) string
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s()
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- function kmp_set_affinity(mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind) size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind) size
- integer (kind=kmp_size_t_kind) alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind) nelem
- integer (kind=kmp_size_t_kind) elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind) ptr
- integer (kind=kmp_size_t_kind) size
- end function kmp_realloc
-
- subroutine kmp_free(ptr)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on()
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off()
- end subroutine kmp_set_warnings_off
-
- end interface
-
-!dec$ if defined(_WIN32)
-!dec$ if defined(_WIN64) .or. defined(_M_AMD64)
-
-!***
-!*** The Fortran entry points must be in uppercase, even if the /Qlowercase
-!*** option is specified. The alias attribute ensures that the specified
-!*** string is used as the entry point.
-!***
-!*** On the Windows* OS IA-32 architecture, the Fortran entry points have an
-!*** underscore prepended. On the Windows* OS Intel(R) 64
-!*** architecture, no underscore is prepended.
-!***
-
-!dec$ attributes alias:'OMP_SET_NUM_THREADS' :: omp_set_num_threads
-!dec$ attributes alias:'OMP_SET_DYNAMIC' :: omp_set_dynamic
-!dec$ attributes alias:'OMP_SET_NESTED' :: omp_set_nested
-!dec$ attributes alias:'OMP_GET_NUM_THREADS' :: omp_get_num_threads
-!dec$ attributes alias:'OMP_GET_MAX_THREADS' :: omp_get_max_threads
-!dec$ attributes alias:'OMP_GET_THREAD_NUM' :: omp_get_thread_num
-!dec$ attributes alias:'OMP_GET_NUM_PROCS' :: omp_get_num_procs
-!dec$ attributes alias:'OMP_IN_PARALLEL' :: omp_in_parallel
-!dec$ attributes alias:'OMP_GET_DYNAMIC' :: omp_get_dynamic
-!dec$ attributes alias:'OMP_GET_NESTED' :: omp_get_nested
-!dec$ attributes alias:'OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
-!dec$ attributes alias:'OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
-!dec$ attributes alias:'OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
-!dec$ attributes alias:'OMP_GET_LEVEL' :: omp_get_level
-!dec$ attributes alias:'OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
-!dec$ attributes alias:'OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
-!dec$ attributes alias:'OMP_GET_TEAM_SIZE' :: omp_get_team_size
-!dec$ attributes alias:'OMP_SET_SCHEDULE' :: omp_set_schedule
-!dec$ attributes alias:'OMP_GET_SCHEDULE' :: omp_get_schedule
-!dec$ attributes alias:'OMP_GET_WTIME' :: omp_get_wtime
-!dec$ attributes alias:'OMP_GET_WTICK' :: omp_get_wtick
-
-!dec$ attributes alias:'omp_init_lock' :: omp_init_lock
-!dec$ attributes alias:'omp_destroy_lock' :: omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock' :: omp_set_lock
-!dec$ attributes alias:'omp_unset_lock' :: omp_unset_lock
-!dec$ attributes alias:'omp_test_lock' :: omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock' :: omp_init_nest_lock
-!dec$ attributes alias:'omp_destroy_nest_lock' :: omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock' :: omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock' :: omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock' :: omp_test_nest_lock
-
-!dec$ attributes alias:'KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ else
-
-!***
-!*** On Windows* OS IA-32 architecture, the Fortran entry points have an underscore prepended.
-!***
-
-!dec$ attributes alias:'_OMP_SET_NUM_THREADS' :: omp_set_num_threads
-!dec$ attributes alias:'_OMP_SET_DYNAMIC' :: omp_set_dynamic
-!dec$ attributes alias:'_OMP_SET_NESTED' :: omp_set_nested
-!dec$ attributes alias:'_OMP_GET_NUM_THREADS' :: omp_get_num_threads
-!dec$ attributes alias:'_OMP_GET_MAX_THREADS' :: omp_get_max_threads
-!dec$ attributes alias:'_OMP_GET_THREAD_NUM' :: omp_get_thread_num
-!dec$ attributes alias:'_OMP_GET_NUM_PROCS' :: omp_get_num_procs
-!dec$ attributes alias:'_OMP_IN_PARALLEL' :: omp_in_parallel
-!dec$ attributes alias:'_OMP_GET_DYNAMIC' :: omp_get_dynamic
-!dec$ attributes alias:'_OMP_GET_NESTED' :: omp_get_nested
-!dec$ attributes alias:'_OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
-!dec$ attributes alias:'_OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
-!dec$ attributes alias:'_OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
-!dec$ attributes alias:'_OMP_GET_LEVEL' :: omp_get_level
-!dec$ attributes alias:'_OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
-!dec$ attributes alias:'_OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
-!dec$ attributes alias:'_OMP_GET_TEAM_SIZE' :: omp_get_team_size
-!dec$ attributes alias:'_OMP_SET_SCHEDULE' :: omp_set_schedule
-!dec$ attributes alias:'_OMP_GET_SCHEDULE' :: omp_get_schedule
-!dec$ attributes alias:'_OMP_GET_WTIME' :: omp_get_wtime
-!dec$ attributes alias:'_OMP_GET_WTICK' :: omp_get_wtick
-
-!dec$ attributes alias:'_omp_init_lock' :: omp_init_lock
-!dec$ attributes alias:'_omp_destroy_lock' :: omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock' :: omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock' :: omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock' :: omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock' :: omp_init_nest_lock
-!dec$ attributes alias:'_omp_destroy_nest_lock' :: omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock' :: omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock' :: omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock' :: omp_test_nest_lock
-
-!dec$ attributes alias:'_KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'_KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'_KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'_KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'_KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'_KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'_KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'_KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'_KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'_KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'_KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'_KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'_KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'_KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'_KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'_KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ endif
-!dec$ endif
-
-!dec$ if defined(__linux)
-
-!***
-!*** The Linux* OS entry points are in lowercase, with an underscore appended.
-!***
-
-!dec$ attributes alias:'omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'omp_get_level_'::omp_get_level
-!dec$ attributes alias:'omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'omp_get_wtick_'::omp_get_wtick
-
-!dec$ attributes alias:'omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'kmp_free_'::kmp_free
-
-!dec$ attributes alias:'kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'kmp_set_warnings_off_'::kmp_set_warnings_off
-
-!dec$ endif
-
-!dec$ if defined(__APPLE__)
-
-!***
-!*** The Mac entry points are in lowercase, with an both an underscore
-!*** appended and an underscore prepended.
-!***
-
-!dec$ attributes alias:'_omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'_omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'_omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'_omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'_omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'_omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'_omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'_omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'_omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'_omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'_omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'_omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'_omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'_omp_get_level_'::omp_get_level
-!dec$ attributes alias:'_omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'_omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'_omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'_omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'_omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'_omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'_omp_get_wtick_'::omp_get_wtick
-
-!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'_omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'_kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'_kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'_kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'_kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'_kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'_kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'_kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'_kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'_kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'_kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'_kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'_kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'_kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'_kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'_kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'_kmp_free_'::kmp_free
-
-!dec$ attributes alias:'_kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'_kmp_set_warnings_off_'::kmp_set_warnings_off
-
-!dec$ endif
-
- end module omp_lib
-
diff --git a/runtime/src/include/30/omp_lib.f90.var b/runtime/src/include/30/omp_lib.f90.var
deleted file mode 100644
index 63539a1ef69d..000000000000
--- a/runtime/src/include/30/omp_lib.f90.var
+++ /dev/null
@@ -1,365 +0,0 @@
-! include/30/omp_lib.f90.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
- module omp_lib_kinds
-
- use, intrinsic :: iso_c_binding
-
- integer, parameter :: omp_integer_kind = c_int
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = c_float
- integer, parameter :: kmp_double_kind = c_double
- integer, parameter :: omp_lock_kind = c_intptr_t
- integer, parameter :: omp_nest_lock_kind = c_intptr_t
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = c_intptr_t
- integer, parameter :: kmp_size_t_kind = c_size_t
- integer, parameter :: kmp_affinity_mask_kind = c_intptr_t
-
- end module omp_lib_kinds
-
- module omp_lib
-
- use omp_lib_kinds
-
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*) kmp_build_date
- parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(nthreads) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: nthreads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(enable) bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind), value :: enable
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(enable) bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind), value :: enable
- end subroutine omp_set_nested
-
- function omp_get_num_threads() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) :: omp_get_level
- end function omp_get_level
-
- function omp_get_active_level() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) :: omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_team_size
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, modifier) bind(c)
- use omp_lib_kinds
- integer (kind=omp_sched_kind), value :: kind
- integer (kind=omp_integer_kind), value :: modifier
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, modifier) bind(c)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) :: kind
- integer (kind=omp_integer_kind) :: modifier
- end subroutine omp_get_schedule
-
- function omp_get_wtime() bind(c)
- use omp_lib_kinds
- real (kind=kmp_double_kind) omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick() bind(c)
- use omp_lib_kinds
- real (kind=kmp_double_kind) omp_get_wtick
- end function omp_get_wtick
-
- subroutine omp_init_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_unset_lock
-
- function omp_test_lock(lockvar) bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) lockvar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(lockvar) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) lockvar
- end function omp_test_nest_lock
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind), value :: size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial() bind(c)
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround() bind(c)
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput() bind(c)
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string) bind(c)
- use, intrinsic :: iso_c_binding
- character (kind=c_char) :: string(*)
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s() bind(c)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- function kmp_set_affinity(mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind), value :: size
- integer (kind=kmp_size_t_kind), value :: alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind), value :: nelem
- integer (kind=kmp_size_t_kind), value :: elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind), value :: ptr
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_realloc
-
- subroutine kmp_free(ptr) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind), value :: ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on() bind(c)
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off() bind(c)
- end subroutine kmp_set_warnings_off
-
- end interface
-
- end module omp_lib
diff --git a/runtime/src/include/30/omp_lib.h.var b/runtime/src/include/30/omp_lib.h.var
deleted file mode 100644
index 3800602339b1..000000000000
--- a/runtime/src/include/30/omp_lib.h.var
+++ /dev/null
@@ -1,649 +0,0 @@
-! include/30/omp_lib.h.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
-!***
-!*** Some of the directives for the following routine extend past column 72,
-!*** so process this file in 132-column mode.
-!***
-
-!dec$ fixedformlinesize:132
-
- integer, parameter :: omp_integer_kind = 4
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = 4
- integer, parameter :: omp_lock_kind = int_ptr_kind()
- integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = int_ptr_kind()
- integer, parameter :: kmp_size_t_kind = int_ptr_kind()
- integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*) kmp_build_date
- parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(nthreads)
- import
- integer (kind=omp_integer_kind) nthreads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(enable)
- import
- logical (kind=omp_logical_kind) enable
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(enable)
- import
- logical (kind=omp_logical_kind) enable
- end subroutine omp_set_nested
-
- function omp_get_num_threads()
- import
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads()
- import
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num()
- import
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs()
- import
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel()
- import
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final()
- import
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic()
- import
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested()
- import
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit()
- import
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels)
- import
- integer (kind=omp_integer_kind) max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels()
- import
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level()
- import
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level()
- import
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level)
- import
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level)
- import
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_team_size
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, modifier)
- import
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) modifier
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, modifier)
- import
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) modifier
- end subroutine omp_get_schedule
-
- function omp_get_wtime()
- double precision omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick ()
- double precision omp_get_wtick
- end function omp_get_wtick
-
- subroutine omp_init_lock(lockvar)
- import
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(lockvar)
- import
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(lockvar)
- import
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(lockvar)
- import
- integer (kind=omp_lock_kind) lockvar
- end subroutine omp_unset_lock
-
- function omp_test_lock(lockvar)
- import
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) lockvar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(lockvar)
- import
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(lockvar)
- import
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(lockvar)
- import
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(lockvar)
- import
- integer (kind=omp_nest_lock_kind) lockvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(lockvar)
- import
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) lockvar
- end function omp_test_nest_lock
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size)
- import
- integer (kind=omp_integer_kind) size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size)
- import
- integer (kind=kmp_size_t_kind) size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec)
- import
- integer (kind=omp_integer_kind) msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial()
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround()
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput()
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum)
- import
- integer (kind=omp_integer_kind) libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string)
- character*(*) string
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize()
- import
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s()
- import
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime()
- import
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library()
- import
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- function kmp_set_affinity(mask)
- import
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc()
- import
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask)
- import
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask)
- import
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask)
- import
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask)
- import
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size)
- import
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind) size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment)
- import
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind) size
- integer (kind=kmp_size_t_kind) alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize)
- import
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind) nelem
- integer (kind=kmp_size_t_kind) elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size)
- import
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind) ptr
- integer (kind=kmp_size_t_kind) size
- end function kmp_realloc
-
- subroutine kmp_free(ptr)
- import
- integer (kind=kmp_pointer_kind) ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on()
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off()
- end subroutine kmp_set_warnings_off
-
- end interface
-
-!dec$ if defined(_WIN32)
-!dec$ if defined(_WIN64) .or. defined(_M_AMD64)
-
-!***
-!*** The Fortran entry points must be in uppercase, even if the /Qlowercase
-!*** option is specified. The alias attribute ensures that the specified
-!*** string is used as the entry point.
-!***
-!*** On the Windows* OS IA-32 architecture, the Fortran entry points have an
-!*** underscore prepended. On the Windows* OS Intel(R) 64
-!*** architecture, no underscore is prepended.
-!***
-
-!dec$ attributes alias:'OMP_SET_NUM_THREADS'::omp_set_num_threads
-!dec$ attributes alias:'OMP_SET_DYNAMIC'::omp_set_dynamic
-!dec$ attributes alias:'OMP_SET_NESTED'::omp_set_nested
-!dec$ attributes alias:'OMP_GET_NUM_THREADS'::omp_get_num_threads
-!dec$ attributes alias:'OMP_GET_MAX_THREADS'::omp_get_max_threads
-!dec$ attributes alias:'OMP_GET_THREAD_NUM'::omp_get_thread_num
-!dec$ attributes alias:'OMP_GET_NUM_PROCS'::omp_get_num_procs
-!dec$ attributes alias:'OMP_IN_PARALLEL'::omp_in_parallel
-!dec$ attributes alias:'OMP_IN_FINAL'::omp_in_final
-!dec$ attributes alias:'OMP_GET_DYNAMIC'::omp_get_dynamic
-!dec$ attributes alias:'OMP_GET_NESTED'::omp_get_nested
-!dec$ attributes alias:'OMP_GET_THREAD_LIMIT'::omp_get_thread_limit
-!dec$ attributes alias:'OMP_SET_MAX_ACTIVE_LEVELS'::omp_set_max_active_levels
-!dec$ attributes alias:'OMP_GET_MAX_ACTIVE_LEVELS'::omp_get_max_active_levels
-!dec$ attributes alias:'OMP_GET_LEVEL'::omp_get_level
-!dec$ attributes alias:'OMP_GET_ACTIVE_LEVEL'::omp_get_active_level
-!dec$ attributes alias:'OMP_GET_ANCESTOR_THREAD_NUM'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'OMP_GET_TEAM_SIZE'::omp_get_team_size
-!dec$ attributes alias:'OMP_SET_SCHEDULE'::omp_set_schedule
-!dec$ attributes alias:'OMP_GET_SCHEDULE'::omp_get_schedule
-!dec$ attributes alias:'OMP_GET_WTIME'::omp_get_wtime
-!dec$ attributes alias:'OMP_GET_WTICK'::omp_get_wtick
-
-!dec$ attributes alias:'omp_init_lock'::omp_init_lock
-!dec$ attributes alias:'omp_destroy_lock'::omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock'::omp_set_lock
-!dec$ attributes alias:'omp_unset_lock'::omp_unset_lock
-!dec$ attributes alias:'omp_test_lock'::omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock'::omp_init_nest_lock
-!dec$ attributes alias:'omp_destroy_nest_lock'::omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock'::omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock'::omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock'::omp_test_nest_lock
-
-!dec$ attributes alias:'KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'KMP_SET_DEFAULTS'::kmp_set_defaults
-!dec$ attributes alias:'KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ else
-
-!***
-!*** On Windows* OS IA-32 architecture, the Fortran entry points have an underscore prepended.
-!***
-
-!dec$ attributes alias:'_OMP_SET_NUM_THREADS'::omp_set_num_threads
-!dec$ attributes alias:'_OMP_SET_DYNAMIC'::omp_set_dynamic
-!dec$ attributes alias:'_OMP_SET_NESTED'::omp_set_nested
-!dec$ attributes alias:'_OMP_GET_NUM_THREADS'::omp_get_num_threads
-!dec$ attributes alias:'_OMP_GET_MAX_THREADS'::omp_get_max_threads
-!dec$ attributes alias:'_OMP_GET_THREAD_NUM'::omp_get_thread_num
-!dec$ attributes alias:'_OMP_GET_NUM_PROCS'::omp_get_num_procs
-!dec$ attributes alias:'_OMP_IN_PARALLEL'::omp_in_parallel
-!dec$ attributes alias:'_OMP_IN_FINAL'::omp_in_final
-!dec$ attributes alias:'_OMP_GET_DYNAMIC'::omp_get_dynamic
-!dec$ attributes alias:'_OMP_GET_NESTED'::omp_get_nested
-!dec$ attributes alias:'_OMP_GET_THREAD_LIMIT'::omp_get_thread_limit
-!dec$ attributes alias:'_OMP_SET_MAX_ACTIVE_LEVELS'::omp_set_max_active_levels
-!dec$ attributes alias:'_OMP_GET_MAX_ACTIVE_LEVELS'::omp_get_max_active_levels
-!dec$ attributes alias:'_OMP_GET_LEVEL'::omp_get_level
-!dec$ attributes alias:'_OMP_GET_ACTIVE_LEVEL'::omp_get_active_level
-!dec$ attributes alias:'_OMP_GET_ANCESTOR_THREAD_NUM'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'_OMP_GET_TEAM_SIZE'::omp_get_team_size
-!dec$ attributes alias:'_OMP_SET_SCHEDULE'::omp_set_schedule
-!dec$ attributes alias:'_OMP_GET_SCHEDULE'::omp_get_schedule
-!dec$ attributes alias:'_OMP_GET_WTIME'::omp_get_wtime
-!dec$ attributes alias:'_OMP_GET_WTICK'::omp_get_wtick
-
-!dec$ attributes alias:'_omp_init_lock'::omp_init_lock
-!dec$ attributes alias:'_omp_destroy_lock'::omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock'::omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock'::omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock'::omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock'::omp_init_nest_lock
-!dec$ attributes alias:'_omp_destroy_nest_lock'::omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock'::omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock'::omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock'::omp_test_nest_lock
-
-!dec$ attributes alias:'_KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'_KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'_KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'_KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'_KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'_KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'_KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'_KMP_SET_DEFAULTS'::kmp_set_defaults
-!dec$ attributes alias:'_KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'_KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'_KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'_KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'_KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'_KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'_KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'_KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'_KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ endif
-!dec$ endif
-
-!dec$ if defined(__linux)
-
-!***
-!*** The Linux* OS entry points are in lowercase, with an underscore appended.
-!***
-
-!dec$ attributes alias:'omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'omp_in_final_'::omp_in_final
-!dec$ attributes alias:'omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'omp_get_level_'::omp_get_level
-!dec$ attributes alias:'omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'omp_get_wtick_'::omp_get_wtick
-
-!dec$ attributes alias:'omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'kmp_set_defaults_'::kmp_set_defaults
-!dec$ attributes alias:'kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'kmp_free_'::kmp_free
-
-!dec$ attributes alias:'kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'kmp_set_warnings_off_'::kmp_set_warnings_off
-
-!dec$ endif
-
-!dec$ if defined(__APPLE__)
-
-!***
-!*** The Mac entry points are in lowercase, with an both an underscore
-!*** appended and an underscore prepended.
-!***
-
-!dec$ attributes alias:'_omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'_omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'_omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'_omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'_omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'_omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'_omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'_omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'_omp_in_final_'::omp_in_final
-!dec$ attributes alias:'_omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'_omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'_omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'_omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'_omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'_omp_get_level_'::omp_get_level
-!dec$ attributes alias:'_omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'_omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'_omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'_omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'_omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'_omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'_omp_get_wtick_'::omp_get_wtick
-
-!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'_omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'_kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'_kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'_kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'_kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'_kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'_kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'_kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'_kmp_set_defaults_'::kmp_set_defaults
-!dec$ attributes alias:'_kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'_kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'_kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'_kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'_kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'_kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'_kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'_kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'_kmp_free_'::kmp_free
-
-!dec$ attributes alias:'_kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'_kmp_set_warnings_off_'::kmp_set_warnings_off
-
-!dec$ endif
-
-
diff --git a/runtime/src/include/40/omp.h.var b/runtime/src/include/40/omp.h.var
deleted file mode 100644
index b030dbec654b..000000000000
--- a/runtime/src/include/40/omp.h.var
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * include/40/omp.h.var
- */
-
-
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
-//
-//===----------------------------------------------------------------------===//
-
-
-#ifndef __OMP_H
-# define __OMP_H
-
-# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
-# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
-# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
-# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
-
-# ifdef __cplusplus
- extern "C" {
-# endif
-
-# if defined(_WIN32)
-# define __KAI_KMPC_CONVENTION __cdecl
-# else
-# define __KAI_KMPC_CONVENTION
-# endif
-
- /* schedule kind constants */
- typedef enum omp_sched_t {
- omp_sched_static = 1,
- omp_sched_dynamic = 2,
- omp_sched_guided = 3,
- omp_sched_auto = 4
- } omp_sched_t;
-
- /* set API functions */
- extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int);
- extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int);
- extern void __KAI_KMPC_CONVENTION omp_set_nested (int);
- extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int);
- extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int);
-
- /* query API functions */
- extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void);
- extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void);
- extern int __KAI_KMPC_CONVENTION omp_get_nested (void);
- extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void);
- extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void);
- extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void);
- extern int __KAI_KMPC_CONVENTION omp_in_parallel (void);
- extern int __KAI_KMPC_CONVENTION omp_in_final (void);
- extern int __KAI_KMPC_CONVENTION omp_get_active_level (void);
- extern int __KAI_KMPC_CONVENTION omp_get_level (void);
- extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int);
- extern int __KAI_KMPC_CONVENTION omp_get_team_size (int);
- extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void);
- extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void);
- extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *);
-
- /* lock API functions */
- typedef struct omp_lock_t {
- void * _lk;
- } omp_lock_t;
-
- extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *);
- extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *);
-
- /* nested lock API functions */
- typedef struct omp_nest_lock_t {
- void * _lk;
- } omp_nest_lock_t;
-
- extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *);
- extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *);
-
- /* time API functions */
- extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
- extern double __KAI_KMPC_CONVENTION omp_get_wtick (void);
-
- /* OpenMP 4.0 */
- extern int __KAI_KMPC_CONVENTION omp_get_default_device (void);
- extern void __KAI_KMPC_CONVENTION omp_set_default_device (int);
- extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void);
- extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void);
- extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void);
- extern int __KAI_KMPC_CONVENTION omp_get_team_num (void);
- extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void);
-
-# include <stdlib.h>
- /* kmp API functions */
- extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
- extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
- extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
- extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
- extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
-
- /* Intel affinity API */
- typedef void * kmp_affinity_mask_t;
-
- extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
- extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
- extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
-
- /* OpenMP 4.0 affinity API */
- typedef enum omp_proc_bind_t {
- omp_proc_bind_false = 0,
- omp_proc_bind_true = 1,
- omp_proc_bind_master = 2,
- omp_proc_bind_close = 3,
- omp_proc_bind_spread = 4
- } omp_proc_bind_t;
-
- extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void);
-
- extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
- extern void __KAI_KMPC_CONVENTION kmp_free (void *);
-
- extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
- extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
-
-# undef __KAI_KMPC_CONVENTION
-
- /* Warning:
- The following typedefs are not standard, deprecated and will be removed in a future release.
- */
- typedef int omp_int_t;
- typedef double omp_wtime_t;
-
-# ifdef __cplusplus
- }
-# endif
-
-#endif /* __OMP_H */
-
diff --git a/runtime/src/include/40/omp_lib.f.var b/runtime/src/include/40/omp_lib.f.var
deleted file mode 100644
index 63371d857bfa..000000000000
--- a/runtime/src/include/40/omp_lib.f.var
+++ /dev/null
@@ -1,774 +0,0 @@
-! include/40/omp_lib.f.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
-!***
-!*** Some of the directives for the following routine extend past column 72,
-!*** so process this file in 132-column mode.
-!***
-
-!dec$ fixedformlinesize:132
-
- module omp_lib_kinds
-
- integer, parameter :: omp_integer_kind = 4
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = 4
- integer, parameter :: omp_lock_kind = int_ptr_kind()
- integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: omp_proc_bind_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = int_ptr_kind()
- integer, parameter :: kmp_size_t_kind = int_ptr_kind()
- integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
- integer, parameter :: kmp_cancel_kind = omp_integer_kind
-
- end module omp_lib_kinds
-
- module omp_lib
-
- use omp_lib_kinds
-
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
-
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_parallel = 1
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_loop = 2
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(num_threads)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) num_threads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(dynamic_threads)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) dynamic_threads
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(nested)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) nested
- end subroutine omp_set_nested
-
- function omp_get_num_threads()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_team_size
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, chunk_size)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, chunk_size)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_get_schedule
-
- function omp_get_proc_bind()
- use omp_lib_kinds
- integer (kind=omp_proc_bind_kind) omp_get_proc_bind
- end function omp_get_proc_bind
-
- function omp_get_wtime()
- double precision omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick ()
- double precision omp_get_wtick
- end function omp_get_wtick
-
- function omp_get_default_device()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_default_device
- end function omp_get_default_device
-
- subroutine omp_set_default_device(device_num)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) device_num
- end subroutine omp_set_default_device
-
- function omp_get_num_devices()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_devices
- end function omp_get_num_devices
-
- function omp_get_num_teams()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_teams
- end function omp_get_num_teams
-
- function omp_get_team_num()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_team_num
- end function omp_get_team_num
-
- function omp_get_cancellation()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_cancellation
- end function omp_get_cancellation
-
- function omp_is_initial_device()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_is_initial_device
- end function omp_is_initial_device
-
- subroutine omp_init_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_unset_lock
-
- function omp_test_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) svar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) nvar
- end function omp_test_nest_lock
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial()
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround()
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput()
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string)
- character*(*) string
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s()
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- function kmp_set_affinity(mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind) size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind) size
- integer (kind=kmp_size_t_kind) alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind) nelem
- integer (kind=kmp_size_t_kind) elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind) ptr
- integer (kind=kmp_size_t_kind) size
- end function kmp_realloc
-
- subroutine kmp_free(ptr)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on()
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off()
- end subroutine kmp_set_warnings_off
-
- function kmp_get_cancellation_status(cancelkind)
- use omp_lib_kinds
- integer (kind=kmp_cancel_kind) cancelkind
- logical (kind=omp_logical_kind) kmp_get_cancellation_status
- end function kmp_get_cancellation_status
-
- end interface
-
-!dec$ if defined(_WIN32)
-!dec$ if defined(_WIN64) .or. defined(_M_AMD64)
-
-!***
-!*** The Fortran entry points must be in uppercase, even if the /Qlowercase
-!*** option is specified. The alias attribute ensures that the specified
-!*** string is used as the entry point.
-!***
-!*** On the Windows* OS IA-32 architecture, the Fortran entry points have an
-!*** underscore prepended. On the Windows* OS Intel(R) 64
-!*** architecture, no underscore is prepended.
-!***
-
-!dec$ attributes alias:'OMP_SET_NUM_THREADS' :: omp_set_num_threads
-!dec$ attributes alias:'OMP_SET_DYNAMIC' :: omp_set_dynamic
-!dec$ attributes alias:'OMP_SET_NESTED' :: omp_set_nested
-!dec$ attributes alias:'OMP_GET_NUM_THREADS' :: omp_get_num_threads
-!dec$ attributes alias:'OMP_GET_MAX_THREADS' :: omp_get_max_threads
-!dec$ attributes alias:'OMP_GET_THREAD_NUM' :: omp_get_thread_num
-!dec$ attributes alias:'OMP_GET_NUM_PROCS' :: omp_get_num_procs
-!dec$ attributes alias:'OMP_IN_PARALLEL' :: omp_in_parallel
-!dec$ attributes alias:'OMP_GET_DYNAMIC' :: omp_get_dynamic
-!dec$ attributes alias:'OMP_GET_NESTED' :: omp_get_nested
-!dec$ attributes alias:'OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
-!dec$ attributes alias:'OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
-!dec$ attributes alias:'OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
-!dec$ attributes alias:'OMP_GET_LEVEL' :: omp_get_level
-!dec$ attributes alias:'OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
-!dec$ attributes alias:'OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
-!dec$ attributes alias:'OMP_GET_TEAM_SIZE' :: omp_get_team_size
-!dec$ attributes alias:'OMP_SET_SCHEDULE' :: omp_set_schedule
-!dec$ attributes alias:'OMP_GET_SCHEDULE' :: omp_get_schedule
-!dec$ attributes alias:'OMP_GET_PROC_BIND' :: omp_get_proc_bind
-!dec$ attributes alias:'OMP_GET_WTIME' :: omp_get_wtime
-!dec$ attributes alias:'OMP_GET_WTICK' :: omp_get_wtick
-!dec$ attributes alias:'OMP_GET_DEFAULT_DEVICE' :: omp_get_default_device
-!dec$ attributes alias:'OMP_SET_DEFAULT_DEVICE' :: omp_set_default_device
-!dec$ attributes alias:'OMP_GET_NUM_DEVICES' :: omp_get_num_devices
-!dec$ attributes alias:'OMP_GET_NUM_TEAMS' :: omp_get_num_teams
-!dec$ attributes alias:'OMP_GET_TEAM_NUM' :: omp_get_team_num
-!dec$ attributes alias:'OMP_GET_CANCELLATION' :: omp_get_cancellation
-!dec$ attributes alias:'OMP_IS_INITIAL_DEVICE' :: omp_is_initial_device
-
-!dec$ attributes alias:'omp_init_lock' :: omp_init_lock
-!dec$ attributes alias:'omp_destroy_lock' :: omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock' :: omp_set_lock
-!dec$ attributes alias:'omp_unset_lock' :: omp_unset_lock
-!dec$ attributes alias:'omp_test_lock' :: omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock' :: omp_init_nest_lock
-!dec$ attributes alias:'omp_destroy_nest_lock' :: omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock' :: omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock' :: omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock' :: omp_test_nest_lock
-
-!dec$ attributes alias:'KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ attributes alias:'KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
-
-!dec$ else
-
-!***
-!*** On Windows* OS IA-32 architecture, the Fortran entry points have an underscore prepended.
-!***
-
-!dec$ attributes alias:'_OMP_SET_NUM_THREADS' :: omp_set_num_threads
-!dec$ attributes alias:'_OMP_SET_DYNAMIC' :: omp_set_dynamic
-!dec$ attributes alias:'_OMP_SET_NESTED' :: omp_set_nested
-!dec$ attributes alias:'_OMP_GET_NUM_THREADS' :: omp_get_num_threads
-!dec$ attributes alias:'_OMP_GET_MAX_THREADS' :: omp_get_max_threads
-!dec$ attributes alias:'_OMP_GET_THREAD_NUM' :: omp_get_thread_num
-!dec$ attributes alias:'_OMP_GET_NUM_PROCS' :: omp_get_num_procs
-!dec$ attributes alias:'_OMP_IN_PARALLEL' :: omp_in_parallel
-!dec$ attributes alias:'_OMP_GET_DYNAMIC' :: omp_get_dynamic
-!dec$ attributes alias:'_OMP_GET_NESTED' :: omp_get_nested
-!dec$ attributes alias:'_OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
-!dec$ attributes alias:'_OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
-!dec$ attributes alias:'_OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
-!dec$ attributes alias:'_OMP_GET_LEVEL' :: omp_get_level
-!dec$ attributes alias:'_OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
-!dec$ attributes alias:'_OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
-!dec$ attributes alias:'_OMP_GET_TEAM_SIZE' :: omp_get_team_size
-!dec$ attributes alias:'_OMP_SET_SCHEDULE' :: omp_set_schedule
-!dec$ attributes alias:'_OMP_GET_SCHEDULE' :: omp_get_schedule
-!dec$ attributes alias:'_OMP_GET_PROC_BIND' :: omp_get_proc_bind
-!dec$ attributes alias:'_OMP_GET_WTIME' :: omp_get_wtime
-!dec$ attributes alias:'_OMP_GET_WTICK' :: omp_get_wtick
-!dec$ attributes alias:'_OMP_GET_DEFAULT_DEVICE' :: omp_get_default_device
-!dec$ attributes alias:'_OMP_SET_DEFAULT_DEVICE' :: omp_set_default_device
-!dec$ attributes alias:'_OMP_GET_NUM_DEVICES' :: omp_get_num_devices
-!dec$ attributes alias:'_OMP_GET_NUM_TEAMS' :: omp_get_num_teams
-!dec$ attributes alias:'_OMP_GET_TEAM_NUM' :: omp_get_team_num
-!dec$ attributes alias:'_OMP_GET_CANCELLATION' :: omp_get_cancellation
-!dec$ attributes alias:'_OMP_IS_INITIAL_DEVICE' :: omp_is_initial_device
-
-!dec$ attributes alias:'_omp_init_lock' :: omp_init_lock
-!dec$ attributes alias:'_omp_destroy_lock' :: omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock' :: omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock' :: omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock' :: omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock' :: omp_init_nest_lock
-!dec$ attributes alias:'_omp_destroy_nest_lock' :: omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock' :: omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock' :: omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock' :: omp_test_nest_lock
-
-!dec$ attributes alias:'_KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'_KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'_KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'_KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'_KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'_KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'_KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'_KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'_KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'_KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'_KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'_KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'_KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'_KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'_KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'_KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ attributes alias:'_KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
-
-!dec$ endif
-!dec$ endif
-
-!dec$ if defined(__linux)
-
-!***
-!*** The Linux* OS entry points are in lowercase, with an underscore appended.
-!***
-
-!dec$ attributes alias:'omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'omp_get_level_'::omp_get_level
-!dec$ attributes alias:'omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'omp_get_proc_bind_' :: omp_get_proc_bind
-!dec$ attributes alias:'omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'omp_get_wtick_'::omp_get_wtick
-!dec$ attributes alias:'omp_get_default_device_'::omp_get_default_device
-!dec$ attributes alias:'omp_set_default_device_'::omp_set_default_device
-!dec$ attributes alias:'omp_get_num_devices_'::omp_get_num_devices
-!dec$ attributes alias:'omp_get_num_teams_'::omp_get_num_teams
-!dec$ attributes alias:'omp_get_team_num_'::omp_get_team_num
-!dec$ attributes alias:'omp_get_cancellation_'::omp_get_cancellation
-!dec$ attributes alias:'omp_is_initial_device_'::omp_is_initial_device
-
-!dec$ attributes alias:'omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'kmp_free_'::kmp_free
-
-!dec$ attributes alias:'kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'kmp_set_warnings_off_'::kmp_set_warnings_off
-!dec$ attributes alias:'kmp_get_cancellation_status_'::kmp_get_cancellation_status
-
-!dec$ endif
-
-!dec$ if defined(__APPLE__)
-
-!***
-!*** The Mac entry points are in lowercase, with an both an underscore
-!*** appended and an underscore prepended.
-!***
-
-!dec$ attributes alias:'_omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'_omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'_omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'_omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'_omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'_omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'_omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'_omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'_omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'_omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'_omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'_omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'_omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'_omp_get_level_'::omp_get_level
-!dec$ attributes alias:'_omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'_omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'_omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'_omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'_omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'_omp_get_proc_bind_' :: omp_get_proc_bind
-!dec$ attributes alias:'_omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'_omp_get_wtick_'::omp_get_wtick
-!dec$ attributes alias:'_omp_get_num_teams_'::omp_get_num_teams
-!dec$ attributes alias:'_omp_get_team_num_'::omp_get_team_num
-!dec$ attributes alias:'_omp_get_cancellation_'::omp_get_cancellation
-!dec$ attributes alias:'_omp_is_initial_device_'::omp_is_initial_device
-
-!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'_omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'_kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'_kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'_kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'_kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'_kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'_kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'_kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'_kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'_kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'_kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'_kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'_kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'_kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'_kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'_kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'_kmp_free_'::kmp_free
-
-!dec$ attributes alias:'_kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'_kmp_set_warnings_off_'::kmp_set_warnings_off
-
-!dec$ attributes alias:'_kmp_get_cancellation_status_'::kmp_get_cancellation_status
-
-!dec$ endif
-
- end module omp_lib
-
diff --git a/runtime/src/include/40/omp_lib.f90.var b/runtime/src/include/40/omp_lib.f90.var
deleted file mode 100644
index 9e5a23a06795..000000000000
--- a/runtime/src/include/40/omp_lib.f90.var
+++ /dev/null
@@ -1,455 +0,0 @@
-! include/40/omp_lib.f90.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
- module omp_lib_kinds
-
- use, intrinsic :: iso_c_binding
-
- integer, parameter :: omp_integer_kind = c_int
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = c_float
- integer, parameter :: kmp_double_kind = c_double
- integer, parameter :: omp_lock_kind = c_intptr_t
- integer, parameter :: omp_nest_lock_kind = c_intptr_t
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: omp_proc_bind_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = c_intptr_t
- integer, parameter :: kmp_size_t_kind = c_size_t
- integer, parameter :: kmp_affinity_mask_kind = c_intptr_t
- integer, parameter :: kmp_cancel_kind = omp_integer_kind
-
- end module omp_lib_kinds
-
- module omp_lib
-
- use omp_lib_kinds
-
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*) kmp_build_date
- parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
-
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
-
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_parallel = 1
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_loop = 2
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(num_threads) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: num_threads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(dynamic_threads) bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind), value :: dynamic_threads
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(nested) bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind), value :: nested
- end subroutine omp_set_nested
-
- function omp_get_num_threads() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_team_size
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, chunk_size) bind(c)
- use omp_lib_kinds
- integer (kind=omp_sched_kind), value :: kind
- integer (kind=omp_integer_kind), value :: chunk_size
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, chunk_size) bind(c)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_get_schedule
-
- function omp_get_proc_bind() bind(c)
- use omp_lib_kinds
- integer (kind=omp_proc_bind_kind) omp_get_proc_bind
- end function omp_get_proc_bind
-
- function omp_get_wtime() bind(c)
- use omp_lib_kinds
- real (kind=kmp_double_kind) omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick() bind(c)
- use omp_lib_kinds
- real (kind=kmp_double_kind) omp_get_wtick
- end function omp_get_wtick
-
- function omp_get_default_device() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_default_device
- end function omp_get_default_device
-
- subroutine omp_set_default_device(device_num) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: device_num
- end subroutine omp_set_default_device
-
- function omp_get_num_devices() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_devices
- end function omp_get_num_devices
-
- function omp_get_num_teams() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_teams
- end function omp_get_num_teams
-
- function omp_get_team_num() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_team_num
- end function omp_get_team_num
-
- function omp_get_cancellation() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_cancellation
- end function omp_get_cancellation
-
- function omp_is_initial_device() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_is_initial_device
- end function omp_is_initial_device
-
- subroutine omp_init_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_unset_lock
-
- function omp_test_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) svar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) nvar
- end function omp_test_nest_lock
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind), value :: size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial() bind(c)
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround() bind(c)
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput() bind(c)
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string) bind(c)
- use, intrinsic :: iso_c_binding
- character (kind=c_char) :: string(*)
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s() bind(c)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- function kmp_set_affinity(mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind), value :: size
- integer (kind=kmp_size_t_kind), value :: alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind), value :: nelem
- integer (kind=kmp_size_t_kind), value :: elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind), value :: ptr
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_realloc
-
- subroutine kmp_free(ptr) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind), value :: ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on() bind(c)
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off() bind(c)
- end subroutine kmp_set_warnings_off
-
- function kmp_get_cancellation_status(cancelkind) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_cancel_kind), value :: cancelkind
- logical (kind=omp_logical_kind) kmp_get_cancellation_status
- end function kmp_get_cancellation_status
-
- end interface
-
- end module omp_lib
diff --git a/runtime/src/include/40/omp_lib.h.var b/runtime/src/include/40/omp_lib.h.var
deleted file mode 100644
index 7c461a86de92..000000000000
--- a/runtime/src/include/40/omp_lib.h.var
+++ /dev/null
@@ -1,567 +0,0 @@
-! include/40/omp_lib.h.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
-!***
-!*** Some of the directives for the following routine extend past column 72,
-!*** so process this file in 132-column mode.
-!***
-
-!DIR$ fixedformlinesize:132
-
- integer, parameter :: omp_integer_kind = 4
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = 4
- integer, parameter :: omp_lock_kind = int_ptr_kind()
- integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: omp_proc_bind_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = int_ptr_kind()
- integer, parameter :: kmp_size_t_kind = int_ptr_kind()
- integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
-
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*) kmp_build_date
- parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(num_threads) bind(c)
- import
- integer (kind=omp_integer_kind), value :: num_threads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(dynamic_threads) bind(c)
- import
- logical (kind=omp_logical_kind), value :: dynamic_threads
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(nested) bind(c)
- import
- logical (kind=omp_logical_kind), value :: nested
- end subroutine omp_set_nested
-
- function omp_get_num_threads() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel() bind(c)
- import
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final() bind(c)
- import
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic() bind(c)
- import
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested() bind(c)
- import
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels) bind(c)
- import
- integer (kind=omp_integer_kind), value :: max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level) bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level) bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_team_size
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, chunk_size) bind(c)
- import
- integer (kind=omp_sched_kind), value :: kind
- integer (kind=omp_integer_kind), value :: chunk_size
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, chunk_size) bind(c)
- import
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_get_schedule
-
- function omp_get_proc_bind() bind(c)
- import
- integer (kind=omp_proc_bind_kind) omp_get_proc_bind
- end function omp_get_proc_bind
-
- function omp_get_wtime() bind(c)
- double precision omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick() bind(c)
- double precision omp_get_wtick
- end function omp_get_wtick
-
- function omp_get_default_device() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_default_device
- end function omp_get_default_device
-
- subroutine omp_set_default_device(device_num) bind(c)
- import
- integer (kind=omp_integer_kind), value :: device_num
- end subroutine omp_set_default_device
-
- function omp_get_num_devices() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_devices
- end function omp_get_num_devices
-
- function omp_get_num_teams() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_teams
- end function omp_get_num_teams
-
- function omp_get_team_num() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_team_num
- end function omp_get_team_num
-
- function omp_is_initial_device() bind(c)
- import
- logical (kind=omp_logical_kind) omp_is_initial_device
- end function omp_is_initial_device
-
- subroutine omp_init_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_unset_lock
-
- function omp_test_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_lock
-!DIR$ ENDIF
- import
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) svar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) nvar
- end function omp_test_nest_lock
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size) bind(c)
- import
- integer (kind=omp_integer_kind), value :: size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size) bind(c)
- import
- integer (kind=kmp_size_t_kind), value :: size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec) bind(c)
- import
- integer (kind=omp_integer_kind), value :: msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial() bind(c)
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround() bind(c)
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput() bind(c)
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum) bind(c)
- import
- integer (kind=omp_integer_kind), value :: libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string) bind(c)
- character string(*)
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s() bind(c)
- import
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- function kmp_set_affinity(mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask) bind(c)
- import
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask) bind(c)
- import
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind), value :: size
- integer (kind=kmp_size_t_kind), value :: alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind), value :: nelem
- integer (kind=kmp_size_t_kind), value :: elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind), value :: ptr
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_realloc
-
- subroutine kmp_free(ptr) bind(c)
- import
- integer (kind=kmp_pointer_kind), value :: ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on() bind(c)
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off() bind(c)
- end subroutine kmp_set_warnings_off
-
- end interface
-
-!DIR$ IF DEFINED (__INTEL_OFFLOAD)
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_num_threads
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_dynamic
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_nested
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_threads
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_threads
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_num
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_procs
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_parallel
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_final
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_dynamic
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_nested
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_limit
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_max_active_levels
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_active_levels
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_level
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_active_level
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_ancestor_thread_num
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_size
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_schedule
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_schedule
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_proc_bind
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_wtime
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_wtick
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_default_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_default_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_is_initial_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_teams
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_num
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_destroy_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_unset_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_test_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_destroy_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_unset_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_test_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize_s
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_blocktime
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_serial
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_turnaround
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_throughput
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_defaults
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_stacksize
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_stacksize_s
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_blocktime
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_library
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_affinity
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_max_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_create_affinity_mask
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_destroy_affinity_mask
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_affinity_mask_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_unset_affinity_mask_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_mask_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_malloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_aligned_malloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_calloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_realloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_free
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_on
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_off
-
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!$omp declare target(omp_set_num_threads )
-!$omp declare target(omp_set_dynamic )
-!$omp declare target(omp_set_nested )
-!$omp declare target(omp_get_num_threads )
-!$omp declare target(omp_get_max_threads )
-!$omp declare target(omp_get_thread_num )
-!$omp declare target(omp_get_num_procs )
-!$omp declare target(omp_in_parallel )
-!$omp declare target(omp_in_final )
-!$omp declare target(omp_get_dynamic )
-!$omp declare target(omp_get_nested )
-!$omp declare target(omp_get_thread_limit )
-!$omp declare target(omp_set_max_active_levels )
-!$omp declare target(omp_get_max_active_levels )
-!$omp declare target(omp_get_level )
-!$omp declare target(omp_get_active_level )
-!$omp declare target(omp_get_ancestor_thread_num )
-!$omp declare target(omp_get_team_size )
-!$omp declare target(omp_set_schedule )
-!$omp declare target(omp_get_schedule )
-!$omp declare target(omp_get_proc_bind )
-!$omp declare target(omp_get_wtime )
-!$omp declare target(omp_get_wtick )
-!$omp declare target(omp_get_default_device )
-!$omp declare target(omp_set_default_device )
-!$omp declare target(omp_is_initial_device )
-!$omp declare target(omp_get_num_devices )
-!$omp declare target(omp_get_num_teams )
-!$omp declare target(omp_get_team_num )
-!$omp declare target(omp_init_lock )
-!$omp declare target(omp_destroy_lock )
-!$omp declare target(omp_set_lock )
-!$omp declare target(omp_unset_lock )
-!$omp declare target(omp_test_lock )
-!$omp declare target(omp_init_nest_lock )
-!$omp declare target(omp_destroy_nest_lock )
-!$omp declare target(omp_set_nest_lock )
-!$omp declare target(omp_unset_nest_lock )
-!$omp declare target(omp_test_nest_lock )
-!$omp declare target(kmp_set_stacksize )
-!$omp declare target(kmp_set_stacksize_s )
-!$omp declare target(kmp_set_blocktime )
-!$omp declare target(kmp_set_library_serial )
-!$omp declare target(kmp_set_library_turnaround )
-!$omp declare target(kmp_set_library_throughput )
-!$omp declare target(kmp_set_library )
-!$omp declare target(kmp_set_defaults )
-!$omp declare target(kmp_get_stacksize )
-!$omp declare target(kmp_get_stacksize_s )
-!$omp declare target(kmp_get_blocktime )
-!$omp declare target(kmp_get_library )
-!$omp declare target(kmp_set_affinity )
-!$omp declare target(kmp_get_affinity )
-!$omp declare target(kmp_get_affinity_max_proc )
-!$omp declare target(kmp_create_affinity_mask )
-!$omp declare target(kmp_destroy_affinity_mask )
-!$omp declare target(kmp_set_affinity_mask_proc )
-!$omp declare target(kmp_unset_affinity_mask_proc )
-!$omp declare target(kmp_get_affinity_mask_proc )
-!$omp declare target(kmp_malloc )
-!$omp declare target(kmp_aligned_malloc )
-!$omp declare target(kmp_calloc )
-!$omp declare target(kmp_realloc )
-!$omp declare target(kmp_free )
-!$omp declare target(kmp_set_warnings_on )
-!$omp declare target(kmp_set_warnings_off )
-!DIR$ ENDIF
-!DIR$ ENDIF
-
diff --git a/runtime/src/include/45/omp.h.var b/runtime/src/include/45/omp.h.var
deleted file mode 100644
index f30da51d8139..000000000000
--- a/runtime/src/include/45/omp.h.var
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * include/45/omp.h.var
- */
-
-
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
-//
-//===----------------------------------------------------------------------===//
-
-
-#ifndef __OMP_H
-# define __OMP_H
-
-# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
-# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
-# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
-# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@"
-
-# ifdef __cplusplus
- extern "C" {
-# endif
-
-# if defined(_WIN32)
-# define __KAI_KMPC_CONVENTION __cdecl
-# else
-# define __KAI_KMPC_CONVENTION
-# endif
-
- /* schedule kind constants */
- typedef enum omp_sched_t {
- omp_sched_static = 1,
- omp_sched_dynamic = 2,
- omp_sched_guided = 3,
- omp_sched_auto = 4
- } omp_sched_t;
-
- /* set API functions */
- extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int);
- extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int);
- extern void __KAI_KMPC_CONVENTION omp_set_nested (int);
- extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int);
- extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int);
-
- /* query API functions */
- extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void);
- extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void);
- extern int __KAI_KMPC_CONVENTION omp_get_nested (void);
- extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void);
- extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void);
- extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void);
- extern int __KAI_KMPC_CONVENTION omp_in_parallel (void);
- extern int __KAI_KMPC_CONVENTION omp_in_final (void);
- extern int __KAI_KMPC_CONVENTION omp_get_active_level (void);
- extern int __KAI_KMPC_CONVENTION omp_get_level (void);
- extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int);
- extern int __KAI_KMPC_CONVENTION omp_get_team_size (int);
- extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void);
- extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void);
- extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *);
- extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void);
-
- /* lock API functions */
- typedef struct omp_lock_t {
- void * _lk;
- } omp_lock_t;
-
- extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *);
- extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *);
-
- /* nested lock API functions */
- typedef struct omp_nest_lock_t {
- void * _lk;
- } omp_nest_lock_t;
-
- extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *);
- extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *);
- extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *);
-
- /* lock hint type for dynamic user lock */
- typedef enum omp_lock_hint_t {
- omp_lock_hint_none = 0,
- omp_lock_hint_uncontended = 1,
- omp_lock_hint_contended = (1<<1 ),
- omp_lock_hint_nonspeculative = (1<<2 ),
- omp_lock_hint_speculative = (1<<3 ),
- kmp_lock_hint_hle = (1<<16),
- kmp_lock_hint_rtm = (1<<17),
- kmp_lock_hint_adaptive = (1<<18)
- } omp_lock_hint_t;
-
- /* hinted lock initializers */
- extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t);
- extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t);
-
- /* time API functions */
- extern double __KAI_KMPC_CONVENTION omp_get_wtime (void);
- extern double __KAI_KMPC_CONVENTION omp_get_wtick (void);
-
- /* OpenMP 4.0 */
- extern int __KAI_KMPC_CONVENTION omp_get_default_device (void);
- extern void __KAI_KMPC_CONVENTION omp_set_default_device (int);
- extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void);
- extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void);
- extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void);
- extern int __KAI_KMPC_CONVENTION omp_get_team_num (void);
- extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void);
-
-# include <stdlib.h>
- /* OpenMP 4.5 */
- extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void);
- extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int);
- extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int);
- extern int __KAI_KMPC_CONVENTION omp_target_is_present(void *, int);
- extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, void *, size_t, size_t, size_t, int, int);
- extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, void *, size_t, int, const size_t *,
- const size_t *, const size_t *, const size_t *, const size_t *, int, int);
- extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(void *, void *, size_t, size_t, int);
- extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(void *, int);
-
- /* kmp API functions */
- extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int);
- extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t);
- extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void);
- extern int __KAI_KMPC_CONVENTION kmp_get_library (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int);
- extern void __KAI_KMPC_CONVENTION kmp_set_library (int);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void);
- extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *);
- extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int);
-
- /* Intel affinity API */
- typedef void * kmp_affinity_mask_t;
-
- extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void);
- extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *);
- extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *);
- extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *);
-
- /* OpenMP 4.0 affinity API */
- typedef enum omp_proc_bind_t {
- omp_proc_bind_false = 0,
- omp_proc_bind_true = 1,
- omp_proc_bind_master = 2,
- omp_proc_bind_close = 3,
- omp_proc_bind_spread = 4
- } omp_proc_bind_t;
-
- extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void);
-
- /* OpenMP 4.5 affinity API */
- extern int __KAI_KMPC_CONVENTION omp_get_num_places (void);
- extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int);
- extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *);
- extern int __KAI_KMPC_CONVENTION omp_get_place_num (void);
- extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void);
- extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *);
-
- extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t);
- extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t);
- extern void __KAI_KMPC_CONVENTION kmp_free (void *);
-
- extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void);
- extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void);
-
-# undef __KAI_KMPC_CONVENTION
-
- /* Warning:
- The following typedefs are not standard, deprecated and will be removed in a future release.
- */
- typedef int omp_int_t;
- typedef double omp_wtime_t;
-
-# ifdef __cplusplus
- }
-# endif
-
-#endif /* __OMP_H */
diff --git a/runtime/src/include/45/omp_lib.f.var b/runtime/src/include/45/omp_lib.f.var
deleted file mode 100644
index 44e7cc2cdcec..000000000000
--- a/runtime/src/include/45/omp_lib.f.var
+++ /dev/null
@@ -1,861 +0,0 @@
-! include/45/omp_lib.f.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
-!***
-!*** Some of the directives for the following routine extend past column 72,
-!*** so process this file in 132-column mode.
-!***
-
-!dec$ fixedformlinesize:132
-
- module omp_lib_kinds
-
- integer, parameter :: omp_integer_kind = 4
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = 4
- integer, parameter :: omp_lock_kind = int_ptr_kind()
- integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: omp_proc_bind_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = int_ptr_kind()
- integer, parameter :: kmp_size_t_kind = int_ptr_kind()
- integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
- integer, parameter :: kmp_cancel_kind = omp_integer_kind
- integer, parameter :: omp_lock_hint_kind = omp_integer_kind
-
- end module omp_lib_kinds
-
- module omp_lib
-
- use omp_lib_kinds
-
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*), parameter :: kmp_build_date = '@LIBOMP_BUILD_DATE@'
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
-
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_parallel = 1
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_loop = 2
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
-
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(num_threads)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) num_threads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(dynamic_threads)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) dynamic_threads
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(nested)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) nested
- end subroutine omp_set_nested
-
- function omp_get_num_threads()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) level
- integer (kind=omp_integer_kind) omp_get_team_size
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, chunk_size)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, chunk_size)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_get_schedule
-
- function omp_get_proc_bind()
- use omp_lib_kinds
- integer (kind=omp_proc_bind_kind) omp_get_proc_bind
- end function omp_get_proc_bind
-
- function omp_get_num_places()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_places
- end function omp_get_num_places
-
- function omp_get_place_num_procs(place_num)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) place_num
- integer (kind=omp_integer_kind) omp_get_place_num_procs
- end function omp_get_place_num_procs
-
- subroutine omp_get_place_proc_ids(place_num, ids)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) place_num
- integer (kind=omp_integer_kind) ids(*)
- end subroutine omp_get_place_proc_ids
-
- function omp_get_place_num()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_place_num
- end function omp_get_place_num
-
- function omp_get_partition_num_places()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_partition_num_places
- end function omp_get_partition_num_places
-
- subroutine omp_get_partition_place_nums(place_nums)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) place_nums(*)
- end subroutine omp_get_partition_place_nums
-
- function omp_get_wtime()
- double precision omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick ()
- double precision omp_get_wtick
- end function omp_get_wtick
-
- function omp_get_default_device()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_default_device
- end function omp_get_default_device
-
- subroutine omp_set_default_device(device_num)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) device_num
- end subroutine omp_set_default_device
-
- function omp_get_num_devices()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_devices
- end function omp_get_num_devices
-
- function omp_get_num_teams()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_teams
- end function omp_get_num_teams
-
- function omp_get_team_num()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_team_num
- end function omp_get_team_num
-
- function omp_get_cancellation()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_cancellation
- end function omp_get_cancellation
-
- function omp_is_initial_device()
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_is_initial_device
- end function omp_is_initial_device
-
- function omp_get_initial_device()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_initial_device
- end function omp_get_initial_device
-
- subroutine omp_init_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_unset_lock
-
- function omp_test_lock(svar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) svar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(nvar)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) nvar
- end function omp_test_nest_lock
-
- function omp_get_max_task_priority()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_task_priority
- end function omp_get_max_task_priority
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial()
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround()
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput()
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string)
- character*(*) string
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s()
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- subroutine kmp_set_disp_num_buffers(num)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) num
- end subroutine kmp_set_disp_num_buffers
-
- function kmp_set_affinity(mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc()
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind) proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind) size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind) size
- integer (kind=kmp_size_t_kind) alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind) nelem
- integer (kind=kmp_size_t_kind) elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind) ptr
- integer (kind=kmp_size_t_kind) size
- end function kmp_realloc
-
- subroutine kmp_free(ptr)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on()
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off()
- end subroutine kmp_set_warnings_off
-
- function kmp_get_cancellation_status(cancelkind)
- use omp_lib_kinds
- integer (kind=kmp_cancel_kind) cancelkind
- logical (kind=omp_logical_kind) kmp_get_cancellation_status
- end function kmp_get_cancellation_status
-
- subroutine omp_init_lock_with_hint(svar, hint)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- integer (kind=omp_lock_hint_kind) hint
- end subroutine omp_init_lock_with_hint
-
- subroutine omp_init_nest_lock_with_hint(nvar, hint)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- integer (kind=omp_lock_hint_kind) hint
- end subroutine omp_init_nest_lock_with_hint
-
- end interface
-
-!dec$ if defined(_WIN32)
-!dec$ if defined(_WIN64) .or. defined(_M_AMD64)
-
-!***
-!*** The Fortran entry points must be in uppercase, even if the /Qlowercase
-!*** option is specified. The alias attribute ensures that the specified
-!*** string is used as the entry point.
-!***
-!*** On the Windows* OS IA-32 architecture, the Fortran entry points have an
-!*** underscore prepended. On the Windows* OS Intel(R) 64
-!*** architecture, no underscore is prepended.
-!***
-
-!dec$ attributes alias:'OMP_SET_NUM_THREADS' :: omp_set_num_threads
-!dec$ attributes alias:'OMP_SET_DYNAMIC' :: omp_set_dynamic
-!dec$ attributes alias:'OMP_SET_NESTED' :: omp_set_nested
-!dec$ attributes alias:'OMP_GET_NUM_THREADS' :: omp_get_num_threads
-!dec$ attributes alias:'OMP_GET_MAX_THREADS' :: omp_get_max_threads
-!dec$ attributes alias:'OMP_GET_THREAD_NUM' :: omp_get_thread_num
-!dec$ attributes alias:'OMP_GET_NUM_PROCS' :: omp_get_num_procs
-!dec$ attributes alias:'OMP_IN_PARALLEL' :: omp_in_parallel
-!dec$ attributes alias:'OMP_GET_DYNAMIC' :: omp_get_dynamic
-!dec$ attributes alias:'OMP_GET_NESTED' :: omp_get_nested
-!dec$ attributes alias:'OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
-!dec$ attributes alias:'OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
-!dec$ attributes alias:'OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
-!dec$ attributes alias:'OMP_GET_LEVEL' :: omp_get_level
-!dec$ attributes alias:'OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
-!dec$ attributes alias:'OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
-!dec$ attributes alias:'OMP_GET_TEAM_SIZE' :: omp_get_team_size
-!dec$ attributes alias:'OMP_SET_SCHEDULE' :: omp_set_schedule
-!dec$ attributes alias:'OMP_GET_SCHEDULE' :: omp_get_schedule
-!dec$ attributes alias:'OMP_GET_PROC_BIND' :: omp_get_proc_bind
-!dec$ attributes alias:'OMP_GET_WTIME' :: omp_get_wtime
-!dec$ attributes alias:'OMP_GET_WTICK' :: omp_get_wtick
-!dec$ attributes alias:'OMP_GET_DEFAULT_DEVICE' :: omp_get_default_device
-!dec$ attributes alias:'OMP_SET_DEFAULT_DEVICE' :: omp_set_default_device
-!dec$ attributes alias:'OMP_GET_NUM_DEVICES' :: omp_get_num_devices
-!dec$ attributes alias:'OMP_GET_NUM_TEAMS' :: omp_get_num_teams
-!dec$ attributes alias:'OMP_GET_TEAM_NUM' :: omp_get_team_num
-!dec$ attributes alias:'OMP_GET_CANCELLATION' :: omp_get_cancellation
-!dec$ attributes alias:'OMP_IS_INITIAL_DEVICE' :: omp_is_initial_device
-!dec$ attributes alias:'OMP_GET_INITIAL_DEVICE' :: omp_get_initial_device
-!dec$ attributes alias:'OMP_GET_MAX_TASK_PRIORITY' :: omp_get_max_task_priority
-
-!dec$ attributes alias:'omp_init_lock' :: omp_init_lock
-!dec$ attributes alias:'omp_init_lock_with_hint' :: omp_init_lock_with_hint
-!dec$ attributes alias:'omp_destroy_lock' :: omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock' :: omp_set_lock
-!dec$ attributes alias:'omp_unset_lock' :: omp_unset_lock
-!dec$ attributes alias:'omp_test_lock' :: omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock' :: omp_init_nest_lock
-!dec$ attributes alias:'omp_init_nest_lock_with_hint' :: omp_init_nest_lock_with_hint
-!dec$ attributes alias:'omp_destroy_nest_lock' :: omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock' :: omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock' :: omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock' :: omp_test_nest_lock
-
-!dec$ attributes alias:'KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ attributes alias:'KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
-
-!dec$ else
-
-!***
-!*** On Windows* OS IA-32 architecture, the Fortran entry points have an underscore prepended.
-!***
-
-!dec$ attributes alias:'_OMP_SET_NUM_THREADS' :: omp_set_num_threads
-!dec$ attributes alias:'_OMP_SET_DYNAMIC' :: omp_set_dynamic
-!dec$ attributes alias:'_OMP_SET_NESTED' :: omp_set_nested
-!dec$ attributes alias:'_OMP_GET_NUM_THREADS' :: omp_get_num_threads
-!dec$ attributes alias:'_OMP_GET_MAX_THREADS' :: omp_get_max_threads
-!dec$ attributes alias:'_OMP_GET_THREAD_NUM' :: omp_get_thread_num
-!dec$ attributes alias:'_OMP_GET_NUM_PROCS' :: omp_get_num_procs
-!dec$ attributes alias:'_OMP_IN_PARALLEL' :: omp_in_parallel
-!dec$ attributes alias:'_OMP_GET_DYNAMIC' :: omp_get_dynamic
-!dec$ attributes alias:'_OMP_GET_NESTED' :: omp_get_nested
-!dec$ attributes alias:'_OMP_GET_THREAD_LIMIT' :: omp_get_thread_limit
-!dec$ attributes alias:'_OMP_SET_MAX_ACTIVE_LEVELS' :: omp_set_max_active_levels
-!dec$ attributes alias:'_OMP_GET_MAX_ACTIVE_LEVELS' :: omp_get_max_active_levels
-!dec$ attributes alias:'_OMP_GET_LEVEL' :: omp_get_level
-!dec$ attributes alias:'_OMP_GET_ACTIVE_LEVEL' :: omp_get_active_level
-!dec$ attributes alias:'_OMP_GET_ANCESTOR_THREAD_NUM' :: omp_get_ancestor_thread_num
-!dec$ attributes alias:'_OMP_GET_TEAM_SIZE' :: omp_get_team_size
-!dec$ attributes alias:'_OMP_SET_SCHEDULE' :: omp_set_schedule
-!dec$ attributes alias:'_OMP_GET_SCHEDULE' :: omp_get_schedule
-!dec$ attributes alias:'_OMP_GET_PROC_BIND' :: omp_get_proc_bind
-!dec$ attributes alias:'_OMP_GET_WTIME' :: omp_get_wtime
-!dec$ attributes alias:'_OMP_GET_WTICK' :: omp_get_wtick
-!dec$ attributes alias:'_OMP_GET_DEFAULT_DEVICE' :: omp_get_default_device
-!dec$ attributes alias:'_OMP_SET_DEFAULT_DEVICE' :: omp_set_default_device
-!dec$ attributes alias:'_OMP_GET_NUM_DEVICES' :: omp_get_num_devices
-!dec$ attributes alias:'_OMP_GET_NUM_TEAMS' :: omp_get_num_teams
-!dec$ attributes alias:'_OMP_GET_TEAM_NUM' :: omp_get_team_num
-!dec$ attributes alias:'_OMP_GET_CANCELLATION' :: omp_get_cancellation
-!dec$ attributes alias:'_OMP_IS_INITIAL_DEVICE' :: omp_is_initial_device
-!dec$ attributes alias:'_OMP_GET_INITIAL_DEVICE' :: omp_get_initial_device
-!dec$ attributes alias:'_OMP_GET_MAX_TASK_PRIORTY' :: omp_get_max_task_priority
-
-!dec$ attributes alias:'_omp_init_lock' :: omp_init_lock
-!dec$ attributes alias:'_omp_init_lock_with_hint' :: omp_init_lock_with_hint
-!dec$ attributes alias:'_omp_destroy_lock' :: omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock' :: omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock' :: omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock' :: omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock' :: omp_init_nest_lock
-!dec$ attributes alias:'_omp_init_nest_lock_with_hint' :: omp_init_nest_lock_with_hint
-!dec$ attributes alias:'_omp_destroy_nest_lock' :: omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock' :: omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock' :: omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock' :: omp_test_nest_lock
-
-!dec$ attributes alias:'_KMP_SET_STACKSIZE'::kmp_set_stacksize
-!dec$ attributes alias:'_KMP_SET_STACKSIZE_S'::kmp_set_stacksize_s
-!dec$ attributes alias:'_KMP_SET_BLOCKTIME'::kmp_set_blocktime
-!dec$ attributes alias:'_KMP_SET_LIBRARY_SERIAL'::kmp_set_library_serial
-!dec$ attributes alias:'_KMP_SET_LIBRARY_TURNAROUND'::kmp_set_library_turnaround
-!dec$ attributes alias:'_KMP_SET_LIBRARY_THROUGHPUT'::kmp_set_library_throughput
-!dec$ attributes alias:'_KMP_SET_LIBRARY'::kmp_set_library
-!dec$ attributes alias:'_KMP_GET_STACKSIZE'::kmp_get_stacksize
-!dec$ attributes alias:'_KMP_GET_STACKSIZE_S'::kmp_get_stacksize_s
-!dec$ attributes alias:'_KMP_GET_BLOCKTIME'::kmp_get_blocktime
-!dec$ attributes alias:'_KMP_GET_LIBRARY'::kmp_get_library
-!dec$ attributes alias:'_KMP_SET_AFFINITY'::kmp_set_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY'::kmp_get_affinity
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MAX_PROC'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_KMP_CREATE_AFFINITY_MASK'::kmp_create_affinity_mask
-!dec$ attributes alias:'_KMP_DESTROY_AFFINITY_MASK'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_KMP_SET_AFFINITY_MASK_PROC'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_KMP_UNSET_AFFINITY_MASK_PROC'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_KMP_GET_AFFINITY_MASK_PROC'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_KMP_MALLOC'::kmp_malloc
-!dec$ attributes alias:'_KMP_ALIGNED_MALLOC'::kmp_aligned_malloc
-!dec$ attributes alias:'_KMP_CALLOC'::kmp_calloc
-!dec$ attributes alias:'_KMP_REALLOC'::kmp_realloc
-!dec$ attributes alias:'_KMP_FREE'::kmp_free
-
-!dec$ attributes alias:'_KMP_SET_WARNINGS_ON'::kmp_set_warnings_on
-!dec$ attributes alias:'_KMP_SET_WARNINGS_OFF'::kmp_set_warnings_off
-
-!dec$ attributes alias:'_KMP_GET_CANCELLATION_STATUS' :: kmp_get_cancellation_status
-
-!dec$ endif
-!dec$ endif
-
-!dec$ if defined(__linux)
-
-!***
-!*** The Linux* OS entry points are in lowercase, with an underscore appended.
-!***
-
-!dec$ attributes alias:'omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'omp_get_level_'::omp_get_level
-!dec$ attributes alias:'omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'omp_get_proc_bind_' :: omp_get_proc_bind
-!dec$ attributes alias:'omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'omp_get_wtick_'::omp_get_wtick
-!dec$ attributes alias:'omp_get_default_device_'::omp_get_default_device
-!dec$ attributes alias:'omp_set_default_device_'::omp_set_default_device
-!dec$ attributes alias:'omp_get_num_devices_'::omp_get_num_devices
-!dec$ attributes alias:'omp_get_num_teams_'::omp_get_num_teams
-!dec$ attributes alias:'omp_get_team_num_'::omp_get_team_num
-!dec$ attributes alias:'omp_get_cancellation_'::omp_get_cancellation
-!dec$ attributes alias:'omp_is_initial_device_'::omp_is_initial_device
-!dec$ attributes alias:'omp_get_initial_device_'::omp_get_initial_device
-!dec$ attributes alias:'omp_get_max_task_priority_'::omp_get_max_task_priority
-
-!dec$ attributes alias:'omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'omp_init_lock_with_hint_'::omp_init_lock_with_hint
-!dec$ attributes alias:'omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'omp_init_nest_lock_with_hint_'::omp_init_nest_lock_with_hint
-!dec$ attributes alias:'omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'kmp_free_'::kmp_free
-
-!dec$ attributes alias:'kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'kmp_set_warnings_off_'::kmp_set_warnings_off
-!dec$ attributes alias:'kmp_get_cancellation_status_'::kmp_get_cancellation_status
-
-!dec$ endif
-
-!dec$ if defined(__APPLE__)
-
-!***
-!*** The Mac entry points are in lowercase, with an both an underscore
-!*** appended and an underscore prepended.
-!***
-
-!dec$ attributes alias:'_omp_set_num_threads_'::omp_set_num_threads
-!dec$ attributes alias:'_omp_set_dynamic_'::omp_set_dynamic
-!dec$ attributes alias:'_omp_set_nested_'::omp_set_nested
-!dec$ attributes alias:'_omp_get_num_threads_'::omp_get_num_threads
-!dec$ attributes alias:'_omp_get_max_threads_'::omp_get_max_threads
-!dec$ attributes alias:'_omp_get_thread_num_'::omp_get_thread_num
-!dec$ attributes alias:'_omp_get_num_procs_'::omp_get_num_procs
-!dec$ attributes alias:'_omp_in_parallel_'::omp_in_parallel
-!dec$ attributes alias:'_omp_get_dynamic_'::omp_get_dynamic
-!dec$ attributes alias:'_omp_get_nested_'::omp_get_nested
-!dec$ attributes alias:'_omp_get_thread_limit_'::omp_get_thread_limit
-!dec$ attributes alias:'_omp_set_max_active_levels_'::omp_set_max_active_levels
-!dec$ attributes alias:'_omp_get_max_active_levels_'::omp_get_max_active_levels
-!dec$ attributes alias:'_omp_get_level_'::omp_get_level
-!dec$ attributes alias:'_omp_get_active_level_'::omp_get_active_level
-!dec$ attributes alias:'_omp_get_ancestor_thread_num_'::omp_get_ancestor_thread_num
-!dec$ attributes alias:'_omp_get_team_size_'::omp_get_team_size
-!dec$ attributes alias:'_omp_set_schedule_'::omp_set_schedule
-!dec$ attributes alias:'_omp_get_schedule_'::omp_get_schedule
-!dec$ attributes alias:'_omp_get_proc_bind_' :: omp_get_proc_bind
-!dec$ attributes alias:'_omp_get_wtime_'::omp_get_wtime
-!dec$ attributes alias:'_omp_get_wtick_'::omp_get_wtick
-!dec$ attributes alias:'_omp_get_default_device_'::omp_get_default_device
-!dec$ attributes alias:'_omp_set_default_device_'::omp_set_default_device
-!dec$ attributes alias:'_omp_get_num_devices_'::omp_get_num_devices
-!dec$ attributes alias:'_omp_get_num_teams_'::omp_get_num_teams
-!dec$ attributes alias:'_omp_get_team_num_'::omp_get_team_num
-!dec$ attributes alias:'_omp_get_cancellation_'::omp_get_cancellation
-!dec$ attributes alias:'_omp_is_initial_device_'::omp_is_initial_device
-!dec$ attributes alias:'_omp_get_initial_device_'::omp_get_initial_device
-!dec$ attributes alias:'_omp_get_max_task_priorty_'::omp_get_max_task_priority
-
-!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
-!dec$ attributes alias:'_omp_init_lock_with_hint_'::omp_init_lock_with_hint
-!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
-!dec$ attributes alias:'_omp_set_lock_'::omp_set_lock
-!dec$ attributes alias:'_omp_unset_lock_'::omp_unset_lock
-!dec$ attributes alias:'_omp_test_lock_'::omp_test_lock
-!dec$ attributes alias:'_omp_init_nest_lock_'::omp_init_nest_lock
-!dec$ attributes alias:'_omp_init_nest_lock_with_hint_'::omp_init_nest_lock_with_hint
-!dec$ attributes alias:'_omp_destroy_nest_lock_'::omp_destroy_nest_lock
-!dec$ attributes alias:'_omp_set_nest_lock_'::omp_set_nest_lock
-!dec$ attributes alias:'_omp_unset_nest_lock_'::omp_unset_nest_lock
-!dec$ attributes alias:'_omp_test_nest_lock_'::omp_test_nest_lock
-
-!dec$ attributes alias:'_kmp_set_stacksize_'::kmp_set_stacksize
-!dec$ attributes alias:'_kmp_set_stacksize_s_'::kmp_set_stacksize_s
-!dec$ attributes alias:'_kmp_set_blocktime_'::kmp_set_blocktime
-!dec$ attributes alias:'_kmp_set_library_serial_'::kmp_set_library_serial
-!dec$ attributes alias:'_kmp_set_library_turnaround_'::kmp_set_library_turnaround
-!dec$ attributes alias:'_kmp_set_library_throughput_'::kmp_set_library_throughput
-!dec$ attributes alias:'_kmp_set_library_'::kmp_set_library
-!dec$ attributes alias:'_kmp_get_stacksize_'::kmp_get_stacksize
-!dec$ attributes alias:'_kmp_get_stacksize_s_'::kmp_get_stacksize_s
-!dec$ attributes alias:'_kmp_get_blocktime_'::kmp_get_blocktime
-!dec$ attributes alias:'_kmp_get_library_'::kmp_get_library
-!dec$ attributes alias:'_kmp_set_affinity_'::kmp_set_affinity
-!dec$ attributes alias:'_kmp_get_affinity_'::kmp_get_affinity
-!dec$ attributes alias:'_kmp_get_affinity_max_proc_'::kmp_get_affinity_max_proc
-!dec$ attributes alias:'_kmp_create_affinity_mask_'::kmp_create_affinity_mask
-!dec$ attributes alias:'_kmp_destroy_affinity_mask_'::kmp_destroy_affinity_mask
-!dec$ attributes alias:'_kmp_set_affinity_mask_proc_'::kmp_set_affinity_mask_proc
-!dec$ attributes alias:'_kmp_unset_affinity_mask_proc_'::kmp_unset_affinity_mask_proc
-!dec$ attributes alias:'_kmp_get_affinity_mask_proc_'::kmp_get_affinity_mask_proc
-!dec$ attributes alias:'_kmp_malloc_'::kmp_malloc
-!dec$ attributes alias:'_kmp_aligned_malloc_'::kmp_aligned_malloc
-!dec$ attributes alias:'_kmp_calloc_'::kmp_calloc
-!dec$ attributes alias:'_kmp_realloc_'::kmp_realloc
-!dec$ attributes alias:'_kmp_free_'::kmp_free
-
-!dec$ attributes alias:'_kmp_set_warnings_on_'::kmp_set_warnings_on
-!dec$ attributes alias:'_kmp_set_warnings_off_'::kmp_set_warnings_off
-
-!dec$ attributes alias:'_kmp_get_cancellation_status_'::kmp_get_cancellation_status
-
-!dec$ endif
-
- end module omp_lib
diff --git a/runtime/src/include/45/omp_lib.f90.var b/runtime/src/include/45/omp_lib.f90.var
deleted file mode 100644
index b5fc44ece9f9..000000000000
--- a/runtime/src/include/45/omp_lib.f90.var
+++ /dev/null
@@ -1,524 +0,0 @@
-! include/45/omp_lib.f90.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
- module omp_lib_kinds
-
- use, intrinsic :: iso_c_binding
-
- integer, parameter :: omp_integer_kind = c_int
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = c_float
- integer, parameter :: kmp_double_kind = c_double
- integer, parameter :: omp_lock_kind = c_intptr_t
- integer, parameter :: omp_nest_lock_kind = c_intptr_t
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: omp_proc_bind_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = c_intptr_t
- integer, parameter :: kmp_size_t_kind = c_size_t
- integer, parameter :: kmp_affinity_mask_kind = c_intptr_t
- integer, parameter :: kmp_cancel_kind = omp_integer_kind
- integer, parameter :: omp_lock_hint_kind = omp_integer_kind
-
- end module omp_lib_kinds
-
- module omp_lib
-
- use omp_lib_kinds
-
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*) kmp_build_date
- parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
-
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
-
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_parallel = 1
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_loop = 2
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
- integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
-
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(num_threads) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: num_threads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(dynamic_threads) bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind), value :: dynamic_threads
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(nested) bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind), value :: nested
- end subroutine omp_set_nested
-
- function omp_get_num_threads() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_team_size
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, chunk_size) bind(c)
- use omp_lib_kinds
- integer (kind=omp_sched_kind), value :: kind
- integer (kind=omp_integer_kind), value :: chunk_size
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, chunk_size) bind(c)
- use omp_lib_kinds
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_get_schedule
-
- function omp_get_proc_bind() bind(c)
- use omp_lib_kinds
- integer (kind=omp_proc_bind_kind) omp_get_proc_bind
- end function omp_get_proc_bind
-
- function omp_get_num_places() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_places
- end function omp_get_num_places
-
- function omp_get_place_num_procs(place_num) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: place_num
- integer (kind=omp_integer_kind) omp_get_place_num_procs
- end function omp_get_place_num_procs
-
- subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: place_num
- integer (kind=omp_integer_kind) ids(*)
- end subroutine omp_get_place_proc_ids
-
- function omp_get_place_num() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_place_num
- end function omp_get_place_num
-
- function omp_get_partition_num_places() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_partition_num_places
- end function omp_get_partition_num_places
-
- subroutine omp_get_partition_place_nums(place_nums) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) place_nums(*)
- end subroutine omp_get_partition_place_nums
-
- function omp_get_wtime() bind(c)
- use omp_lib_kinds
- real (kind=kmp_double_kind) omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick() bind(c)
- use omp_lib_kinds
- real (kind=kmp_double_kind) omp_get_wtick
- end function omp_get_wtick
-
- function omp_get_default_device() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_default_device
- end function omp_get_default_device
-
- subroutine omp_set_default_device(device_num) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: device_num
- end subroutine omp_set_default_device
-
- function omp_get_num_devices() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_devices
- end function omp_get_num_devices
-
- function omp_get_num_teams() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_num_teams
- end function omp_get_num_teams
-
- function omp_get_team_num() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_team_num
- end function omp_get_team_num
-
- function omp_get_cancellation() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_cancellation
- end function omp_get_cancellation
-
- function omp_is_initial_device() bind(c)
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_is_initial_device
- end function omp_is_initial_device
-
- function omp_get_initial_device() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_initial_device
- end function omp_get_initial_device
-
- subroutine omp_init_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- end subroutine omp_unset_lock
-
- function omp_test_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) svar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_nest_lock
-!DIR$ ENDIF
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) nvar
- end function omp_test_nest_lock
-
- function omp_get_max_task_priority() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) omp_get_max_task_priority
- end function omp_get_max_task_priority
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind), value :: size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial() bind(c)
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround() bind(c)
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput() bind(c)
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string) bind(c)
- use, intrinsic :: iso_c_binding
- character (kind=c_char) :: string(*)
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s() bind(c)
- use omp_lib_kinds
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- subroutine kmp_set_disp_num_buffers(num) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind), value :: num
- end subroutine kmp_set_disp_num_buffers
-
- function kmp_set_affinity(mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc() bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask) bind(c)
- use omp_lib_kinds
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind), value :: size
- integer (kind=kmp_size_t_kind), value :: alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind), value :: nelem
- integer (kind=kmp_size_t_kind), value :: elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind), value :: ptr
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_realloc
-
- subroutine kmp_free(ptr) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_pointer_kind), value :: ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on() bind(c)
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off() bind(c)
- end subroutine kmp_set_warnings_off
-
- function kmp_get_cancellation_status(cancelkind) bind(c)
- use omp_lib_kinds
- integer (kind=kmp_cancel_kind), value :: cancelkind
- logical (kind=omp_logical_kind) kmp_get_cancellation_status
- end function kmp_get_cancellation_status
-
- subroutine omp_init_lock_with_hint(svar, hint) bind(c)
- use omp_lib_kinds
- integer (kind=omp_lock_kind) svar
- integer (kind=omp_lock_hint_kind), value :: hint
- end subroutine omp_init_lock_with_hint
-
- subroutine omp_init_nest_lock_with_hint(nvar, hint) bind(c)
- use omp_lib_kinds
- integer (kind=omp_nest_lock_kind) nvar
- integer (kind=omp_lock_hint_kind), value :: hint
- end subroutine omp_init_nest_lock_with_hint
-
- end interface
-
- end module omp_lib
diff --git a/runtime/src/include/45/omp_lib.h.var b/runtime/src/include/45/omp_lib.h.var
deleted file mode 100644
index 1ed00cd02de3..000000000000
--- a/runtime/src/include/45/omp_lib.h.var
+++ /dev/null
@@ -1,645 +0,0 @@
-! include/45/omp_lib.h.var
-
-!
-!//===----------------------------------------------------------------------===//
-!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
-!//
-!//===----------------------------------------------------------------------===//
-!
-
-!***
-!*** Some of the directives for the following routine extend past column 72,
-!*** so process this file in 132-column mode.
-!***
-
-!DIR$ fixedformlinesize:132
-
- integer, parameter :: omp_integer_kind = 4
- integer, parameter :: omp_logical_kind = 4
- integer, parameter :: omp_real_kind = 4
- integer, parameter :: omp_lock_kind = int_ptr_kind()
- integer, parameter :: omp_nest_lock_kind = int_ptr_kind()
- integer, parameter :: omp_sched_kind = omp_integer_kind
- integer, parameter :: omp_proc_bind_kind = omp_integer_kind
- integer, parameter :: kmp_pointer_kind = int_ptr_kind()
- integer, parameter :: kmp_size_t_kind = int_ptr_kind()
- integer, parameter :: kmp_affinity_mask_kind = int_ptr_kind()
- integer, parameter :: omp_lock_hint_kind = omp_integer_kind
-
- integer (kind=omp_integer_kind), parameter :: openmp_version = @LIBOMP_OMP_YEAR_MONTH@
- integer (kind=omp_integer_kind), parameter :: kmp_version_major = @LIBOMP_VERSION_MAJOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_minor = @LIBOMP_VERSION_MINOR@
- integer (kind=omp_integer_kind), parameter :: kmp_version_build = @LIBOMP_VERSION_BUILD@
- character(*) kmp_build_date
- parameter( kmp_build_date = '@LIBOMP_BUILD_DATE@' )
-
- integer(kind=omp_sched_kind), parameter :: omp_sched_static = 1
- integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
- integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
- integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_master = 2
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_close = 3
- integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_spread = 4
-
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
-
- interface
-
-! ***
-! *** omp_* entry points
-! ***
-
- subroutine omp_set_num_threads(num_threads) bind(c)
- import
- integer (kind=omp_integer_kind), value :: num_threads
- end subroutine omp_set_num_threads
-
- subroutine omp_set_dynamic(dynamic_threads) bind(c)
- import
- logical (kind=omp_logical_kind), value :: dynamic_threads
- end subroutine omp_set_dynamic
-
- subroutine omp_set_nested(nested) bind(c)
- import
- logical (kind=omp_logical_kind), value :: nested
- end subroutine omp_set_nested
-
- function omp_get_num_threads() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_threads
- end function omp_get_num_threads
-
- function omp_get_max_threads() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_max_threads
- end function omp_get_max_threads
-
- function omp_get_thread_num() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_thread_num
- end function omp_get_thread_num
-
- function omp_get_num_procs() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_procs
- end function omp_get_num_procs
-
- function omp_in_parallel() bind(c)
- import
- logical (kind=omp_logical_kind) omp_in_parallel
- end function omp_in_parallel
-
- function omp_in_final() bind(c)
- import
- logical (kind=omp_logical_kind) omp_in_final
- end function omp_in_final
-
- function omp_get_dynamic() bind(c)
- import
- logical (kind=omp_logical_kind) omp_get_dynamic
- end function omp_get_dynamic
-
- function omp_get_nested() bind(c)
- import
- logical (kind=omp_logical_kind) omp_get_nested
- end function omp_get_nested
-
- function omp_get_thread_limit() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_thread_limit
- end function omp_get_thread_limit
-
- subroutine omp_set_max_active_levels(max_levels) bind(c)
- import
- integer (kind=omp_integer_kind), value :: max_levels
- end subroutine omp_set_max_active_levels
-
- function omp_get_max_active_levels() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_max_active_levels
- end function omp_get_max_active_levels
-
- function omp_get_level() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_level
- end function omp_get_level
-
- function omp_get_active_level() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_active_level
- end function omp_get_active_level
-
- function omp_get_ancestor_thread_num(level) bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_ancestor_thread_num
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_ancestor_thread_num
-
- function omp_get_team_size(level) bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_team_size
- integer (kind=omp_integer_kind), value :: level
- end function omp_get_team_size
-
- subroutine omp_set_schedule(kind, chunk_size) bind(c)
- import
- integer (kind=omp_sched_kind), value :: kind
- integer (kind=omp_integer_kind), value :: chunk_size
- end subroutine omp_set_schedule
-
- subroutine omp_get_schedule(kind, chunk_size) bind(c)
- import
- integer (kind=omp_sched_kind) kind
- integer (kind=omp_integer_kind) chunk_size
- end subroutine omp_get_schedule
-
- function omp_get_proc_bind() bind(c)
- import
- integer (kind=omp_proc_bind_kind) omp_get_proc_bind
- end function omp_get_proc_bind
-
- function omp_get_num_places() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_places
- end function omp_get_num_places
-
- function omp_get_place_num_procs(place_num) bind(c)
- import
- integer (kind=omp_integer_kind), value :: place_num
- integer (kind=omp_integer_kind) omp_get_place_num_procs
- end function omp_get_place_num_procs
-
- subroutine omp_get_place_proc_ids(place_num, ids) bind(c)
- import
- integer (kind=omp_integer_kind), value :: place_num
- integer (kind=omp_integer_kind) ids(*)
- end subroutine omp_get_place_proc_ids
-
- function omp_get_place_num() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_place_num
- end function omp_get_place_num
-
- function omp_get_partition_num_places() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_partition_num_places
- end function omp_get_partition_num_places
-
- subroutine omp_get_partition_place_nums(place_nums) bind(c)
- import
- integer (kind=omp_integer_kind) place_nums(*)
- end subroutine omp_get_partition_place_nums
-
- function omp_get_wtime() bind(c)
- double precision omp_get_wtime
- end function omp_get_wtime
-
- function omp_get_wtick() bind(c)
- double precision omp_get_wtick
- end function omp_get_wtick
-
- function omp_get_default_device() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_default_device
- end function omp_get_default_device
-
- subroutine omp_set_default_device(device_num) bind(c)
- import
- integer (kind=omp_integer_kind), value :: device_num
- end subroutine omp_set_default_device
-
- function omp_get_num_devices() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_devices
- end function omp_get_num_devices
-
- function omp_get_num_teams() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_num_teams
- end function omp_get_num_teams
-
- function omp_get_team_num() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_team_num
- end function omp_get_team_num
-
- function omp_is_initial_device() bind(c)
- import
- logical (kind=omp_logical_kind) omp_is_initial_device
- end function omp_is_initial_device
-
- function omp_get_initial_device() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_initial_device
- end function omp_get_initial_device
-
- subroutine omp_init_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_init_lock
-
- subroutine omp_destroy_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_destroy_lock
-
- subroutine omp_set_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_set_lock
-
- subroutine omp_unset_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_lock_kind) svar
- end subroutine omp_unset_lock
-
- function omp_test_lock(svar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_lock
-!DIR$ ENDIF
- import
- logical (kind=omp_logical_kind) omp_test_lock
- integer (kind=omp_lock_kind) svar
- end function omp_test_lock
-
- subroutine omp_init_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_init_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_init_nest_lock
-
- subroutine omp_destroy_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_destroy_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_destroy_nest_lock
-
- subroutine omp_set_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_set_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_set_nest_lock
-
- subroutine omp_unset_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_unset_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_nest_lock_kind) nvar
- end subroutine omp_unset_nest_lock
-
- function omp_test_nest_lock(nvar) bind(c)
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!DIR$ attributes known_intrinsic :: omp_test_nest_lock
-!DIR$ ENDIF
- import
- integer (kind=omp_integer_kind) omp_test_nest_lock
- integer (kind=omp_nest_lock_kind) nvar
- end function omp_test_nest_lock
-
- function omp_get_max_task_priority() bind(c)
- import
- integer (kind=omp_integer_kind) omp_get_max_task_priority
- end function omp_get_max_task_priority
-
-! ***
-! *** kmp_* entry points
-! ***
-
- subroutine kmp_set_stacksize(size) bind(c)
- import
- integer (kind=omp_integer_kind), value :: size
- end subroutine kmp_set_stacksize
-
- subroutine kmp_set_stacksize_s(size) bind(c)
- import
- integer (kind=kmp_size_t_kind), value :: size
- end subroutine kmp_set_stacksize_s
-
- subroutine kmp_set_blocktime(msec) bind(c)
- import
- integer (kind=omp_integer_kind), value :: msec
- end subroutine kmp_set_blocktime
-
- subroutine kmp_set_library_serial() bind(c)
- end subroutine kmp_set_library_serial
-
- subroutine kmp_set_library_turnaround() bind(c)
- end subroutine kmp_set_library_turnaround
-
- subroutine kmp_set_library_throughput() bind(c)
- end subroutine kmp_set_library_throughput
-
- subroutine kmp_set_library(libnum) bind(c)
- import
- integer (kind=omp_integer_kind), value :: libnum
- end subroutine kmp_set_library
-
- subroutine kmp_set_defaults(string) bind(c)
- character string(*)
- end subroutine kmp_set_defaults
-
- function kmp_get_stacksize() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_stacksize
- end function kmp_get_stacksize
-
- function kmp_get_stacksize_s() bind(c)
- import
- integer (kind=kmp_size_t_kind) kmp_get_stacksize_s
- end function kmp_get_stacksize_s
-
- function kmp_get_blocktime() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_blocktime
- end function kmp_get_blocktime
-
- function kmp_get_library() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_library
- end function kmp_get_library
-
- subroutine kmp_set_disp_num_buffers(num) bind(c)
- import
- integer (kind=omp_integer_kind), value :: num
- end subroutine kmp_set_disp_num_buffers
-
- function kmp_set_affinity(mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_set_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity
-
- function kmp_get_affinity(mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity
-
- function kmp_get_affinity_max_proc() bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity_max_proc
- end function kmp_get_affinity_max_proc
-
- subroutine kmp_create_affinity_mask(mask) bind(c)
- import
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_create_affinity_mask
-
- subroutine kmp_destroy_affinity_mask(mask) bind(c)
- import
- integer (kind=kmp_affinity_mask_kind) mask
- end subroutine kmp_destroy_affinity_mask
-
- function kmp_set_affinity_mask_proc(proc, mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_set_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_set_affinity_mask_proc
-
- function kmp_unset_affinity_mask_proc(proc, mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_unset_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_unset_affinity_mask_proc
-
- function kmp_get_affinity_mask_proc(proc, mask) bind(c)
- import
- integer (kind=omp_integer_kind) kmp_get_affinity_mask_proc
- integer (kind=omp_integer_kind), value :: proc
- integer (kind=kmp_affinity_mask_kind) mask
- end function kmp_get_affinity_mask_proc
-
- function kmp_malloc(size) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_malloc
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_malloc
-
- function kmp_aligned_malloc(size, alignment) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_aligned_malloc
- integer (kind=kmp_size_t_kind), value :: size
- integer (kind=kmp_size_t_kind), value :: alignment
- end function kmp_aligned_malloc
-
- function kmp_calloc(nelem, elsize) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_calloc
- integer (kind=kmp_size_t_kind), value :: nelem
- integer (kind=kmp_size_t_kind), value :: elsize
- end function kmp_calloc
-
- function kmp_realloc(ptr, size) bind(c)
- import
- integer (kind=kmp_pointer_kind) kmp_realloc
- integer (kind=kmp_pointer_kind), value :: ptr
- integer (kind=kmp_size_t_kind), value :: size
- end function kmp_realloc
-
- subroutine kmp_free(ptr) bind(c)
- import
- integer (kind=kmp_pointer_kind), value :: ptr
- end subroutine kmp_free
-
- subroutine kmp_set_warnings_on() bind(c)
- end subroutine kmp_set_warnings_on
-
- subroutine kmp_set_warnings_off() bind(c)
- end subroutine kmp_set_warnings_off
-
- subroutine omp_init_lock_with_hint(svar, hint) bind(c)
- import
- integer (kind=omp_lock_kind) svar
- integer (kind=omp_lock_hint_kind), value :: hint
- end subroutine omp_init_lock_with_hint
-
- subroutine omp_init_nest_lock_with_hint(nvar, hint) bind(c)
- import
- integer (kind=omp_nest_lock_kind) nvar
- integer (kind=omp_lock_hint_kind), value :: hint
- end subroutine omp_init_nest_lock_with_hint
-
- end interface
-
-!DIR$ IF DEFINED (__INTEL_OFFLOAD)
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_num_threads
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_dynamic
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_nested
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_threads
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_threads
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_num
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_procs
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_parallel
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_in_final
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_dynamic
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_nested
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_thread_limit
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_max_active_levels
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_active_levels
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_level
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_active_level
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_ancestor_thread_num
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_size
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_schedule
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_schedule
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_proc_bind
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_wtime
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_wtick
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_default_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_default_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_is_initial_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_initial_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_teams
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_num
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_destroy_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_unset_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_test_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_destroy_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_set_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_unset_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_test_nest_lock
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_max_task_priority
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_stacksize_s
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_blocktime
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_serial
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_turnaround
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library_throughput
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_library
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_defaults
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_stacksize
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_stacksize_s
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_blocktime
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_library
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_disp_num_buffers
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_affinity
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_max_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_create_affinity_mask
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_destroy_affinity_mask
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_affinity_mask_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_unset_affinity_mask_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_get_affinity_mask_proc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_malloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_aligned_malloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_calloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_realloc
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_free
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_on
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: kmp_set_warnings_off
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock_with_hint
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_nest_lock_with_hint
-
-!DIR$ IF(__INTEL_COMPILER.GE.1400)
-!$omp declare target(omp_set_num_threads )
-!$omp declare target(omp_set_dynamic )
-!$omp declare target(omp_set_nested )
-!$omp declare target(omp_get_num_threads )
-!$omp declare target(omp_get_max_threads )
-!$omp declare target(omp_get_thread_num )
-!$omp declare target(omp_get_num_procs )
-!$omp declare target(omp_in_parallel )
-!$omp declare target(omp_in_final )
-!$omp declare target(omp_get_dynamic )
-!$omp declare target(omp_get_nested )
-!$omp declare target(omp_get_thread_limit )
-!$omp declare target(omp_set_max_active_levels )
-!$omp declare target(omp_get_max_active_levels )
-!$omp declare target(omp_get_level )
-!$omp declare target(omp_get_active_level )
-!$omp declare target(omp_get_ancestor_thread_num )
-!$omp declare target(omp_get_team_size )
-!$omp declare target(omp_set_schedule )
-!$omp declare target(omp_get_schedule )
-!$omp declare target(omp_get_proc_bind )
-!$omp declare target(omp_get_wtime )
-!$omp declare target(omp_get_wtick )
-!$omp declare target(omp_get_default_device )
-!$omp declare target(omp_set_default_device )
-!$omp declare target(omp_is_initial_device )
-!$omp declare target(omp_get_initial_device )
-!$omp declare target(omp_get_num_devices )
-!$omp declare target(omp_get_num_teams )
-!$omp declare target(omp_get_team_num )
-!$omp declare target(omp_init_lock )
-!$omp declare target(omp_destroy_lock )
-!$omp declare target(omp_set_lock )
-!$omp declare target(omp_unset_lock )
-!$omp declare target(omp_test_lock )
-!$omp declare target(omp_init_nest_lock )
-!$omp declare target(omp_destroy_nest_lock )
-!$omp declare target(omp_set_nest_lock )
-!$omp declare target(omp_unset_nest_lock )
-!$omp declare target(omp_test_nest_lock )
-!$omp declare target(omp_get_max_task_priority )
-!$omp declare target(kmp_set_stacksize )
-!$omp declare target(kmp_set_stacksize_s )
-!$omp declare target(kmp_set_blocktime )
-!$omp declare target(kmp_set_library_serial )
-!$omp declare target(kmp_set_library_turnaround )
-!$omp declare target(kmp_set_library_throughput )
-!$omp declare target(kmp_set_library )
-!$omp declare target(kmp_set_defaults )
-!$omp declare target(kmp_get_stacksize )
-!$omp declare target(kmp_get_stacksize_s )
-!$omp declare target(kmp_get_blocktime )
-!$omp declare target(kmp_get_library )
-!$omp declare target(kmp_set_disp_num_buffers )
-!$omp declare target(kmp_set_affinity )
-!$omp declare target(kmp_get_affinity )
-!$omp declare target(kmp_get_affinity_max_proc )
-!$omp declare target(kmp_create_affinity_mask )
-!$omp declare target(kmp_destroy_affinity_mask )
-!$omp declare target(kmp_set_affinity_mask_proc )
-!$omp declare target(kmp_unset_affinity_mask_proc )
-!$omp declare target(kmp_get_affinity_mask_proc )
-!$omp declare target(kmp_malloc )
-!$omp declare target(kmp_aligned_malloc )
-!$omp declare target(kmp_calloc )
-!$omp declare target(kmp_realloc )
-!$omp declare target(kmp_free )
-!$omp declare target(kmp_set_warnings_on )
-!$omp declare target(kmp_set_warnings_off )
-!$omp declare target(omp_init_lock_with_hint )
-!$omp declare target(omp_init_nest_lock_with_hint )
-!DIR$ ENDIF
-!DIR$ ENDIF
diff --git a/runtime/src/include/50/omp-tools.h.var b/runtime/src/include/omp-tools.h.var
index 276967d07e8f..190b538fa03c 100644
--- a/runtime/src/include/50/omp-tools.h.var
+++ b/runtime/src/include/omp-tools.h.var
@@ -1,13 +1,12 @@
/*
- * include/50/omp-tools.h.var
+ * include/omp-tools.h.var
*/
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -372,7 +371,7 @@ typedef enum ompt_frame_flag_t {
ompt_frame_cfa = 0x10,
ompt_frame_framepointer = 0x20,
ompt_frame_stackaddress = 0x30
-} ompt_frame_flag_t;
+} ompt_frame_flag_t;
typedef enum ompt_state_t {
ompt_state_work_serial = 0x000,
@@ -721,14 +720,14 @@ typedef void (*ompt_callback_dispatch_t) (
ompt_data_t *parallel_data,
ompt_data_t *task_data,
ompt_dispatch_t kind,
- ompt_data_t instance
+ ompt_data_t instance
);
typedef struct ompt_record_dispatch_t {
ompt_id_t parallel_id;
ompt_id_t task_id;
ompt_dispatch_t kind;
- ompt_data_t instance;
+ ompt_data_t instance;
} ompt_record_dispatch_t;
typedef void (*ompt_callback_task_create_t) (
diff --git a/runtime/src/include/50/omp.h.var b/runtime/src/include/omp.h.var
index 872b8f5007d7..2246e7012bee 100644
--- a/runtime/src/include/50/omp.h.var
+++ b/runtime/src/include/omp.h.var
@@ -1,14 +1,13 @@
/*
- * include/50/omp.h.var
+ * include/omp.h.var
*/
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -16,6 +15,9 @@
#ifndef __OMP_H
# define __OMP_H
+# include <stdlib.h>
+# include <stdint.h>
+
# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@
@@ -44,10 +46,11 @@
/* schedule kind constants */
typedef enum omp_sched_t {
- omp_sched_static = 1,
- omp_sched_dynamic = 2,
- omp_sched_guided = 3,
- omp_sched_auto = 4
+ omp_sched_static = 1,
+ omp_sched_dynamic = 2,
+ omp_sched_guided = 3,
+ omp_sched_auto = 4,
+ omp_sched_monotonic = 0x80000000
} omp_sched_t;
/* set API functions */
@@ -134,7 +137,6 @@
extern int __KAI_KMPC_CONVENTION omp_get_team_num (void);
extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void);
-# include <stdlib.h>
/* OpenMP 4.5 */
extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void);
extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int);
@@ -148,6 +150,7 @@
/* OpenMP 5.0 */
extern int __KAI_KMPC_CONVENTION omp_get_device_num (void);
+ typedef void * omp_depend_t;
/* kmp API functions */
extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void);
@@ -218,30 +221,113 @@
omp_control_tool_flush = 3,
omp_control_tool_end = 4
} omp_control_tool_t;
-
+
extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*);
/* OpenMP 5.0 Memory Management */
- typedef void *omp_allocator_t;
- extern __KMP_IMP const omp_allocator_t *OMP_NULL_ALLOCATOR;
- extern __KMP_IMP const omp_allocator_t *omp_default_mem_alloc;
- extern __KMP_IMP const omp_allocator_t *omp_large_cap_mem_alloc;
- extern __KMP_IMP const omp_allocator_t *omp_const_mem_alloc;
- extern __KMP_IMP const omp_allocator_t *omp_high_bw_mem_alloc;
- extern __KMP_IMP const omp_allocator_t *omp_low_lat_mem_alloc;
- extern __KMP_IMP const omp_allocator_t *omp_cgroup_mem_alloc;
- extern __KMP_IMP const omp_allocator_t *omp_pteam_mem_alloc;
- extern __KMP_IMP const omp_allocator_t *omp_thread_mem_alloc;
-
- extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(const omp_allocator_t *);
- extern const omp_allocator_t * __KAI_KMPC_CONVENTION omp_get_default_allocator(void);
-#ifdef __cplusplus
- extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, const omp_allocator_t *allocator = OMP_NULL_ALLOCATOR);
- extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, const omp_allocator_t *allocator = OMP_NULL_ALLOCATOR);
-#else
- extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, const omp_allocator_t *allocator);
- extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, const omp_allocator_t *allocator);
-#endif
+ typedef uintptr_t omp_uintptr_t;
+
+ typedef enum {
+ OMP_ATK_THREADMODEL = 1,
+ OMP_ATK_ALIGNMENT = 2,
+ OMP_ATK_ACCESS = 3,
+ OMP_ATK_POOL_SIZE = 4,
+ OMP_ATK_FALLBACK = 5,
+ OMP_ATK_FB_DATA = 6,
+ OMP_ATK_PINNED = 7,
+ OMP_ATK_PARTITION = 8
+ } omp_alloctrait_key_t;
+
+ typedef enum {
+ OMP_ATV_FALSE = 0,
+ OMP_ATV_TRUE = 1,
+ OMP_ATV_DEFAULT = 2,
+ OMP_ATV_CONTENDED = 3,
+ OMP_ATV_UNCONTENDED = 4,
+ OMP_ATV_SEQUENTIAL = 5,
+ OMP_ATV_PRIVATE = 6,
+ OMP_ATV_ALL = 7,
+ OMP_ATV_THREAD = 8,
+ OMP_ATV_PTEAM = 9,
+ OMP_ATV_CGROUP = 10,
+ OMP_ATV_DEFAULT_MEM_FB = 11,
+ OMP_ATV_NULL_FB = 12,
+ OMP_ATV_ABORT_FB = 13,
+ OMP_ATV_ALLOCATOR_FB = 14,
+ OMP_ATV_ENVIRONMENT = 15,
+ OMP_ATV_NEAREST = 16,
+ OMP_ATV_BLOCKED = 17,
+ OMP_ATV_INTERLEAVED = 18
+ } omp_alloctrait_value_t;
+
+ typedef struct {
+ omp_alloctrait_key_t key;
+ omp_uintptr_t value;
+ } omp_alloctrait_t;
+
+# if defined(_WIN32)
+ // On Windows cl and icl do not support 64-bit enum, let's use integer then.
+ typedef omp_uintptr_t omp_allocator_handle_t;
+ extern __KMP_IMP omp_allocator_handle_t const omp_null_allocator;
+ extern __KMP_IMP omp_allocator_handle_t const omp_default_mem_alloc;
+ extern __KMP_IMP omp_allocator_handle_t const omp_large_cap_mem_alloc;
+ extern __KMP_IMP omp_allocator_handle_t const omp_const_mem_alloc;
+ extern __KMP_IMP omp_allocator_handle_t const omp_high_bw_mem_alloc;
+ extern __KMP_IMP omp_allocator_handle_t const omp_low_lat_mem_alloc;
+ extern __KMP_IMP omp_allocator_handle_t const omp_cgroup_mem_alloc;
+ extern __KMP_IMP omp_allocator_handle_t const omp_pteam_mem_alloc;
+ extern __KMP_IMP omp_allocator_handle_t const omp_thread_mem_alloc;
+ typedef omp_uintptr_t omp_memspace_handle_t;
+ extern __KMP_IMP omp_memspace_handle_t const omp_default_mem_space;
+ extern __KMP_IMP omp_memspace_handle_t const omp_large_cap_mem_space;
+ extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space;
+ extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space;
+ extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space;
+# else
+# if __cplusplus >= 201103
+ typedef enum omp_allocator_handle_t : omp_uintptr_t
+# else
+ typedef enum omp_allocator_handle_t
+# endif
+ {
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX
+ } omp_allocator_handle_t;
+# if __cplusplus >= 201103
+ typedef enum omp_memspace_handle_t : omp_uintptr_t
+# else
+ typedef enum omp_memspace_handle_t
+# endif
+ {
+ omp_default_mem_space = 0,
+ omp_large_cap_mem_space = 1,
+ omp_const_mem_space = 2,
+ omp_high_bw_mem_space = 3,
+ omp_low_lat_mem_space = 4,
+ KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX
+ } omp_memspace_handle_t;
+# endif
+ extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_init_allocator(omp_memspace_handle_t m,
+ int ntraits, omp_alloctrait_t traits[]);
+ extern void __KAI_KMPC_CONVENTION omp_destroy_allocator(omp_allocator_handle_t allocator);
+
+ extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(omp_allocator_handle_t a);
+ extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_get_default_allocator(void);
+# ifdef __cplusplus
+ extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a = omp_null_allocator);
+ extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator);
+# else
+ extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a);
+ extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a);
+# endif
/* OpenMP 5.0 Affinity Format */
extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *);
@@ -249,6 +335,26 @@
extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *);
extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *);
+ /* OpenMP 5.0 events */
+# if defined(_WIN32)
+ // On Windows cl and icl do not support 64-bit enum, let's use integer then.
+ typedef omp_uintptr_t omp_event_handle_t;
+# else
+ typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t;
+# endif
+ extern void __KAI_KMPC_CONVENTION omp_fulfill_event ( omp_event_handle_t event );
+
+ /* OpenMP 5.0 Pause Resources */
+ typedef enum omp_pause_resource_t {
+ omp_pause_resume = 0,
+ omp_pause_soft = 1,
+ omp_pause_hard = 2
+ } omp_pause_resource_t;
+ extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int);
+ extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t);
+
+ extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void);
+
# undef __KAI_KMPC_CONVENTION
# undef __KMP_IMP
diff --git a/runtime/src/include/50/omp_lib.f.var b/runtime/src/include/omp_lib.f.var
index bebb6e9de942..19f14d75f21c 100644
--- a/runtime/src/include/50/omp_lib.f.var
+++ b/runtime/src/include/omp_lib.f.var
@@ -1,12 +1,11 @@
-! include/50/omp_lib.f.var
+! include/omp_lib.f.var
!
!//===----------------------------------------------------------------------===//
!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
+!// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+!// See https://llvm.org/LICENSE.txt for license information.
+!// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
!//
!//===----------------------------------------------------------------------===//
!
@@ -34,7 +33,19 @@
integer, parameter :: omp_lock_hint_kind = omp_integer_kind
integer, parameter :: omp_control_tool_kind = omp_integer_kind
integer, parameter :: omp_control_tool_result_kind = omp_integer_kind
- integer, parameter :: omp_allocator_kind = int_ptr_kind()
+ integer, parameter :: omp_allocator_handle_kind = int_ptr_kind()
+ integer, parameter :: omp_memspace_handle_kind = int_ptr_kind()
+ integer, parameter :: omp_alloctrait_key_kind = omp_integer_kind
+ integer, parameter :: omp_alloctrait_val_kind = int_ptr_kind()
+
+ type omp_alloctrait
+ integer(kind=omp_alloctrait_key_kind) key
+ integer(kind=omp_alloctrait_val_kind) value
+ end type omp_alloctrait
+
+ integer, parameter :: omp_pause_resource_kind = omp_integer_kind
+ integer, parameter :: omp_depend_kind = int_ptr_kind()
+ integer, parameter :: omp_event_handle_kind = int_ptr_kind()
end module omp_lib_kinds
@@ -52,6 +63,7 @@
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
+ integer(kind=omp_sched_kind), parameter :: omp_sched_monotonic = Z'80000000'
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
@@ -73,15 +85,54 @@
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
- integer (kind=omp_allocator_kind), parameter :: omp_null_allocator = 0
- integer (kind=omp_allocator_kind), parameter :: omp_default_mem_alloc = 1
- integer (kind=omp_allocator_kind), parameter :: omp_large_cap_mem_alloc = 2
- integer (kind=omp_allocator_kind), parameter :: omp_const_mem_alloc = 3
- integer (kind=omp_allocator_kind), parameter :: omp_high_bw_mem_alloc = 4
- integer (kind=omp_allocator_kind), parameter :: omp_low_lat_mem_alloc = 5
- integer (kind=omp_allocator_kind), parameter :: omp_cgroup_mem_alloc = 6
- integer (kind=omp_allocator_kind), parameter :: omp_pteam_mem_alloc = 7
- integer (kind=omp_allocator_kind), parameter :: omp_thread_mem_alloc = 8
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_threadmodel = 1
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_alignment = 2
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_access = 3
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_pool_size = 4
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_fallback = 5
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_fb_data = 6
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_pinned = 7
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_partition = 8
+
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_false = 0
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_true = 1
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_default = 2
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_contended = 3
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_uncontended = 4
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_sequential = 5
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_private = 6
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_all = 7
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_thread = 8
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_pteam = 9
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_cgroup = 10
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_default_mem_fb = 11
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_null_fb = 12
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_abort_fb = 13
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_allocator_fb = 14
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_environment = 15
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_nearest = 16
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_blocked = 17
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_interleaved = 18
+
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_null_allocator = 0
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_default_mem_alloc = 1
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_large_cap_mem_alloc = 2
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_const_mem_alloc = 3
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_high_bw_mem_alloc = 4
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_low_lat_mem_alloc = 5
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_cgroup_mem_alloc = 6
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_pteam_mem_alloc = 7
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_thread_mem_alloc = 8
+
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_default_mem_space = 0
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_large_cap_mem_space = 1
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_const_mem_space = 2
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_high_bw_mem_space = 3
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_low_lat_mem_space = 4
+
+ integer (kind=omp_pause_resource_kind), parameter :: omp_pause_resume = 0
+ integer (kind=omp_pause_resource_kind), parameter :: omp_pause_soft = 1
+ integer (kind=omp_pause_resource_kind), parameter :: omp_pause_hard = 2
interface
@@ -283,6 +334,29 @@
integer (kind=omp_integer_kind) omp_get_device_num
end function omp_get_device_num
+ function omp_pause_resource(kind, device_num)
+ use omp_lib_kinds
+ integer (kind=omp_pause_resource_kind) kind
+ integer (kind=omp_integer_kind) device_num
+ integer (kind=omp_integer_kind) omp_pause_resource
+ end function omp_pause_resource
+
+ function omp_pause_resource_all(kind)
+ use omp_lib_kinds
+ integer (kind=omp_pause_resource_kind) kind
+ integer (kind=omp_integer_kind) omp_pause_resource_all
+ end function omp_pause_resource_all
+
+ function omp_get_supported_active_levels()
+ use omp_lib_kinds
+ integer (kind=omp_integer_kind) omp_get_supported_active_levels
+ end function omp_get_supported_active_levels
+
+ subroutine omp_fulfill_event(event)
+ use omp_lib_kinds
+ integer (kind=omp_event_handle_kind) event
+ end subroutine omp_fulfill_event
+
subroutine omp_init_lock(svar)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_init_lock
@@ -370,14 +444,27 @@
integer (kind=omp_integer_kind) omp_get_max_task_priority
end function omp_get_max_task_priority
- subroutine omp_set_default_allocator(svar)
+ function omp_init_allocator(memspace, ntraits, traits)
+ use omp_lib_kinds
+ integer (omp_allocator_handle_kind) omp_init_allocator
+ integer (omp_memspace_handle_kind) :: memspace
+ integer (omp_integer_kind) :: ntraits
+ type(omp_alloctrait), intent(in) :: traits(*)
+ end function omp_init_allocator
+
+ subroutine omp_destroy_allocator(allocator) bind(c)
+ use omp_lib_kinds
+ integer (omp_allocator_handle_kind), value :: allocator
+ end subroutine omp_destroy_allocator
+
+ subroutine omp_set_default_allocator(allocator) bind(c)
use omp_lib_kinds
- integer (kind=omp_allocator_kind) svar
+ integer (omp_allocator_handle_kind) allocator
end subroutine omp_set_default_allocator
- function omp_get_default_allocator()
+ function omp_get_default_allocator() bind(c)
use omp_lib_kinds
- integer (kind=omp_allocator_kind) omp_get_default_allocator
+ integer(omp_allocator_handle_kind)omp_get_default_allocator
end function omp_get_default_allocator
subroutine omp_set_affinity_format(format)
@@ -621,6 +708,11 @@
!dec$ attributes alias:'OMP_GET_INITIAL_DEVICE' :: omp_get_initial_device
!dec$ attributes alias:'OMP_GET_MAX_TASK_PRIORITY' :: omp_get_max_task_priority
!dec$ attributes alias:'OMP_GET_DEVICE_NUM' :: omp_get_device_num
+!dec$ attributes alias:'OMP_PAUSE_RESOURCE' :: omp_pause_resource
+!dec$ attributes alias:'OMP_PAUSE_RESOURCE_ALL' :: omp_pause_resource_all
+!dec$ attributes alias:'OMP_GET_SUPPORTED_ACTIVE_LEVELS' :: omp_get_supported_active_levels
+!dec$ attributes alias:'OMP_FULFILL_EVENT' :: omp_fulfill_event
+
!dec$ attributes alias:'OMP_CONTROL_TOOL' :: omp_control_tool
!dec$ attributes alias:'OMP_SET_AFFINITY_FORMAT' :: omp_set_affinity_format
!dec$ attributes alias:'OMP_GET_AFFINITY_FORMAT' :: omp_get_affinity_format
@@ -708,6 +800,11 @@
!dec$ attributes alias:'_OMP_GET_INITIAL_DEVICE' :: omp_get_initial_device
!dec$ attributes alias:'_OMP_GET_MAX_TASK_PRIORTY' :: omp_get_max_task_priority
!dec$ attributes alias:'_OMP_GET_DEVICE_NUM' :: omp_get_device_num
+!dec$ attributes alias:'_OMP_PAUSE_RESOURCE' :: omp_pause_resource
+!dec$ attributes alias:'_OMP_PAUSE_RESOURCE_ALL' :: omp_pause_resource_all
+!dec$ attributes alias:'_OMP_GET_SUPPORTED_ACTIVE_LEVELS' :: omp_get_supported_active_levels
+!dec$ attributes alias:'_OMP_FULFILL_EVENT' :: omp_fulfill_event
+
!dec$ attributes alias:'_OMP_CONTROL_TOOL' :: omp_control_tool
!dec$ attributes alias:'_OMP_SET_AFFINITY_FORMAT' :: omp_set_affinity_format
!dec$ attributes alias:'_OMP_GET_AFFINITY_FORMAT' :: omp_get_affinity_format
@@ -798,6 +895,11 @@
!dec$ attributes alias:'omp_get_initial_device_'::omp_get_initial_device
!dec$ attributes alias:'omp_get_max_task_priority_'::omp_get_max_task_priority
!dec$ attributes alias:'omp_get_device_num_'::omp_get_device_num
+!dec$ attributes alias:'omp_pause_resource_' :: omp_pause_resource
+!dec$ attributes alias:'omp_pause_resource_all_' :: omp_pause_resource_all
+!dec$ attributes alias:'omp_get_supported_active_levels_' :: omp_get_supported_active_levels
+!dec$ attributes alias:'omp_fulfill_event_' :: omp_fulfill_event
+
!dec$ attributes alias:'omp_set_affinity_format_' :: omp_set_affinity_format
!dec$ attributes alias:'omp_get_affinity_format_' :: omp_get_affinity_format
!dec$ attributes alias:'omp_display_affinity_' :: omp_display_affinity
@@ -887,6 +989,11 @@
!dec$ attributes alias:'_omp_get_initial_device_'::omp_get_initial_device
!dec$ attributes alias:'_omp_get_max_task_priorty_'::omp_get_max_task_priority
!dec$ attributes alias:'_omp_get_device_num_'::omp_get_device_num
+!dec$ attributes alias:'_omp_pause_resource_' :: omp_pause_resource
+!dec$ attributes alias:'_omp_pause_resource_all_' :: omp_pause_resource_all
+!dec$ attributes alias:'_omp_get_supported_active_levels_' :: omp_get_supported_active_levels
+!dec$ attributes alias:'_omp_fulfill_event_' :: omp_fulfill_event
+
!dec$ attributes alias:'_omp_init_lock_'::omp_init_lock
!dec$ attributes alias:'_omp_init_lock_with_hint_'::omp_init_lock_with_hint
!dec$ attributes alias:'_omp_destroy_lock_'::omp_destroy_lock
diff --git a/runtime/src/include/50/omp_lib.f90.var b/runtime/src/include/omp_lib.f90.var
index e0233de81d78..ac568486d204 100644
--- a/runtime/src/include/50/omp_lib.f90.var
+++ b/runtime/src/include/omp_lib.f90.var
@@ -1,12 +1,11 @@
-! include/50/omp_lib.f90.var
+! include/omp_lib.f90.var
!
!//===----------------------------------------------------------------------===//
!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
+!// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+!// See https://llvm.org/LICENSE.txt for license information.
+!// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
!//
!//===----------------------------------------------------------------------===//
!
@@ -31,7 +30,19 @@
integer, parameter :: omp_lock_hint_kind = omp_sync_hint_kind
integer, parameter :: omp_control_tool_kind = omp_integer_kind
integer, parameter :: omp_control_tool_result_kind = omp_integer_kind
- integer, parameter :: omp_allocator_kind = c_intptr_t
+ integer, parameter :: omp_allocator_handle_kind = c_intptr_t
+ integer, parameter :: omp_memspace_handle_kind = c_intptr_t
+ integer, parameter :: omp_alloctrait_key_kind = omp_integer_kind
+ integer, parameter :: omp_alloctrait_val_kind = c_intptr_t
+
+ type omp_alloctrait
+ integer(kind=omp_alloctrait_key_kind) key
+ integer(kind=omp_alloctrait_val_kind) value
+ end type omp_alloctrait
+
+ integer, parameter :: omp_pause_resource_kind = omp_integer_kind
+ integer, parameter :: omp_depend_kind = c_intptr_t
+ integer, parameter :: omp_event_handle_kind = c_intptr_t
end module omp_lib_kinds
@@ -50,7 +61,7 @@
integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2
integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3
integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4
-
+ integer(kind=omp_sched_kind), parameter :: omp_sched_monotonic = int(Z'80000000', kind=omp_sched_kind)
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0
integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1
@@ -87,15 +98,54 @@
integer (kind=omp_control_tool_result_kind), parameter :: omp_control_tool_success = 0
integer (kind=omp_control_tool_result_kind), parameter :: omp_control_tool_ignored = 1
- integer (kind=omp_allocator_kind), parameter :: omp_null_allocator = 0
- integer (kind=omp_allocator_kind), parameter :: omp_default_mem_alloc = 1
- integer (kind=omp_allocator_kind), parameter :: omp_large_cap_mem_alloc = 2
- integer (kind=omp_allocator_kind), parameter :: omp_const_mem_alloc = 3
- integer (kind=omp_allocator_kind), parameter :: omp_high_bw_mem_alloc = 4
- integer (kind=omp_allocator_kind), parameter :: omp_low_lat_mem_alloc = 5
- integer (kind=omp_allocator_kind), parameter :: omp_cgroup_mem_alloc = 6
- integer (kind=omp_allocator_kind), parameter :: omp_pteam_mem_alloc = 7
- integer (kind=omp_allocator_kind), parameter :: omp_thread_mem_alloc = 8
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_threadmodel = 1
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_alignment = 2
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_access = 3
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_pool_size = 4
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_fallback = 5
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_fb_data = 6
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_pinned = 7
+ integer (kind=omp_alloctrait_key_kind), parameter :: omp_atk_partition = 8
+
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_false = 0
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_true = 1
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_default = 2
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_contended = 3
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_uncontended = 4
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_sequential = 5
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_private = 6
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_all = 7
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_thread = 8
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_pteam = 9
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_cgroup = 10
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_default_mem_fb = 11
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_null_fb = 12
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_abort_fb = 13
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_allocator_fb = 14
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_environment = 15
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_nearest = 16
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_blocked = 17
+ integer (kind=omp_alloctrait_val_kind), parameter :: omp_atv_interleaved = 18
+
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_null_allocator = 0
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_default_mem_alloc = 1
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_large_cap_mem_alloc = 2
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_const_mem_alloc = 3
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_high_bw_mem_alloc = 4
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_low_lat_mem_alloc = 5
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_cgroup_mem_alloc = 6
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_pteam_mem_alloc = 7
+ integer (kind=omp_allocator_handle_kind), parameter :: omp_thread_mem_alloc = 8
+
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_default_mem_space = 0
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_large_cap_mem_space = 1
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_const_mem_space = 2
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_high_bw_mem_space = 3
+ integer (kind=omp_memspace_handle_kind), parameter :: omp_low_lat_mem_space = 4
+
+ integer (kind=omp_pause_resource_kind), parameter :: omp_pause_resume = 0
+ integer (kind=omp_pause_resource_kind), parameter :: omp_pause_soft = 1
+ integer (kind=omp_pause_resource_kind), parameter :: omp_pause_hard = 2
interface
@@ -299,6 +349,29 @@
integer (kind=omp_integer_kind) omp_get_device_num
end function omp_get_device_num
+ function omp_pause_resource(kind, device_num) bind(c)
+ use omp_lib_kinds
+ integer (kind=omp_pause_resource_kind), value :: kind
+ integer (kind=omp_integer_kind), value :: device_num
+ integer (kind=omp_integer_kind) omp_pause_resource
+ end function omp_pause_resource
+
+ function omp_pause_resource_all(kind) bind(c)
+ use omp_lib_kinds
+ integer (kind=omp_pause_resource_kind), value :: kind
+ integer (kind=omp_integer_kind) omp_pause_resource_all
+ end function omp_pause_resource_all
+
+ function omp_get_supported_active_levels() bind(c)
+ use omp_lib_kinds
+ integer (kind=omp_integer_kind) omp_get_supported_active_levels
+ end function omp_get_supported_active_levels
+
+ subroutine omp_fulfill_event(event) bind(c)
+ use omp_lib_kinds
+ integer (kind=omp_event_handle_kind), value :: event
+ end subroutine omp_fulfill_event
+
subroutine omp_init_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_init_lock
@@ -386,14 +459,27 @@
integer (kind=omp_integer_kind) omp_get_max_task_priority
end function omp_get_max_task_priority
- subroutine omp_set_default_allocator(svar) bind(c)
+ function omp_init_allocator(memspace, ntraits, traits)
+ use omp_lib_kinds
+ integer (kind=omp_allocator_handle_kind) omp_init_allocator
+ integer (kind=omp_memspace_handle_kind) :: memspace
+ integer (kind=omp_integer_kind) :: ntraits
+ type(omp_alloctrait), intent(in) :: traits(*)
+ end function omp_init_allocator
+
+ subroutine omp_destroy_allocator(allocator) bind(c)
+ use omp_lib_kinds
+ integer (kind=omp_allocator_handle_kind), value :: allocator
+ end subroutine omp_destroy_allocator
+
+ subroutine omp_set_default_allocator(allocator) bind(c)
use omp_lib_kinds
- integer (kind=omp_allocator_kind), value :: svar
+ integer (kind=omp_allocator_handle_kind), value :: allocator
end subroutine omp_set_default_allocator
function omp_get_default_allocator() bind(c)
use omp_lib_kinds
- integer (kind=omp_allocator_kind) omp_get_default_allocator
+ integer (kind=omp_allocator_handle_kind) omp_get_default_allocator
end function omp_get_default_allocator
subroutine omp_set_affinity_format(format)
diff --git a/runtime/src/include/50/omp_lib.h.var b/runtime/src/include/omp_lib.h.var
index 605b410dd827..8775128157bd 100644
--- a/runtime/src/include/50/omp_lib.h.var
+++ b/runtime/src/include/omp_lib.h.var
@@ -1,12 +1,11 @@
-! include/50/omp_lib.h.var
+! include/omp_lib.h.var
!
!//===----------------------------------------------------------------------===//
!//
-!// The LLVM Compiler Infrastructure
-!//
-!// This file is dual licensed under the MIT and the University of Illinois Open
-!// Source Licenses. See LICENSE.txt for details.
+!// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+!// See https://llvm.org/LICENSE.txt for license information.
+!// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
!//
!//===----------------------------------------------------------------------===//
!
@@ -39,8 +38,20 @@
parameter(omp_control_tool_kind=omp_integer_kind)
integer omp_control_tool_result_kind
parameter(omp_control_tool_result_kind=omp_integer_kind)
- integer omp_allocator_kind
- parameter(omp_allocator_kind=int_ptr_kind())
+ integer omp_allocator_handle_kind
+ parameter(omp_allocator_handle_kind=int_ptr_kind())
+ integer omp_memspace_handle_kind
+ parameter(omp_memspace_handle_kind=int_ptr_kind())
+ integer omp_alloctrait_key_kind
+ parameter(omp_alloctrait_key_kind=omp_integer_kind)
+ integer omp_alloctrait_val_kind
+ parameter(omp_alloctrait_val_kind=int_ptr_kind())
+ integer omp_pause_resource_kind
+ parameter(omp_pause_resource_kind=omp_integer_kind)
+ integer omp_depend_kind
+ parameter(omp_depend_kind=int_ptr_kind())
+ integer omp_event_handle_kind
+ parameter(omp_event_handle_kind=int_ptr_kind())
integer(kind=omp_integer_kind)openmp_version
parameter(openmp_version=@LIBOMP_OMP_YEAR_MONTH@)
@@ -61,6 +72,8 @@
parameter(omp_sched_guided=3)
integer(kind=omp_sched_kind)omp_sched_auto
parameter(omp_sched_auto=4)
+ integer(kind=omp_sched_kind)omp_sched_monotonic
+ parameter(omp_sched_monotonic=Z'80000000')
integer(kind=omp_proc_bind_kind)omp_proc_bind_false
parameter(omp_proc_bind_false=0)
@@ -118,25 +131,106 @@
integer(omp_control_tool_result_kind)omp_control_tool_ignored
parameter(omp_control_tool_ignored=1)
- integer(kind=omp_allocator_kind)omp_null_allocator
+ integer(kind=omp_alloctrait_key_kind)omp_atk_threadmodel
+ parameter(omp_atk_threadmodel=1)
+ integer(kind=omp_alloctrait_key_kind)omp_atk_alignment
+ parameter(omp_atk_alignment=2)
+ integer(kind=omp_alloctrait_key_kind)omp_atk_access
+ parameter(omp_atk_access=3)
+ integer(kind=omp_alloctrait_key_kind)omp_atk_pool_size
+ parameter(omp_atk_pool_size=4)
+ integer(kind=omp_alloctrait_key_kind)omp_atk_fallback
+ parameter(omp_atk_fallback=5)
+ integer(kind=omp_alloctrait_key_kind)omp_atk_fb_data
+ parameter(omp_atk_fb_data=6)
+ integer(kind=omp_alloctrait_key_kind)omp_atk_pinned
+ parameter(omp_atk_pinned=7)
+ integer(kind=omp_alloctrait_key_kind)omp_atk_partition
+ parameter(omp_atk_partition=8)
+
+ ! Reserved for future use
+ integer(kind=omp_alloctrait_val_kind)omp_atv_false
+ parameter(omp_atv_false=0)
+ ! Reserved for future use
+ integer(kind=omp_alloctrait_val_kind)omp_atv_true
+ parameter(omp_atv_true=1)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_default
+ parameter(omp_atv_default=2)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_contended
+ parameter(omp_atv_contended=3)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_uncontended
+ parameter(omp_atv_uncontended=4)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_sequential
+ parameter(omp_atv_sequential=5)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_private
+ parameter(omp_atv_private=6)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_all
+ parameter(omp_atv_all=7)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_thread
+ parameter(omp_atv_thread=8)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_pteam
+ parameter(omp_atv_pteam=9)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_cgroup
+ parameter(omp_atv_cgroup=10)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_default_mem_fb
+ parameter(omp_atv_default_mem_fb=11)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_null_fb
+ parameter(omp_atv_null_fb=12)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_abort_fb
+ parameter(omp_atv_abort_fb=13)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_allocator_fb
+ parameter(omp_atv_allocator_fb=14)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_environment
+ parameter(omp_atv_environment=15)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_nearest
+ parameter(omp_atv_nearest=16)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_blocked
+ parameter(omp_atv_blocked=17)
+ integer(kind=omp_alloctrait_val_kind)omp_atv_interleaved
+ parameter(omp_atv_interleaved=18)
+
+ type omp_alloctrait
+ integer (kind=omp_alloctrait_key_kind) key
+ integer (kind=omp_alloctrait_val_kind) value
+ end type omp_alloctrait
+
+ integer(kind=omp_allocator_handle_kind)omp_null_allocator
parameter(omp_null_allocator=0)
- integer(kind=omp_allocator_kind)omp_default_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_default_mem_alloc
parameter(omp_default_mem_alloc=1)
- integer(kind=omp_allocator_kind)omp_large_cap_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_large_cap_mem_alloc
parameter(omp_large_cap_mem_alloc=2)
- integer(kind=omp_allocator_kind)omp_const_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_const_mem_alloc
parameter(omp_const_mem_alloc=3)
- integer(kind=omp_allocator_kind)omp_high_bw_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_high_bw_mem_alloc
parameter(omp_high_bw_mem_alloc=4)
- integer(kind=omp_allocator_kind)omp_low_lat_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_low_lat_mem_alloc
parameter(omp_low_lat_mem_alloc=5)
- integer(kind=omp_allocator_kind)omp_cgroup_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_cgroup_mem_alloc
parameter(omp_cgroup_mem_alloc=6)
- integer(kind=omp_allocator_kind)omp_pteam_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_pteam_mem_alloc
parameter(omp_pteam_mem_alloc=7)
- integer(kind=omp_allocator_kind)omp_thread_mem_alloc
+ integer(kind=omp_allocator_handle_kind)omp_thread_mem_alloc
parameter(omp_thread_mem_alloc=8)
+ integer(kind=omp_memspace_handle_kind)omp_default_mem_space
+ parameter(omp_default_mem_space=0)
+ integer(kind=omp_memspace_handle_kind)omp_large_cap_mem_space
+ parameter(omp_large_cap_mem_space=1)
+ integer(kind=omp_memspace_handle_kind)omp_const_mem_space
+ parameter(omp_const_mem_space=2)
+ integer(kind=omp_memspace_handle_kind)omp_high_bw_mem_space
+ parameter(omp_high_bw_mem_space=3)
+ integer(kind=omp_memspace_handle_kind)omp_low_lat_mem_space
+ parameter(omp_low_lat_mem_space=4)
+
+ integer(kind=omp_pause_resource_kind)omp_pause_resume
+ parameter(omp_pause_resume=0)
+ integer(kind=omp_pause_resource_kind)omp_pause_soft
+ parameter(omp_pause_soft=1)
+ integer(kind=omp_pause_resource_kind)omp_pause_hard
+ parameter(omp_pause_hard=2)
+
interface
! ***
@@ -332,6 +426,29 @@
integer (kind=omp_integer_kind) omp_get_device_num
end function omp_get_device_num
+ function omp_pause_resource(kind, device_num) bind(c)
+ import
+ integer (kind=omp_pause_resource_kind), value :: kind
+ integer (kind=omp_integer_kind), value :: device_num
+ integer (kind=omp_integer_kind) omp_pause_resource
+ end function omp_pause_resource
+
+ function omp_pause_resource_all(kind) bind(c)
+ import
+ integer (kind=omp_pause_resource_kind), value :: kind
+ integer (kind=omp_integer_kind) omp_pause_resource_all
+ end function omp_pause_resource_all
+
+ function omp_get_supported_active_levels() bind(c)
+ import
+ integer (kind=omp_integer_kind) omp_get_supported_active_levels
+ end function omp_get_supported_active_levels
+
+ subroutine omp_fulfill_event(event) bind(c)
+ import
+ integer (kind=omp_event_handle_kind), value :: event
+ end subroutine omp_fulfill_event
+
subroutine omp_init_lock(svar) bind(c)
!DIR$ IF(__INTEL_COMPILER.GE.1400)
!DIR$ attributes known_intrinsic :: omp_init_lock
@@ -419,14 +536,27 @@
integer (kind=omp_integer_kind) omp_get_max_task_priority
end function omp_get_max_task_priority
- subroutine omp_set_default_allocator(svar) bind(c)
+ function omp_init_allocator(memspace, ntraits, traits)
+ import
+ integer (omp_allocator_handle_kind) omp_init_allocator
+ integer (omp_memspace_handle_kind) :: memspace
+ integer (omp_integer_kind) :: ntraits
+ type(omp_alloctrait), intent(in) :: traits(*)
+ end function omp_init_allocator
+
+ subroutine omp_destroy_allocator(allocator) bind(c)
+ import
+ integer (omp_allocator_handle_kind), value :: allocator
+ end subroutine omp_destroy_allocator
+
+ subroutine omp_set_default_allocator(allocator) bind(c)
import
- integer (kind=omp_allocator_kind), value :: svar
+ integer (omp_allocator_handle_kind), value :: allocator
end subroutine omp_set_default_allocator
function omp_get_default_allocator() bind(c)
import
- integer (kind=omp_allocator_kind) omp_get_default_allocator
+ integer (omp_allocator_handle_kind) omp_get_default_allocator
end function omp_get_default_allocator
subroutine omp_set_affinity_format(format)
@@ -652,6 +782,10 @@
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_initial_device
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_num
+!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource
+!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource_all
+!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_supported_active_levels
+!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_fulfill_event
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_teams
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_team_num
!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_init_lock
@@ -731,6 +865,10 @@
!$omp declare target(omp_get_initial_device )
!$omp declare target(omp_get_num_devices )
!$omp declare target(omp_get_device_num )
+!$omp declare target(omp_pause_resource )
+!$omp declare target(omp_pause_resource_all )
+!$omp declare target(omp_get_supported_active_levels )
+!$omp declare target(omp_fulfill_event)
!$omp declare target(omp_get_num_teams )
!$omp declare target(omp_get_team_num )
!$omp declare target(omp_init_lock )
diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h
index 599cbf23a584..fdb9dbb51981 100644
--- a/runtime/src/kmp.h
+++ b/runtime/src/kmp.h
@@ -5,10 +5,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -49,6 +48,8 @@
#define TASK_IMPLICIT 0
#define TASK_PROXY 1
#define TASK_FULL 0
+#define TASK_DETACHABLE 1
+#define TASK_UNDETACHABLE 0
#define KMP_CANCEL_THREADS
#define KMP_THREAD_ATTR
@@ -97,6 +98,12 @@ class kmp_stats_list;
#ifndef HWLOC_OBJ_PACKAGE
#define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET
#endif
+#if HWLOC_API_VERSION >= 0x00020000
+// hwloc 2.0 changed type of depth of object from unsigned to int
+typedef int kmp_hwloc_depth_t;
+#else
+typedef unsigned int kmp_hwloc_depth_t;
+#endif
#endif
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
@@ -129,10 +136,8 @@ class kmp_stats_list;
#include "ompt-internal.h"
#endif
-#if OMP_50_ENABLED
// Affinity format function
#include "kmp_str.h"
-#endif
// 0 - no fast memory allocation, alignment: 8-byte on x86, 16-byte on x64.
// 3 - fast allocation using sync, non-sync free lists of any size, non-self
@@ -146,15 +151,8 @@ class kmp_stats_list;
#define USE_NESTED_HOT_ARG(x)
#else
#if KMP_NESTED_HOT_TEAMS
-#if OMP_40_ENABLED
#define USE_NESTED_HOT_ARG(x) , x
#else
-// Nested hot teams feature depends on omp 4.0, disable it for earlier versions
-#undef KMP_NESTED_HOT_TEAMS
-#define KMP_NESTED_HOT_TEAMS 0
-#define USE_NESTED_HOT_ARG(x)
-#endif
-#else
#define USE_NESTED_HOT_ARG(x)
#endif
#endif
@@ -326,7 +324,8 @@ typedef enum kmp_sched {
kmp_sched_static_steal = 102, // mapped to kmp_sch_static_steal (44)
#endif
kmp_sched_upper,
- kmp_sched_default = kmp_sched_static // default scheduling
+ kmp_sched_default = kmp_sched_static, // default scheduling
+ kmp_sched_monotonic = 0x80000000
} kmp_sched_t;
#endif
@@ -353,12 +352,10 @@ enum sched_type : kmp_int32 {
/* accessible only through KMP_SCHEDULE environment variable */
kmp_sch_static_steal = 44,
-#if OMP_45_ENABLED
/* static with chunk adjustment (e.g., simd) */
kmp_sch_static_balanced_chunked = 45,
kmp_sch_guided_simd = 46, /**< guided with chunk adjustment */
kmp_sch_runtime_simd = 47, /**< runtime with chunk adjustment */
-#endif
/* accessible only through KMP_SCHEDULE environment variable */
kmp_sch_upper, /**< upper bound for unordered values */
@@ -373,11 +370,9 @@ enum sched_type : kmp_int32 {
kmp_ord_trapezoidal = 71,
kmp_ord_upper, /**< upper bound for ordered values */
-#if OMP_40_ENABLED
/* Schedules for Distribute construct */
kmp_distribute_static_chunked = 91, /**< distribute static chunked */
kmp_distribute_static = 92, /**< distribute static unspecialized */
-#endif
/* For the "nomerge" versions, kmp_dispatch_next*() will always return a
single iteration/chunk, even if the loop is serialized. For the schedule
@@ -412,7 +407,6 @@ enum sched_type : kmp_int32 {
kmp_nm_ord_trapezoidal = 199,
kmp_nm_upper, /**< upper bound for nomerge values */
-#if OMP_45_ENABLED
/* Support for OpenMP 4.5 monotonic and nonmonotonic schedule modifiers. Since
we need to distinguish the three possible cases (no modifier, monotonic
modifier, nonmonotonic modifier), we need separate bits for each modifier.
@@ -439,19 +433,41 @@ enum sched_type : kmp_int32 {
#define SCHEDULE_HAS_NONMONOTONIC(s) (((s)&kmp_sch_modifier_nonmonotonic) != 0)
#define SCHEDULE_HAS_NO_MODIFIERS(s) \
(((s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)) == 0)
-#else
-/* By doing this we hope to avoid multiple tests on OMP_45_ENABLED. Compilers
- can now eliminate tests on compile time constants and dead code that results
- from them, so we can leave code guarded by such an if in place. */
-#define SCHEDULE_WITHOUT_MODIFIERS(s) (s)
-#define SCHEDULE_HAS_MONOTONIC(s) false
-#define SCHEDULE_HAS_NONMONOTONIC(s) false
-#define SCHEDULE_HAS_NO_MODIFIERS(s) true
-#endif
+#define SCHEDULE_GET_MODIFIERS(s) \
+ ((enum sched_type)( \
+ (s) & (kmp_sch_modifier_nonmonotonic | kmp_sch_modifier_monotonic)))
+#define SCHEDULE_SET_MODIFIERS(s, m) \
+ (s = (enum sched_type)((kmp_int32)s | (kmp_int32)m))
+#define SCHEDULE_NONMONOTONIC 0
+#define SCHEDULE_MONOTONIC 1
kmp_sch_default = kmp_sch_static /**< default scheduling algorithm */
};
+// Apply modifiers on internal kind to standard kind
+static inline void
+__kmp_sched_apply_mods_stdkind(kmp_sched_t *kind,
+ enum sched_type internal_kind) {
+ if (SCHEDULE_HAS_MONOTONIC(internal_kind)) {
+ *kind = (kmp_sched_t)((int)*kind | (int)kmp_sched_monotonic);
+ }
+}
+
+// Apply modifiers on standard kind to internal kind
+static inline void
+__kmp_sched_apply_mods_intkind(kmp_sched_t kind,
+ enum sched_type *internal_kind) {
+ if ((int)kind & (int)kmp_sched_monotonic) {
+ *internal_kind = (enum sched_type)((int)*internal_kind |
+ (int)kmp_sch_modifier_monotonic);
+ }
+}
+
+// Get standard schedule without modifiers
+static inline kmp_sched_t __kmp_sched_without_mods(kmp_sched_t kind) {
+ return (kmp_sched_t)((int)kind & ~((int)kmp_sched_monotonic));
+}
+
/* Type to keep runtime schedule set via OMP_SCHEDULE or omp_set_schedule() */
typedef union kmp_r_sched {
struct {
@@ -779,8 +795,6 @@ extern char *__kmp_cpuinfo_file;
#endif /* KMP_AFFINITY_SUPPORTED */
-#if OMP_40_ENABLED
-
// This needs to be kept in sync with the values in omp.h !!!
typedef enum kmp_proc_bind_t {
proc_bind_false = 0,
@@ -800,13 +814,9 @@ typedef struct kmp_nested_proc_bind_t {
extern kmp_nested_proc_bind_t __kmp_nested_proc_bind;
-#endif /* OMP_40_ENABLED */
-
-#if OMP_50_ENABLED
extern int __kmp_display_affinity;
extern char *__kmp_affinity_format;
static const size_t KMP_AFFINITY_FORMAT_SIZE = 512;
-#endif // OMP_50_ENABLED
#if KMP_AFFINITY_SUPPORTED
#define KMP_PLACE_ALL (-1)
@@ -820,7 +830,6 @@ static const size_t KMP_AFFINITY_FORMAT_SIZE = 512;
extern int __kmp_affinity_num_places;
-#if OMP_40_ENABLED
typedef enum kmp_cancel_kind_t {
cancel_noreq = 0,
cancel_parallel = 1,
@@ -828,7 +837,6 @@ typedef enum kmp_cancel_kind_t {
cancel_sections = 3,
cancel_taskgroup = 4
} kmp_cancel_kind_t;
-#endif // OMP_40_ENABLED
// KMP_HW_SUBSET support:
typedef struct kmp_hws_item {
@@ -857,30 +865,99 @@ extern int __kmp_hws_abs_flag; // absolute or per-item number requested
#define KMP_GTID_UNKNOWN (-5) /* Is not known */
#define KMP_GTID_MIN (-6) /* Minimal gtid for low bound check in DEBUG */
-#if OMP_50_ENABLED
/* OpenMP 5.0 Memory Management support */
+
+#ifndef __OMP_H
+// Duplicate type definitios from omp.h
+typedef uintptr_t omp_uintptr_t;
+
+typedef enum {
+ OMP_ATK_THREADMODEL = 1,
+ OMP_ATK_ALIGNMENT = 2,
+ OMP_ATK_ACCESS = 3,
+ OMP_ATK_POOL_SIZE = 4,
+ OMP_ATK_FALLBACK = 5,
+ OMP_ATK_FB_DATA = 6,
+ OMP_ATK_PINNED = 7,
+ OMP_ATK_PARTITION = 8
+} omp_alloctrait_key_t;
+
+typedef enum {
+ OMP_ATV_FALSE = 0,
+ OMP_ATV_TRUE = 1,
+ OMP_ATV_DEFAULT = 2,
+ OMP_ATV_CONTENDED = 3,
+ OMP_ATV_UNCONTENDED = 4,
+ OMP_ATV_SEQUENTIAL = 5,
+ OMP_ATV_PRIVATE = 6,
+ OMP_ATV_ALL = 7,
+ OMP_ATV_THREAD = 8,
+ OMP_ATV_PTEAM = 9,
+ OMP_ATV_CGROUP = 10,
+ OMP_ATV_DEFAULT_MEM_FB = 11,
+ OMP_ATV_NULL_FB = 12,
+ OMP_ATV_ABORT_FB = 13,
+ OMP_ATV_ALLOCATOR_FB = 14,
+ OMP_ATV_ENVIRONMENT = 15,
+ OMP_ATV_NEAREST = 16,
+ OMP_ATV_BLOCKED = 17,
+ OMP_ATV_INTERLEAVED = 18
+} omp_alloctrait_value_t;
+
+typedef void *omp_memspace_handle_t;
+extern omp_memspace_handle_t const omp_default_mem_space;
+extern omp_memspace_handle_t const omp_large_cap_mem_space;
+extern omp_memspace_handle_t const omp_const_mem_space;
+extern omp_memspace_handle_t const omp_high_bw_mem_space;
+extern omp_memspace_handle_t const omp_low_lat_mem_space;
+
+typedef struct {
+ omp_alloctrait_key_t key;
+ omp_uintptr_t value;
+} omp_alloctrait_t;
+
+typedef void *omp_allocator_handle_t;
+extern omp_allocator_handle_t const omp_null_allocator;
+extern omp_allocator_handle_t const omp_default_mem_alloc;
+extern omp_allocator_handle_t const omp_large_cap_mem_alloc;
+extern omp_allocator_handle_t const omp_const_mem_alloc;
+extern omp_allocator_handle_t const omp_high_bw_mem_alloc;
+extern omp_allocator_handle_t const omp_low_lat_mem_alloc;
+extern omp_allocator_handle_t const omp_cgroup_mem_alloc;
+extern omp_allocator_handle_t const omp_pteam_mem_alloc;
+extern omp_allocator_handle_t const omp_thread_mem_alloc;
+extern omp_allocator_handle_t const kmp_max_mem_alloc;
+extern omp_allocator_handle_t __kmp_def_allocator;
+
+// end of duplicate type definitios from omp.h
+#endif
+
extern int __kmp_memkind_available;
-extern int __kmp_hbw_mem_available;
-typedef void *omp_allocator_t;
-extern const omp_allocator_t *OMP_NULL_ALLOCATOR;
-extern const omp_allocator_t *omp_default_mem_alloc;
-extern const omp_allocator_t *omp_large_cap_mem_alloc;
-extern const omp_allocator_t *omp_const_mem_alloc;
-extern const omp_allocator_t *omp_high_bw_mem_alloc;
-extern const omp_allocator_t *omp_low_lat_mem_alloc;
-extern const omp_allocator_t *omp_cgroup_mem_alloc;
-extern const omp_allocator_t *omp_pteam_mem_alloc;
-extern const omp_allocator_t *omp_thread_mem_alloc;
-extern const omp_allocator_t *__kmp_def_allocator;
-
-extern void __kmpc_set_default_allocator(int gtid, const omp_allocator_t *al);
-extern const omp_allocator_t *__kmpc_get_default_allocator(int gtid);
-extern void *__kmpc_alloc(int gtid, size_t sz, const omp_allocator_t *al);
-extern void __kmpc_free(int gtid, void *ptr, const omp_allocator_t *al);
+
+typedef omp_memspace_handle_t kmp_memspace_t; // placeholder
+
+typedef struct kmp_allocator_t {
+ omp_memspace_handle_t memspace;
+ void **memkind; // pointer to memkind
+ int alignment;
+ omp_alloctrait_value_t fb;
+ kmp_allocator_t *fb_data;
+ kmp_uint64 pool_size;
+ kmp_uint64 pool_used;
+} kmp_allocator_t;
+
+extern omp_allocator_handle_t __kmpc_init_allocator(int gtid,
+ omp_memspace_handle_t,
+ int ntraits,
+ omp_alloctrait_t traits[]);
+extern void __kmpc_destroy_allocator(int gtid, omp_allocator_handle_t al);
+extern void __kmpc_set_default_allocator(int gtid, omp_allocator_handle_t al);
+extern omp_allocator_handle_t __kmpc_get_default_allocator(int gtid);
+extern void *__kmpc_alloc(int gtid, size_t sz, omp_allocator_handle_t al);
+extern void __kmpc_free(int gtid, void *ptr, omp_allocator_handle_t al);
extern void __kmp_init_memkind();
extern void __kmp_fini_memkind();
-#endif // OMP_50_ENABLED
/* ------------------------------------------------------------------------ */
@@ -982,10 +1059,6 @@ extern kmp_uint64 __kmp_now_nsec();
(KMP_BLOCKTIME(team, tid) * KMP_USEC_PER_SEC)
#define KMP_BLOCKING(goal, count) ((count) % 1000 != 0 || (goal) > KMP_NOW())
#endif
-#define KMP_YIELD_NOW() \
- (KMP_NOW_MSEC() / KMP_MAX(__kmp_dflt_blocktime, 1) % \
- (__kmp_yield_on_count + __kmp_yield_off_count) < \
- (kmp_uint32)__kmp_yield_on_count)
#endif // KMP_USE_MONITOR
#define KMP_MIN_STATSCOLS 40
@@ -1000,14 +1073,6 @@ extern kmp_uint64 __kmp_now_nsec();
#define KMP_MAX_CHUNK (INT_MAX - 1)
#define KMP_DEFAULT_CHUNK 1
-#define KMP_MIN_INIT_WAIT 1
-#define KMP_MAX_INIT_WAIT (INT_MAX / 2)
-#define KMP_DEFAULT_INIT_WAIT 2048U
-
-#define KMP_MIN_NEXT_WAIT 1
-#define KMP_MAX_NEXT_WAIT (INT_MAX / 2)
-#define KMP_DEFAULT_NEXT_WAIT 1024U
-
#define KMP_DFLT_DISP_NUM_BUFF 7
#define KMP_MAX_ORDERED 8
@@ -1086,12 +1151,87 @@ typedef struct kmp_cpuid {
kmp_uint32 ecx;
kmp_uint32 edx;
} kmp_cpuid_t;
+
+typedef struct kmp_cpuinfo {
+ int initialized; // If 0, other fields are not initialized.
+ int signature; // CPUID(1).EAX
+ int family; // CPUID(1).EAX[27:20]+CPUID(1).EAX[11:8] (Extended Family+Family)
+ int model; // ( CPUID(1).EAX[19:16] << 4 ) + CPUID(1).EAX[7:4] ( ( Extended
+ // Model << 4 ) + Model)
+ int stepping; // CPUID(1).EAX[3:0] ( Stepping )
+ int sse2; // 0 if SSE2 instructions are not supported, 1 otherwise.
+ int rtm; // 0 if RTM instructions are not supported, 1 otherwise.
+ int cpu_stackoffset;
+ int apic_id;
+ int physical_id;
+ int logical_id;
+ kmp_uint64 frequency; // Nominal CPU frequency in Hz.
+ char name[3 * sizeof(kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)
+} kmp_cpuinfo_t;
+
+extern void __kmp_query_cpuid(kmp_cpuinfo_t *p);
+
+#if KMP_OS_UNIX
+// subleaf is only needed for cache and topology discovery and can be set to
+// zero in most cases
+static inline void __kmp_x86_cpuid(int leaf, int subleaf, struct kmp_cpuid *p) {
+ __asm__ __volatile__("cpuid"
+ : "=a"(p->eax), "=b"(p->ebx), "=c"(p->ecx), "=d"(p->edx)
+ : "a"(leaf), "c"(subleaf));
+}
+// Load p into FPU control word
+static inline void __kmp_load_x87_fpu_control_word(const kmp_int16 *p) {
+ __asm__ __volatile__("fldcw %0" : : "m"(*p));
+}
+// Store FPU control word into p
+static inline void __kmp_store_x87_fpu_control_word(kmp_int16 *p) {
+ __asm__ __volatile__("fstcw %0" : "=m"(*p));
+}
+static inline void __kmp_clear_x87_fpu_status_word() {
+#if KMP_MIC
+ // 32-bit protected mode x87 FPU state
+ struct x87_fpu_state {
+ unsigned cw;
+ unsigned sw;
+ unsigned tw;
+ unsigned fip;
+ unsigned fips;
+ unsigned fdp;
+ unsigned fds;
+ };
+ struct x87_fpu_state fpu_state = {0, 0, 0, 0, 0, 0, 0};
+ __asm__ __volatile__("fstenv %0\n\t" // store FP env
+ "andw $0x7f00, %1\n\t" // clear 0-7,15 bits of FP SW
+ "fldenv %0\n\t" // load FP env back
+ : "+m"(fpu_state), "+m"(fpu_state.sw));
+#else
+ __asm__ __volatile__("fnclex");
+#endif // KMP_MIC
+}
+#if __SSE__
+static inline void __kmp_load_mxcsr(const kmp_uint32 *p) { _mm_setcsr(*p); }
+static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = _mm_getcsr(); }
+#else
+static inline void __kmp_load_mxcsr(const kmp_uint32 *p) {}
+static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = 0; }
+#endif
+#else
+// Windows still has these as external functions in assembly file
extern void __kmp_x86_cpuid(int mode, int mode2, struct kmp_cpuid *p);
+extern void __kmp_load_x87_fpu_control_word(const kmp_int16 *p);
+extern void __kmp_store_x87_fpu_control_word(kmp_int16 *p);
+extern void __kmp_clear_x87_fpu_status_word();
+static inline void __kmp_load_mxcsr(const kmp_uint32 *p) { _mm_setcsr(*p); }
+static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = _mm_getcsr(); }
+#endif // KMP_OS_UNIX
+
+#define KMP_X86_MXCSR_MASK 0xffffffc0 /* ignore status flags (6 lsb) */
+
#if KMP_ARCH_X86
extern void __kmp_x86_pause(void);
#elif KMP_MIC
// Performance testing on KNC (C0QS-7120 P/A/X/D, 61-core, 16 GB Memory) showed
-// regression after removal of extra PAUSE from KMP_YIELD_SPIN(). Changing
+// regression after removal of extra PAUSE from spin loops. Changing
// the delay from 100 to 300 showed even better performance than double PAUSE
// on Spec OMP2001 and LCPC tasking tests, no regressions on EPCC.
static inline void __kmp_x86_pause(void) { _mm_delay_32(300); }
@@ -1116,31 +1256,54 @@ static inline void __kmp_x86_pause(void) { _mm_pause(); }
#define KMP_INIT_YIELD(count) \
{ (count) = __kmp_yield_init; }
+#define KMP_OVERSUBSCRIBED \
+ (TCR_4(__kmp_nth) > (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc))
+
+#define KMP_TRY_YIELD \
+ ((__kmp_use_yield == 1) || (__kmp_use_yield == 2 && (KMP_OVERSUBSCRIBED)))
+
+#define KMP_TRY_YIELD_OVERSUB \
+ ((__kmp_use_yield == 1 || __kmp_use_yield == 2) && (KMP_OVERSUBSCRIBED))
+
#define KMP_YIELD(cond) \
{ \
KMP_CPU_PAUSE(); \
- __kmp_yield((cond)); \
+ if ((cond) && (KMP_TRY_YIELD)) \
+ __kmp_yield(); \
+ }
+
+#define KMP_YIELD_OVERSUB() \
+ { \
+ KMP_CPU_PAUSE(); \
+ if ((KMP_TRY_YIELD_OVERSUB)) \
+ __kmp_yield(); \
}
// Note the decrement of 2 in the following Macros. With KMP_LIBRARY=turnaround,
// there should be no yielding since initial value from KMP_INIT_YIELD() is odd.
-
-#define KMP_YIELD_WHEN(cond, count) \
+#define KMP_YIELD_SPIN(count) \
{ \
KMP_CPU_PAUSE(); \
- (count) -= 2; \
- if (!(count)) { \
- __kmp_yield(cond); \
- (count) = __kmp_yield_next; \
+ if (KMP_TRY_YIELD) { \
+ (count) -= 2; \
+ if (!(count)) { \
+ __kmp_yield(); \
+ (count) = __kmp_yield_next; \
+ } \
} \
}
-#define KMP_YIELD_SPIN(count) \
+
+#define KMP_YIELD_OVERSUB_ELSE_SPIN(count) \
{ \
KMP_CPU_PAUSE(); \
- (count) -= 2; \
- if (!(count)) { \
- __kmp_yield(1); \
- (count) = __kmp_yield_next; \
+ if ((KMP_TRY_YIELD_OVERSUB)) \
+ __kmp_yield(); \
+ else if (__kmp_use_yield == 1) { \
+ (count) -= 2; \
+ if (!(count)) { \
+ __kmp_yield(); \
+ (count) = __kmp_yield_next; \
+ } \
} \
}
@@ -1155,28 +1318,15 @@ enum cons_type {
ct_pdo_ordered,
ct_psections,
ct_psingle,
-
- /* the following must be left in order and not split up */
- ct_taskq,
- ct_task, // really task inside non-ordered taskq, considered worksharing type
- ct_task_ordered, /* really task inside ordered taskq, considered a worksharing
- type */
- /* the preceding must be left in order and not split up */
-
ct_critical,
ct_ordered_in_parallel,
ct_ordered_in_pdo,
- ct_ordered_in_taskq,
ct_master,
ct_reduce,
ct_barrier
};
-/* test to see if we are in a taskq construct */
-#define IS_CONS_TYPE_TASKQ(ct) \
- (((int)(ct)) >= ((int)ct_taskq) && ((int)(ct)) <= ((int)ct_task_ordered))
-#define IS_CONS_TYPE_ORDERED(ct) \
- ((ct) == ct_pdo_ordered || (ct) == ct_task_ordered)
+#define IS_CONS_TYPE_ORDERED(ct) ((ct) == ct_pdo_ordered)
struct cons_data {
ident_t const *ident;
@@ -1224,25 +1374,6 @@ typedef struct kmp_sys_info {
long nivcsw; /* the number of times a context switch was forced */
} kmp_sys_info_t;
-#if KMP_ARCH_X86 || KMP_ARCH_X86_64
-typedef struct kmp_cpuinfo {
- int initialized; // If 0, other fields are not initialized.
- int signature; // CPUID(1).EAX
- int family; // CPUID(1).EAX[27:20]+CPUID(1).EAX[11:8] (Extended Family+Family)
- int model; // ( CPUID(1).EAX[19:16] << 4 ) + CPUID(1).EAX[7:4] ( ( Extended
- // Model << 4 ) + Model)
- int stepping; // CPUID(1).EAX[3:0] ( Stepping )
- int sse2; // 0 if SSE2 instructions are not supported, 1 otherwise.
- int rtm; // 0 if RTM instructions are not supported, 1 otherwise.
- int cpu_stackoffset;
- int apic_id;
- int physical_id;
- int logical_id;
- kmp_uint64 frequency; // Nominal CPU frequency in Hz.
- char name[3 * sizeof(kmp_cpuid_t)]; // CPUID(0x80000002,0x80000003,0x80000004)
-} kmp_cpuinfo_t;
-#endif
-
#if USE_ITT_BUILD
// We cannot include "kmp_itt.h" due to circular dependency. Declare the only
// required type here. Later we will check the type meets requirements.
@@ -1250,163 +1381,6 @@ typedef int kmp_itt_mark_t;
#define KMP_ITT_DEBUG 0
#endif /* USE_ITT_BUILD */
-/* Taskq data structures */
-
-#define HIGH_WATER_MARK(nslots) (((nslots)*3) / 4)
-// num thunks that each thread can simultaneously execute from a task queue
-#define __KMP_TASKQ_THUNKS_PER_TH 1
-
-/* flags for taskq_global_flags, kmp_task_queue_t tq_flags, kmpc_thunk_t
- th_flags */
-
-#define TQF_IS_ORDERED 0x0001 // __kmpc_taskq interface, taskq ordered
-// __kmpc_taskq interface, taskq with lastprivate list
-#define TQF_IS_LASTPRIVATE 0x0002
-#define TQF_IS_NOWAIT 0x0004 // __kmpc_taskq interface, end taskq nowait
-// __kmpc_taskq interface, use heuristics to decide task queue size
-#define TQF_HEURISTICS 0x0008
-
-// __kmpc_taskq interface, reserved for future use
-#define TQF_INTERFACE_RESERVED1 0x0010
-// __kmpc_taskq interface, reserved for future use
-#define TQF_INTERFACE_RESERVED2 0x0020
-// __kmpc_taskq interface, reserved for future use
-#define TQF_INTERFACE_RESERVED3 0x0040
-// __kmpc_taskq interface, reserved for future use
-#define TQF_INTERFACE_RESERVED4 0x0080
-
-#define TQF_INTERFACE_FLAGS 0x00ff // all the __kmpc_taskq interface flags
-// internal/read by instrumentation; only used with TQF_IS_LASTPRIVATE
-#define TQF_IS_LAST_TASK 0x0100
-// internal use only; this thunk->th_task is the taskq_task
-#define TQF_TASKQ_TASK 0x0200
-// internal use only; must release worker threads once ANY queued task
-// exists (global)
-#define TQF_RELEASE_WORKERS 0x0400
-// internal use only; notify workers that master has finished enqueuing tasks
-#define TQF_ALL_TASKS_QUEUED 0x0800
-// internal use only: this queue encountered in parallel context: not serialized
-#define TQF_PARALLEL_CONTEXT 0x1000
-// internal use only; this queue is on the freelist and not in use
-#define TQF_DEALLOCATED 0x2000
-
-#define TQF_INTERNAL_FLAGS 0x3f00 // all the internal use only flags
-
-typedef struct KMP_ALIGN_CACHE kmpc_aligned_int32_t {
- kmp_int32 ai_data;
-} kmpc_aligned_int32_t;
-
-typedef struct KMP_ALIGN_CACHE kmpc_aligned_queue_slot_t {
- struct kmpc_thunk_t *qs_thunk;
-} kmpc_aligned_queue_slot_t;
-
-typedef struct kmpc_task_queue_t {
- /* task queue linkage fields for n-ary tree of queues (locked with global
- taskq_tree_lck) */
- kmp_lock_t tq_link_lck; /* lock for child link, child next/prev links and
- child ref counts */
- union {
- struct kmpc_task_queue_t *tq_parent; // pointer to parent taskq, not locked
- // for taskq internal freelists, locked with global taskq_freelist_lck
- struct kmpc_task_queue_t *tq_next_free;
- } tq;
- // pointer to linked-list of children, locked by tq's tq_link_lck
- volatile struct kmpc_task_queue_t *tq_first_child;
- // next child in linked-list, locked by parent tq's tq_link_lck
- struct kmpc_task_queue_t *tq_next_child;
- // previous child in linked-list, locked by parent tq's tq_link_lck
- struct kmpc_task_queue_t *tq_prev_child;
- // reference count of threads with access to this task queue
- volatile kmp_int32 tq_ref_count;
- /* (other than the thread executing the kmpc_end_taskq call) */
- /* locked by parent tq's tq_link_lck */
-
- /* shared data for task queue */
- /* per-thread array of pointers to shared variable structures */
- struct kmpc_aligned_shared_vars_t *tq_shareds;
- /* only one array element exists for all but outermost taskq */
-
- /* bookkeeping for ordered task queue */
- kmp_uint32 tq_tasknum_queuing; // ordered task # assigned while queuing tasks
- // ordered number of next task to be served (executed)
- volatile kmp_uint32 tq_tasknum_serving;
-
- /* thunk storage management for task queue */
- kmp_lock_t tq_free_thunks_lck; /* lock for thunk freelist manipulation */
- // thunk freelist, chained via th.th_next_free
- struct kmpc_thunk_t *tq_free_thunks;
- // space allocated for thunks for this task queue
- struct kmpc_thunk_t *tq_thunk_space;
-
- /* data fields for queue itself */
- kmp_lock_t tq_queue_lck; /* lock for [de]enqueue operations: tq_queue,
- tq_head, tq_tail, tq_nfull */
- /* array of queue slots to hold thunks for tasks */
- kmpc_aligned_queue_slot_t *tq_queue;
- volatile struct kmpc_thunk_t *tq_taskq_slot; /* special slot for taskq task
- thunk, occupied if not NULL */
- kmp_int32 tq_nslots; /* # of tq_thunk_space thunks alloc'd (not incl.
- tq_taskq_slot space) */
- kmp_int32 tq_head; // enqueue puts item here (index into tq_queue array)
- kmp_int32 tq_tail; // dequeue takes item from here (index into tq_queue array)
- volatile kmp_int32 tq_nfull; // # of occupied entries in task queue right now
- kmp_int32 tq_hiwat; /* high-water mark for tq_nfull and queue scheduling */
- volatile kmp_int32 tq_flags; /* TQF_xxx */
-
- /* bookkeeping for outstanding thunks */
-
- /* per-thread array for # of regular thunks currently being executed */
- struct kmpc_aligned_int32_t *tq_th_thunks;
- kmp_int32 tq_nproc; /* number of thunks in the th_thunks array */
-
- /* statistics library bookkeeping */
- ident_t *tq_loc; /* source location information for taskq directive */
-} kmpc_task_queue_t;
-
-typedef void (*kmpc_task_t)(kmp_int32 global_tid, struct kmpc_thunk_t *thunk);
-
-/* sizeof_shareds passed as arg to __kmpc_taskq call */
-typedef struct kmpc_shared_vars_t { /* aligned during dynamic allocation */
- kmpc_task_queue_t *sv_queue; /* (pointers to) shared vars */
-} kmpc_shared_vars_t;
-
-typedef struct KMP_ALIGN_CACHE kmpc_aligned_shared_vars_t {
- volatile struct kmpc_shared_vars_t *ai_data;
-} kmpc_aligned_shared_vars_t;
-
-/* sizeof_thunk passed as arg to kmpc_taskq call */
-typedef struct kmpc_thunk_t { /* aligned during dynamic allocation */
- union { /* field used for internal freelists too */
- kmpc_shared_vars_t *th_shareds;
- struct kmpc_thunk_t *th_next_free; /* freelist of individual thunks within
- queue, head at tq_free_thunks */
- } th;
- kmpc_task_t th_task; /* taskq_task if flags & TQF_TASKQ_TASK */
- struct kmpc_thunk_t *th_encl_thunk; /* pointer to dynamically enclosing thunk
- on this thread's call stack */
- // TQF_xxx(tq_flags interface plus possible internal flags)
- kmp_int32 th_flags;
-
- kmp_int32 th_status;
- kmp_uint32 th_tasknum; /* task number assigned in order of queuing, used for
- ordered sections */
- /* private vars */
-} kmpc_thunk_t;
-
-typedef struct KMP_ALIGN_CACHE kmp_taskq {
- int tq_curr_thunk_capacity;
-
- kmpc_task_queue_t *tq_root;
- kmp_int32 tq_global_flags;
-
- kmp_lock_t tq_freelist_lck;
- kmpc_task_queue_t *tq_freelist;
-
- kmpc_thunk_t **tq_curr_thunk;
-} kmp_taskq_t;
-
-/* END Taskq data structures */
-
typedef kmp_int32 kmp_critical_name[8];
/*!
@@ -1721,11 +1695,9 @@ typedef struct dispatch_shared_info {
dispatch_shared_info64_t s64;
} u;
volatile kmp_uint32 buffer_index;
-#if OMP_45_ENABLED
volatile kmp_int32 doacross_buf_idx; // teamwise index
volatile kmp_uint32 *doacross_flags; // shared array of iteration flags (0/1)
kmp_int32 doacross_num_done; // count finished threads
-#endif
#if KMP_USE_HIER_SCHED
void *hier;
#endif
@@ -1748,7 +1720,6 @@ typedef struct kmp_disp {
dispatch_private_info_t *th_disp_buffer;
kmp_int32 th_disp_index;
-#if OMP_45_ENABLED
kmp_int32 th_doacross_buf_idx; // thread's doacross buffer index
volatile kmp_uint32 *th_doacross_flags; // pointer to shared array of flags
union { // we can use union here because doacross cannot be used in
@@ -1756,14 +1727,6 @@ typedef struct kmp_disp {
kmp_int64 *th_doacross_info; // info on loop bounds
kmp_lock_t *th_steal_lock; // lock used for chunk stealing (8-byte variable)
};
-#else
-#if KMP_STATIC_STEAL_ENABLED
- kmp_lock_t *th_steal_lock; // lock used for chunk stealing (8-byte variable)
- void *dummy_padding[1]; // make it 64 bytes on Intel(R) 64
-#else
- void *dummy_padding[2]; // make it 64 bytes on Intel(R) 64
-#endif
-#endif
#if KMP_USE_INTERNODE_ALIGNMENT
char more_padding[INTERNODE_CACHE_LINE];
#endif
@@ -1837,7 +1800,6 @@ typedef enum kmp_bar_pat { /* Barrier communication patterns */
typedef struct kmp_internal_control {
int serial_nesting_level; /* corresponds to the value of the
th_team_serialized field */
- kmp_int8 nested; /* internal control for nested parallelism (per thread) */
kmp_int8 dynamic; /* internal control for dynamic adjustment of threads (per
thread) */
kmp_int8
@@ -1848,13 +1810,12 @@ typedef struct kmp_internal_control {
#endif
int nproc; /* internal control for #threads for next parallel region (per
thread) */
+ int thread_limit; /* internal control for thread-limit-var */
int max_active_levels; /* internal control for max_active_levels */
kmp_r_sched_t
sched; /* internal control for runtime schedule {sched,chunk} pair */
-#if OMP_40_ENABLED
kmp_proc_bind_t proc_bind; /* internal control for affinity */
kmp_int32 default_device; /* internal control for default device */
-#endif // OMP_40_ENABLED
struct kmp_internal_control *next;
} kmp_internal_control_t;
@@ -2043,8 +2004,6 @@ typedef struct kmp_local {
((xteam)->t.t_threads[(xtid)]->th.th_current_task->td_icvs.bt_intervals)
#endif
-#define get__nested_2(xteam, xtid) \
- ((xteam)->t.t_threads[(xtid)]->th.th_current_task->td_icvs.nested)
#define get__dynamic_2(xteam, xtid) \
((xteam)->t.t_threads[(xtid)]->th.th_current_task->td_icvs.dynamic)
#define get__nproc_2(xteam, xtid) \
@@ -2065,11 +2024,6 @@ typedef struct kmp_local {
#define set__bt_set_team(xteam, xtid, xval) \
(((xteam)->t.t_threads[(xtid)]->th.th_current_task->td_icvs.bt_set) = (xval))
-#define set__nested(xthread, xval) \
- (((xthread)->th.th_current_task->td_icvs.nested) = (xval))
-#define get__nested(xthread) \
- (((xthread)->th.th_current_task->td_icvs.nested) ? (FTN_TRUE) : (FTN_FALSE))
-
#define set__dynamic(xthread, xval) \
(((xthread)->th.th_current_task->td_icvs.dynamic) = (xval))
#define get__dynamic(xthread) \
@@ -2078,21 +2032,23 @@ typedef struct kmp_local {
#define set__nproc(xthread, xval) \
(((xthread)->th.th_current_task->td_icvs.nproc) = (xval))
+#define set__thread_limit(xthread, xval) \
+ (((xthread)->th.th_current_task->td_icvs.thread_limit) = (xval))
+
#define set__max_active_levels(xthread, xval) \
(((xthread)->th.th_current_task->td_icvs.max_active_levels) = (xval))
+#define get__max_active_levels(xthread) \
+ ((xthread)->th.th_current_task->td_icvs.max_active_levels)
+
#define set__sched(xthread, xval) \
(((xthread)->th.th_current_task->td_icvs.sched) = (xval))
-#if OMP_40_ENABLED
-
#define set__proc_bind(xthread, xval) \
(((xthread)->th.th_current_task->td_icvs.proc_bind) = (xval))
#define get__proc_bind(xthread) \
((xthread)->th.th_current_task->td_icvs.proc_bind)
-#endif /* OMP_40_ENABLED */
-
// OpenMP tasking data structures
typedef enum kmp_tasking_mode {
@@ -2105,16 +2061,13 @@ typedef enum kmp_tasking_mode {
extern kmp_tasking_mode_t
__kmp_tasking_mode; /* determines how/when to execute tasks */
extern int __kmp_task_stealing_constraint;
-#if OMP_40_ENABLED
+extern int __kmp_enable_task_throttling;
extern kmp_int32 __kmp_default_device; // Set via OMP_DEFAULT_DEVICE if
// specified, defaults to 0 otherwise
-#endif
-#if OMP_45_ENABLED
// Set via OMP_MAX_TASK_PRIORITY if specified, defaults to 0 otherwise
extern kmp_int32 __kmp_max_task_priority;
// Set via KMP_TASKLOOP_MIN_TASKS if specified, defaults to 0 otherwise
extern kmp_uint64 __kmp_taskloop_min_tasks;
-#endif
/* NOTE: kmp_taskdata_t and kmp_task_t structures allocated in single block with
taskdata first */
@@ -2134,19 +2087,13 @@ extern kmp_uint64 __kmp_taskloop_min_tasks;
*/
typedef kmp_int32 (*kmp_routine_entry_t)(kmp_int32, void *);
-#if OMP_40_ENABLED || OMP_45_ENABLED
typedef union kmp_cmplrdata {
-#if OMP_45_ENABLED
kmp_int32 priority; /**< priority specified by user for the task */
-#endif // OMP_45_ENABLED
-#if OMP_40_ENABLED
kmp_routine_entry_t
destructors; /* pointer to function to invoke deconstructors of
firstprivate C++ objects */
-#endif // OMP_40_ENABLED
/* future data */
} kmp_cmplrdata_t;
-#endif
/* sizeof_kmp_task_t passed as arg to kmpc_omp_task call */
/*!
@@ -2156,12 +2103,10 @@ typedef struct kmp_task { /* GEH: Shouldn't this be aligned somehow? */
kmp_routine_entry_t
routine; /**< pointer to routine to call for executing task */
kmp_int32 part_id; /**< part id for the task */
-#if OMP_40_ENABLED || OMP_45_ENABLED
kmp_cmplrdata_t
data1; /* Two known optional additions: destructors and priority */
kmp_cmplrdata_t data2; /* Process destructors first, priority second */
-/* future data */
-#endif
+ /* future data */
/* private vars */
} kmp_task_t;
@@ -2169,17 +2114,14 @@ typedef struct kmp_task { /* GEH: Shouldn't this be aligned somehow? */
@}
*/
-#if OMP_40_ENABLED
typedef struct kmp_taskgroup {
std::atomic<kmp_int32> count; // number of allocated and incomplete tasks
std::atomic<kmp_int32>
cancel_request; // request for cancellation of this taskgroup
struct kmp_taskgroup *parent; // parent taskgroup
-#if OMP_50_ENABLED
// Block of data to perform task reduction
void *reduce_data; // reduction related info
kmp_int32 reduce_num_data; // number of data items to reduce
-#endif
} kmp_taskgroup_t;
// forward declarations
@@ -2245,7 +2187,6 @@ typedef struct kmp_dephash {
#endif
} kmp_dephash_t;
-#if OMP_50_ENABLED
typedef struct kmp_task_affinity_info {
kmp_intptr_t base_addr;
size_t len;
@@ -2255,9 +2196,19 @@ typedef struct kmp_task_affinity_info {
kmp_int32 reserved : 30;
} flags;
} kmp_task_affinity_info_t;
-#endif
-#endif
+typedef enum kmp_event_type_t {
+ KMP_EVENT_UNINITIALIZED = 0,
+ KMP_EVENT_ALLOW_COMPLETION = 1
+} kmp_event_type_t;
+
+typedef struct {
+ kmp_event_type_t type;
+ kmp_tas_lock_t lock;
+ union {
+ kmp_task_t *task;
+ } ed;
+} kmp_event_t;
#ifdef BUILD_TIED_TASK_STACK
@@ -2282,21 +2233,14 @@ typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */
unsigned final : 1; /* task is final(1) so execute immediately */
unsigned merged_if0 : 1; /* no __kmpc_task_{begin/complete}_if0 calls in if0
code path */
-#if OMP_40_ENABLED
unsigned destructors_thunk : 1; /* set if the compiler creates a thunk to
invoke destructors from the runtime */
-#if OMP_45_ENABLED
unsigned proxy : 1; /* task is a proxy task (it will be executed outside the
context of the RTL) */
unsigned priority_specified : 1; /* set if the compiler provides priority
setting for the task */
- unsigned reserved : 10; /* reserved for compiler use */
-#else
- unsigned reserved : 12; /* reserved for compiler use */
-#endif
-#else // OMP_40_ENABLED
- unsigned reserved : 13; /* reserved for compiler use */
-#endif // OMP_40_ENABLED
+ unsigned detachable : 1; /* 1 == can detach */
+ unsigned reserved : 9; /* reserved for compiler use */
/* Library flags */ /* Total library flags must be 16 bits */
unsigned tasktype : 1; /* task is either explicit(1) or implicit (0) */
@@ -2337,27 +2281,24 @@ struct kmp_taskdata { /* aligned during dynamic allocation */
deallocated */
std::atomic<kmp_int32>
td_incomplete_child_tasks; /* Child tasks not yet complete */
-#if OMP_40_ENABLED
kmp_taskgroup_t
*td_taskgroup; // Each task keeps pointer to its current taskgroup
kmp_dephash_t
*td_dephash; // Dependencies for children tasks are tracked from here
kmp_depnode_t
*td_depnode; // Pointer to graph node if this task has dependencies
-#endif // OMP_40_ENABLED
-#if OMP_45_ENABLED
kmp_task_team_t *td_task_team;
kmp_int32 td_size_alloc; // The size of task structure, including shareds etc.
#if defined(KMP_GOMP_COMPAT)
// 4 or 8 byte integers for the loop bounds in GOMP_taskloop
kmp_int32 td_size_loop_bounds;
#endif
-#endif // OMP_45_ENABLED
kmp_taskdata_t *td_last_tied; // keep tied task for task scheduling constraint
-#if defined(KMP_GOMP_COMPAT) && OMP_45_ENABLED
+#if defined(KMP_GOMP_COMPAT)
// GOMP sends in a copy function for copy constructors
void (*td_copy_func)(void *, void *);
#endif
+ kmp_event_t td_allow_completion_event;
#if OMPT_SUPPORT
ompt_task_info_t ompt_task_info;
#endif
@@ -2411,12 +2352,8 @@ typedef struct kmp_base_task_team {
executing this team? */
/* TRUE means tt_threads_data is set up and initialized */
kmp_int32 tt_nproc; /* #threads in team */
- kmp_int32
- tt_max_threads; /* number of entries allocated for threads_data array */
-#if OMP_45_ENABLED
- kmp_int32
- tt_found_proxy_tasks; /* Have we found proxy tasks since last barrier */
-#endif
+ kmp_int32 tt_max_threads; // # entries allocated for threads_data array
+ kmp_int32 tt_found_proxy_tasks; // found proxy tasks since last barrier
kmp_int32 tt_untied_task_encountered;
KMP_ALIGN_CACHE
@@ -2452,12 +2389,30 @@ typedef struct kmp_hot_team_ptr {
kmp_int32 hot_team_nth; // number of threads allocated for the hot_team
} kmp_hot_team_ptr_t;
#endif
-#if OMP_40_ENABLED
typedef struct kmp_teams_size {
kmp_int32 nteams; // number of teams in a league
kmp_int32 nth; // number of threads in each team of the league
} kmp_teams_size_t;
-#endif
+
+// This struct stores a thread that acts as a "root" for a contention
+// group. Contention groups are rooted at kmp_root threads, but also at
+// each master thread of each team created in the teams construct.
+// This struct therefore also stores a thread_limit associated with
+// that contention group, and a counter to track the number of threads
+// active in that contention group. Each thread has a list of these: CG
+// root threads have an entry in their list in which cg_root refers to
+// the thread itself, whereas other workers in the CG will have a
+// single entry where cg_root is same as the entry containing their CG
+// root. When a thread encounters a teams construct, it will add a new
+// entry to the front of its list, because it now roots a new CG.
+typedef struct kmp_cg_root {
+ kmp_info_p *cg_root; // "root" thread for a contention group
+ // The CG root's limit comes from OMP_THREAD_LIMIT for root threads, or
+ // thread_limit clause for teams masters
+ kmp_int32 cg_thread_limit;
+ kmp_int32 cg_nthreads; // Count of active threads in CG rooted at cg_root
+ struct kmp_cg_root *up; // pointer to higher level CG root in list
+} kmp_cg_root_t;
// OpenMP thread data structures
@@ -2477,11 +2432,9 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
int th_team_nproc; /* number of threads in a team */
kmp_info_p *th_team_master; /* the team's master thread */
int th_team_serialized; /* team is serialized */
-#if OMP_40_ENABLED
microtask_t th_teams_microtask; /* save entry address for teams construct */
int th_teams_level; /* save initial level of teams construct */
/* it is 0 on device but may be any on host */
-#endif
/* The blocktime info is copied from the team struct to the thread sruct */
/* at the start of a barrier, and the values stored in the team are used */
@@ -2497,16 +2450,13 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
#if KMP_AFFINITY_SUPPORTED
kmp_affin_mask_t *th_affin_mask; /* thread's current affinity mask */
#endif
-#if OMP_50_ENABLED
- void *const *th_def_allocator; /* per implicit task default allocator */
-#endif
+ omp_allocator_handle_t th_def_allocator; /* default allocator */
/* The data set by the master at reinit, then R/W by the worker */
KMP_ALIGN_CACHE int
th_set_nproc; /* if > 0, then only use this request for the next fork */
#if KMP_NESTED_HOT_TEAMS
kmp_hot_team_ptr_t *th_hot_teams; /* array of hot teams */
#endif
-#if OMP_40_ENABLED
kmp_proc_bind_t
th_set_proc_bind; /* if != proc_bind_default, use request for next fork */
kmp_teams_size_t
@@ -2517,11 +2467,8 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
int th_first_place; /* first place in partition */
int th_last_place; /* last place in partition */
#endif
-#endif
-#if OMP_50_ENABLED
int th_prev_level; /* previous level for affinity format */
int th_prev_num_threads; /* previous num_threads for affinity format */
-#endif
#if USE_ITT_BUILD
kmp_uint64 th_bar_arrive_time; /* arrival to barrier timestamp */
kmp_uint64 th_bar_min_time; /* minimum arrival time at the barrier */
@@ -2588,12 +2535,12 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
#if KMP_OS_WINDOWS
kmp_win32_cond_t th_suspend_cv;
kmp_win32_mutex_t th_suspend_mx;
- int th_suspend_init;
+ std::atomic<int> th_suspend_init;
#endif
#if KMP_OS_UNIX
kmp_cond_align_t th_suspend_cv;
kmp_mutex_align_t th_suspend_mx;
- int th_suspend_init_count;
+ std::atomic<int> th_suspend_init_count;
#endif
#if USE_ITT_BUILD
@@ -2606,6 +2553,7 @@ typedef struct KMP_ALIGN_CACHE kmp_base_info {
#if KMP_OS_UNIX
std::atomic<bool> th_blocking;
#endif
+ kmp_cg_root_t *th_cg_roots; // list of cg_roots associated with this thread
} kmp_base_info_t;
typedef union KMP_ALIGN_CACHE kmp_info {
@@ -2659,6 +2607,10 @@ typedef struct KMP_ALIGN_CACHE kmp_base_team {
std::atomic<int> t_construct; // count of single directive encountered by team
char pad[sizeof(kmp_lock_t)]; // padding to maintain performance on big iron
+ // [0] - parallel / [1] - worksharing task reduction data shared by taskgroups
+ std::atomic<void *> t_tg_reduce_data[2]; // to support task modifier
+ std::atomic<int> t_tg_fini_counter[2]; // sync end of task reductions
+
// Master only
// ---------------------------------------------------------------------------
KMP_ALIGN_CACHE int t_master_tid; // tid of master in parent team
@@ -2670,9 +2622,7 @@ typedef struct KMP_ALIGN_CACHE kmp_base_team {
kmp_team_p *t_next_pool; // next free team in the team pool
kmp_disp_t *t_dispatch; // thread's dispatch data
kmp_task_team_t *t_task_team[2]; // Task team struct; switch between 2
-#if OMP_40_ENABLED
kmp_proc_bind_t t_proc_bind; // bind type for par region
-#endif // OMP_40_ENABLED
#if USE_ITT_BUILD
kmp_uint64 t_region_time; // region begin timestamp
#endif /* USE_ITT_BUILD */
@@ -2711,18 +2661,14 @@ typedef struct KMP_ALIGN_CACHE kmp_base_team {
int t_id; // team's id, assigned by debugger.
int t_active_level; // nested active parallel level
kmp_r_sched_t t_sched; // run-time schedule for the team
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
+#if KMP_AFFINITY_SUPPORTED
int t_first_place; // first & last place in parent thread's partition.
int t_last_place; // Restore these values to master after par region.
-#endif // OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
-#if OMP_50_ENABLED
+#endif // KMP_AFFINITY_SUPPORTED
int t_display_affinity;
-#endif
int t_size_changed; // team size was changed?: 0: no, 1: yes, -1: changed via
-// omp_set_num_threads() call
-#if OMP_50_ENABLED
- void *const *t_def_allocator; /* per implicit task default allocator */
-#endif
+ // omp_set_num_threads() call
+ omp_allocator_handle_t t_def_allocator; /* default allocator */
// Read/write by workers as well
#if (KMP_ARCH_X86 || KMP_ARCH_X86_64)
@@ -2734,13 +2680,10 @@ typedef struct KMP_ALIGN_CACHE kmp_base_team {
#endif
// Internal control stack for additional nested teams.
KMP_ALIGN_CACHE kmp_internal_control_t *t_control_stack_top;
-// for SERIALIZED teams nested 2 or more levels deep
-#if OMP_40_ENABLED
+ // for SERIALIZED teams nested 2 or more levels deep
// typed flag to store request state of cancellation
std::atomic<kmp_int32> t_cancel_request;
-#endif
int t_master_active; // save on fork, restore on join
- kmp_taskq_t t_taskq; // this team's task queue
void *t_copypriv_data; // team specific pointer to copyprivate data array
#if KMP_OS_WINDOWS
std::atomic<kmp_uint32> t_copyin_counter;
@@ -2786,8 +2729,6 @@ typedef struct kmp_base_root {
// TODO: GEH - then replace r_active with t_active_levels if we can to reduce
// the synch overhead or keeping r_active
volatile int r_active; /* TRUE if some region in a nest has > 1 thread */
- // GEH: This is misnamed, should be r_in_parallel
- volatile int r_nested; // TODO: GEH - This is unused, just remove it entirely.
// keeps a count of active parallel regions per root
std::atomic<int> r_in_parallel;
// GEH: This is misnamed, should be r_active_levels
@@ -2797,7 +2738,6 @@ typedef struct kmp_base_root {
kmp_lock_t r_begin_lock;
volatile int r_begin;
int r_blocktime; /* blocktime for this root and descendants */
- int r_cg_nthreads; // count of active threads in a contention group
} kmp_base_root_t;
typedef union KMP_ALIGN_CACHE kmp_root {
@@ -2922,10 +2862,6 @@ extern kmp_lock_t __kmp_global_lock; /* control OS/global access */
extern kmp_queuing_lock_t __kmp_dispatch_lock; /* control dispatch access */
extern kmp_lock_t __kmp_debug_lock; /* control I/O access for KMP_DEBUG */
-/* used for yielding spin-waits */
-extern unsigned int __kmp_init_wait; /* initial number of spin-tests */
-extern unsigned int __kmp_next_wait; /* susequent number of spin-tests */
-
extern enum library_type __kmp_library;
extern enum sched_type __kmp_sched; /* default runtime scheduling */
@@ -2954,16 +2890,11 @@ extern int __kmp_reserve_warn; /* have we issued reserve_threads warning? */
extern int __kmp_suspend_count; /* count inside __kmp_suspend_template() */
#endif
+extern kmp_int32 __kmp_use_yield;
+extern kmp_int32 __kmp_use_yield_exp_set;
extern kmp_uint32 __kmp_yield_init;
extern kmp_uint32 __kmp_yield_next;
-#if KMP_USE_MONITOR
-extern kmp_uint32 __kmp_yielding_on;
-#endif
-extern kmp_uint32 __kmp_yield_cycle;
-extern kmp_int32 __kmp_yield_on_count;
-extern kmp_int32 __kmp_yield_off_count;
-
/* ------------------------------------------------------------------------- */
extern int __kmp_allThreadsSpecified;
@@ -2988,8 +2919,6 @@ extern int __kmp_tp_capacity; /* capacity of __kmp_threads if threadprivate is
used (fixed) */
extern int __kmp_tp_cached; /* whether threadprivate cache has been created
(__kmpc_threadprivate_cached()) */
-extern int __kmp_dflt_nested; /* nested parallelism enabled by default a la
- OMP_NESTED */
extern int __kmp_dflt_blocktime; /* number of milliseconds to wait before
blocking (env setting) */
#if KMP_USE_MONITOR
@@ -3031,9 +2960,12 @@ extern kmp_int16 __kmp_init_x87_fpu_control_word; // init thread's FP ctrl reg
extern kmp_uint32 __kmp_init_mxcsr; /* init thread's mxscr */
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
-extern int __kmp_dflt_max_active_levels; /* max_active_levels for nested
- parallelism enabled by default via
- OMP_MAX_ACTIVE_LEVELS */
+// max_active_levels for nested parallelism enabled by default via
+// OMP_MAX_ACTIVE_LEVELS, OMP_NESTED, OMP_NUM_THREADS, and OMP_PROC_BIND
+extern int __kmp_dflt_max_active_levels;
+// Indicates whether value of __kmp_dflt_max_active_levels was already
+// explicitly set by OMP_MAX_ACTIVE_LEVELS or OMP_NESTED=false
+extern bool __kmp_dflt_max_active_levels_set;
extern int __kmp_dispatch_num_buffers; /* max possible dynamic loops in
concurrent execution per team */
#if KMP_NESTED_HOT_TEAMS
@@ -3082,11 +3014,9 @@ extern const char *__kmp_speculative_statsfile;
#endif // KMP_USE_ADAPTIVE_LOCKS
-#if OMP_40_ENABLED
extern int __kmp_display_env; /* TRUE or FALSE */
extern int __kmp_display_env_verbose; /* TRUE if OMP_DISPLAY_ENV=VERBOSE */
extern int __kmp_omp_cancellation; /* TRUE or FALSE */
-#endif
/* ------------------------------------------------------------------------- */
@@ -3103,7 +3033,6 @@ extern volatile int __kmp_nth;
/* total number of threads reachable from some root thread including all root
threads, and those in the thread pool */
extern volatile int __kmp_all_nth;
-extern int __kmp_thread_pool_nth;
extern std::atomic<int> __kmp_thread_pool_active_nth;
extern kmp_root_t **__kmp_root; /* root of thread hierarchy */
@@ -3237,6 +3166,7 @@ extern void __kmp_init_random(kmp_info_t *thread);
extern kmp_r_sched_t __kmp_get_schedule_global(void);
extern void __kmp_adjust_num_threads(int new_nproc);
+extern void __kmp_check_stksize(size_t *val);
extern void *___kmp_allocate(size_t size KMP_SRC_LOC_DECL);
extern void *___kmp_page_allocate(size_t size KMP_SRC_LOC_DECL);
@@ -3279,14 +3209,12 @@ extern void ___kmp_thread_free(kmp_info_t *th, void *ptr KMP_SRC_LOC_DECL);
extern void __kmp_push_num_threads(ident_t *loc, int gtid, int num_threads);
-#if OMP_40_ENABLED
extern void __kmp_push_proc_bind(ident_t *loc, int gtid,
kmp_proc_bind_t proc_bind);
extern void __kmp_push_num_teams(ident_t *loc, int gtid, int num_teams,
int num_threads);
-#endif
-extern void __kmp_yield(int cond);
+extern void __kmp_yield();
extern void __kmpc_dispatch_init_4(ident_t *loc, kmp_int32 gtid,
enum sched_type schedule, kmp_int32 lb,
@@ -3351,13 +3279,11 @@ extern kmp_uint32 __kmp_neq_4(kmp_uint32 value, kmp_uint32 checker);
extern kmp_uint32 __kmp_lt_4(kmp_uint32 value, kmp_uint32 checker);
extern kmp_uint32 __kmp_ge_4(kmp_uint32 value, kmp_uint32 checker);
extern kmp_uint32 __kmp_le_4(kmp_uint32 value, kmp_uint32 checker);
-extern kmp_uint32 __kmp_wait_yield_4(kmp_uint32 volatile *spinner,
- kmp_uint32 checker,
- kmp_uint32 (*pred)(kmp_uint32, kmp_uint32),
- void *obj);
-extern void __kmp_wait_yield_4_ptr(void *spinner, kmp_uint32 checker,
- kmp_uint32 (*pred)(void *, kmp_uint32),
- void *obj);
+extern kmp_uint32 __kmp_wait_4(kmp_uint32 volatile *spinner, kmp_uint32 checker,
+ kmp_uint32 (*pred)(kmp_uint32, kmp_uint32),
+ void *obj);
+extern void __kmp_wait_4_ptr(void *spinner, kmp_uint32 checker,
+ kmp_uint32 (*pred)(void *, kmp_uint32), void *obj);
class kmp_flag_32;
class kmp_flag_64;
@@ -3407,9 +3333,7 @@ extern void __kmp_affinity_initialize(void);
extern void __kmp_affinity_uninitialize(void);
extern void __kmp_affinity_set_init_mask(
int gtid, int isa_root); /* set affinity according to KMP_AFFINITY */
-#if OMP_40_ENABLED
extern void __kmp_affinity_set_place(int gtid);
-#endif
extern void __kmp_affinity_determine_capable(const char *env_var);
extern int __kmp_aux_set_affinity(void **mask);
extern int __kmp_aux_get_affinity(void **mask);
@@ -3422,14 +3346,12 @@ extern void __kmp_balanced_affinity(kmp_info_t *th, int team_size);
extern int kmp_set_thread_affinity_mask_initial(void);
#endif
#endif /* KMP_AFFINITY_SUPPORTED */
-#if OMP_50_ENABLED
// No need for KMP_AFFINITY_SUPPORTED guard as only one field in the
// format string is for affinity, so platforms that do not support
// affinity can still use the other fields, e.g., %n for num_threads
extern size_t __kmp_aux_capture_affinity(int gtid, const char *format,
kmp_str_buf_t *buffer);
extern void __kmp_aux_display_affinity(int gtid, const char *format);
-#endif
extern void __kmp_cleanup_hierarchy();
extern void __kmp_get_hierarchy(kmp_uint32 nproc, kmp_bstate_t *thr_bar);
@@ -3467,6 +3389,10 @@ extern void __kmp_reap_monitor(kmp_info_t *th);
extern void __kmp_reap_worker(kmp_info_t *th);
extern void __kmp_terminate_thread(int gtid);
+extern int __kmp_try_suspend_mx(kmp_info_t *th);
+extern void __kmp_lock_suspend_mx(kmp_info_t *th);
+extern void __kmp_unlock_suspend_mx(kmp_info_t *th);
+
extern void __kmp_suspend_32(int th_gtid, kmp_flag_32 *flag);
extern void __kmp_suspend_64(int th_gtid, kmp_flag_64 *flag);
extern void __kmp_suspend_oncore(int th_gtid, kmp_flag_oncore *flag);
@@ -3490,11 +3416,11 @@ extern void __kmp_common_destroy_gtid(int gtid);
extern void __kmp_register_atfork(void);
#endif
extern void __kmp_suspend_initialize(void);
+extern void __kmp_suspend_initialize_thread(kmp_info_t *th);
extern void __kmp_suspend_uninitialize_thread(kmp_info_t *th);
extern kmp_info_t *__kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team,
int tid);
-#if OMP_40_ENABLED
extern kmp_team_t *
__kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
#if OMPT_SUPPORT
@@ -3502,15 +3428,6 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
#endif
kmp_proc_bind_t proc_bind, kmp_internal_control_t *new_icvs,
int argc USE_NESTED_HOT_ARG(kmp_info_t *thr));
-#else
-extern kmp_team_t *
-__kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
-#if OMPT_SUPPORT
- ompt_id_t ompt_parallel_id,
-#endif
- kmp_internal_control_t *new_icvs,
- int argc USE_NESTED_HOT_ARG(kmp_info_t *thr));
-#endif // OMP_40_ENABLED
extern void __kmp_free_thread(kmp_info_t *);
extern void __kmp_free_team(kmp_root_t *,
kmp_team_t *USE_NESTED_HOT_ARG(kmp_info_t *));
@@ -3533,6 +3450,7 @@ extern int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
size_t reduce_size, void *reduce_data,
void (*reduce)(void *, void *));
extern void __kmp_end_split_barrier(enum barrier_type bt, int gtid);
+extern int __kmp_barrier_gomp_cancel(int gtid);
/*!
* Tell the fork call which compiler generated the fork call, and therefore how
@@ -3560,11 +3478,8 @@ extern void __kmp_join_call(ident_t *loc, int gtid
,
enum fork_context_e fork_context
#endif
-#if OMP_40_ENABLED
,
- int exit_teams = 0
-#endif
- );
+ int exit_teams = 0);
extern void __kmp_serialized_parallel(ident_t *id, kmp_int32 gtid);
extern void __kmp_internal_fork(ident_t *id, int gtid, kmp_team_t *team);
@@ -3579,12 +3494,10 @@ extern void __kmp_run_after_invoked_task(int gtid, int tid,
// should never have been exported
KMP_EXPORT int __kmpc_invoke_task_func(int gtid);
-#if OMP_40_ENABLED
extern int __kmp_invoke_teams_master(int gtid);
extern void __kmp_teams_master(int gtid);
extern int __kmp_aux_get_team_num();
extern int __kmp_aux_get_num_teams();
-#endif
extern void __kmp_save_internal_controls(kmp_info_t *thread);
extern void __kmp_user_set_library(enum library_type arg);
extern void __kmp_aux_set_library(enum library_type arg);
@@ -3611,6 +3524,12 @@ extern void __kmp_init_implicit_task(ident_t *loc_ref, kmp_info_t *this_thr,
int set_curr_task);
extern void __kmp_finish_implicit_task(kmp_info_t *this_thr);
extern void __kmp_free_implicit_task(kmp_info_t *this_thr);
+
+extern kmp_event_t *__kmpc_task_allow_completion_event(ident_t *loc_ref,
+ int gtid,
+ kmp_task_t *task);
+extern void __kmp_fulfill_event(kmp_event_t *event);
+
int __kmp_execute_tasks_32(kmp_info_t *thread, kmp_int32 gtid,
kmp_flag_32 *flag, int final_spin,
int *thread_finished,
@@ -3662,20 +3581,6 @@ extern int __kmp_read_from_file(char const *path, char const *format, ...);
// Assembly routines that have no compiler intrinsic replacement
//
-#if KMP_ARCH_X86 || KMP_ARCH_X86_64
-
-extern void __kmp_query_cpuid(kmp_cpuinfo_t *p);
-
-#define __kmp_load_mxcsr(p) _mm_setcsr(*(p))
-static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = _mm_getcsr(); }
-
-extern void __kmp_load_x87_fpu_control_word(kmp_int16 *p);
-extern void __kmp_store_x87_fpu_control_word(kmp_int16 *p);
-extern void __kmp_clear_x87_fpu_status_word();
-#define KMP_X86_MXCSR_MASK 0xffffffc0 /* ignore status flags (6 lsb) */
-
-#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
-
extern int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int npr, int argc,
void *argv[]
#if OMPT_SUPPORT
@@ -3722,11 +3627,8 @@ KMP_EXPORT void __kmpc_critical(ident_t *, kmp_int32 global_tid,
kmp_critical_name *);
KMP_EXPORT void __kmpc_end_critical(ident_t *, kmp_int32 global_tid,
kmp_critical_name *);
-
-#if OMP_45_ENABLED
KMP_EXPORT void __kmpc_critical_with_hint(ident_t *, kmp_int32 global_tid,
kmp_critical_name *, uint32_t hint);
-#endif
KMP_EXPORT kmp_int32 __kmpc_barrier_master(ident_t *, kmp_int32 global_tid);
KMP_EXPORT void __kmpc_end_barrier_master(ident_t *, kmp_int32 global_tid);
@@ -3754,24 +3656,6 @@ extern void KMPC_SET_NUM_THREADS(int arg);
extern void KMPC_SET_DYNAMIC(int flag);
extern void KMPC_SET_NESTED(int flag);
-/* Taskq interface routines */
-KMP_EXPORT kmpc_thunk_t *__kmpc_taskq(ident_t *loc, kmp_int32 global_tid,
- kmpc_task_t taskq_task,
- size_t sizeof_thunk,
- size_t sizeof_shareds, kmp_int32 flags,
- kmpc_shared_vars_t **shareds);
-KMP_EXPORT void __kmpc_end_taskq(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *thunk);
-KMP_EXPORT kmp_int32 __kmpc_task(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *thunk);
-KMP_EXPORT void __kmpc_taskq_task(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *thunk, kmp_int32 status);
-KMP_EXPORT void __kmpc_end_taskq_task(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *thunk);
-KMP_EXPORT kmpc_thunk_t *__kmpc_task_buffer(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *taskq_thunk,
- kmpc_task_t task);
-
/* OMP 3.0 tasking interface routines */
KMP_EXPORT kmp_int32 __kmpc_omp_task(ident_t *loc_ref, kmp_int32 gtid,
kmp_task_t *new_task);
@@ -3780,6 +3664,12 @@ KMP_EXPORT kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
size_t sizeof_kmp_task_t,
size_t sizeof_shareds,
kmp_routine_entry_t task_entry);
+KMP_EXPORT kmp_task_t *__kmpc_omp_target_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
+ kmp_int32 flags,
+ size_t sizeof_kmp_task_t,
+ size_t sizeof_shareds,
+ kmp_routine_entry_t task_entry,
+ kmp_int64 device_id);
KMP_EXPORT void __kmpc_omp_task_begin_if0(ident_t *loc_ref, kmp_int32 gtid,
kmp_task_t *task);
KMP_EXPORT void __kmpc_omp_task_complete_if0(ident_t *loc_ref, kmp_int32 gtid,
@@ -3799,8 +3689,6 @@ void __kmpc_omp_task_complete(ident_t *loc_ref, kmp_int32 gtid,
/* ------------------------------------------------------------------------ */
-#if OMP_40_ENABLED
-
KMP_EXPORT void __kmpc_taskgroup(ident_t *loc, int gtid);
KMP_EXPORT void __kmpc_end_taskgroup(ident_t *loc, int gtid);
@@ -3813,7 +3701,6 @@ KMP_EXPORT void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid,
kmp_depend_info_t *dep_list,
kmp_int32 ndeps_noalias,
kmp_depend_info_t *noalias_dep_list);
-
extern kmp_int32 __kmp_omp_task(kmp_int32 gtid, kmp_task_t *new_task,
bool serialize_immediate);
@@ -3824,8 +3711,6 @@ KMP_EXPORT kmp_int32 __kmpc_cancellationpoint(ident_t *loc_ref, kmp_int32 gtid,
KMP_EXPORT kmp_int32 __kmpc_cancel_barrier(ident_t *loc_ref, kmp_int32 gtid);
KMP_EXPORT int __kmp_get_cancellation_status(int cancel_kind);
-#if OMP_45_ENABLED
-
KMP_EXPORT void __kmpc_proxy_task_completed(kmp_int32 gtid, kmp_task_t *ptask);
KMP_EXPORT void __kmpc_proxy_task_completed_ooo(kmp_task_t *ptask);
KMP_EXPORT void __kmpc_taskloop(ident_t *loc, kmp_int32 gtid, kmp_task_t *task,
@@ -3833,16 +3718,19 @@ KMP_EXPORT void __kmpc_taskloop(ident_t *loc, kmp_int32 gtid, kmp_task_t *task,
kmp_uint64 *ub, kmp_int64 st, kmp_int32 nogroup,
kmp_int32 sched, kmp_uint64 grainsize,
void *task_dup);
-#endif
-#if OMP_50_ENABLED
KMP_EXPORT void *__kmpc_task_reduction_init(int gtid, int num_data, void *data);
+KMP_EXPORT void *__kmpc_taskred_init(int gtid, int num_data, void *data);
KMP_EXPORT void *__kmpc_task_reduction_get_th_data(int gtid, void *tg, void *d);
+KMP_EXPORT void *__kmpc_task_reduction_modifier_init(ident_t *loc, int gtid,
+ int is_ws, int num,
+ void *data);
+KMP_EXPORT void *__kmpc_taskred_modifier_init(ident_t *loc, int gtid, int is_ws,
+ int num, void *data);
+KMP_EXPORT void __kmpc_task_reduction_modifier_fini(ident_t *loc, int gtid,
+ int is_ws);
KMP_EXPORT kmp_int32 __kmpc_omp_reg_task_with_affinity(
ident_t *loc_ref, kmp_int32 gtid, kmp_task_t *new_task, kmp_int32 naffins,
kmp_task_affinity_info_t *affin_list);
-#endif
-
-#endif
/* Lock interface routines (fast versions with gtid passed in) */
KMP_EXPORT void __kmpc_init_lock(ident_t *loc, kmp_int32 gtid,
@@ -3864,13 +3752,11 @@ KMP_EXPORT int __kmpc_test_lock(ident_t *loc, kmp_int32 gtid, void **user_lock);
KMP_EXPORT int __kmpc_test_nest_lock(ident_t *loc, kmp_int32 gtid,
void **user_lock);
-#if OMP_45_ENABLED
KMP_EXPORT void __kmpc_init_lock_with_hint(ident_t *loc, kmp_int32 gtid,
void **user_lock, uintptr_t hint);
KMP_EXPORT void __kmpc_init_nest_lock_with_hint(ident_t *loc, kmp_int32 gtid,
void **user_lock,
uintptr_t hint);
-#endif
/* Interface to fast scalable reduce methods routines */
@@ -3908,7 +3794,6 @@ KMP_EXPORT void __kmpc_pop_num_threads(ident_t *loc, kmp_int32 global_tid);
KMP_EXPORT void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid,
kmp_int32 num_threads);
-#if OMP_40_ENABLED
KMP_EXPORT void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid,
int proc_bind);
KMP_EXPORT void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid,
@@ -3916,8 +3801,6 @@ KMP_EXPORT void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid,
kmp_int32 num_threads);
KMP_EXPORT void __kmpc_fork_teams(ident_t *loc, kmp_int32 argc,
kmpc_micro microtask, ...);
-#endif
-#if OMP_45_ENABLED
struct kmp_dim { // loop bounds info casted to kmp_int64
kmp_int64 lo; // lower
kmp_int64 up; // upper
@@ -3931,7 +3814,6 @@ KMP_EXPORT void __kmpc_doacross_wait(ident_t *loc, kmp_int32 gtid,
KMP_EXPORT void __kmpc_doacross_post(ident_t *loc, kmp_int32 gtid,
const kmp_int64 *vec);
KMP_EXPORT void __kmpc_doacross_fini(ident_t *loc, kmp_int32 gtid);
-#endif
KMP_EXPORT void *__kmpc_threadprivate_cached(ident_t *loc, kmp_int32 global_tid,
void *data, size_t size,
@@ -3988,7 +3870,6 @@ KMP_EXPORT void KMPC_CONVENTION kmpc_set_library(int);
KMP_EXPORT void KMPC_CONVENTION kmpc_set_defaults(char const *);
KMP_EXPORT void KMPC_CONVENTION kmpc_set_disp_num_buffers(int);
-#if OMP_50_ENABLED
enum kmp_target_offload_kind {
tgt_disabled = 0,
tgt_default = 1,
@@ -3998,14 +3879,36 @@ typedef enum kmp_target_offload_kind kmp_target_offload_kind_t;
// Set via OMP_TARGET_OFFLOAD if specified, defaults to tgt_default otherwise
extern kmp_target_offload_kind_t __kmp_target_offload;
extern int __kmpc_get_target_offload();
-#endif
-#if OMP_40_ENABLED
// Constants used in libomptarget
#define KMP_DEVICE_DEFAULT -1 // This is libomptarget's default device.
#define KMP_HOST_DEVICE -10 // This is what it is in libomptarget, go figure.
#define KMP_DEVICE_ALL -11 // This is libomptarget's "all devices".
-#endif // OMP_40_ENABLED
+
+// OMP Pause Resource
+
+// The following enum is used both to set the status in __kmp_pause_status, and
+// as the internal equivalent of the externally-visible omp_pause_resource_t.
+typedef enum kmp_pause_status_t {
+ kmp_not_paused = 0, // status is not paused, or, requesting resume
+ kmp_soft_paused = 1, // status is soft-paused, or, requesting soft pause
+ kmp_hard_paused = 2 // status is hard-paused, or, requesting hard pause
+} kmp_pause_status_t;
+
+// This stores the pause state of the runtime
+extern kmp_pause_status_t __kmp_pause_status;
+extern int __kmpc_pause_resource(kmp_pause_status_t level);
+extern int __kmp_pause_resource(kmp_pause_status_t level);
+// Soft resume sets __kmp_pause_status, and wakes up all threads.
+extern void __kmp_resume_if_soft_paused();
+// Hard resume simply resets the status to not paused. Library will appear to
+// be uninitialized after hard pause. Let OMP constructs trigger required
+// initializations.
+static inline void __kmp_resume_if_hard_paused() {
+ if (__kmp_pause_status == kmp_hard_paused) {
+ __kmp_pause_status = kmp_not_paused;
+ }
+}
#ifdef __cplusplus
}
diff --git a/runtime/src/kmp_affinity.cpp b/runtime/src/kmp_affinity.cpp
index f14cdf68c086..372c300d44eb 100644
--- a/runtime/src/kmp_affinity.cpp
+++ b/runtime/src/kmp_affinity.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -458,7 +457,8 @@ static int __kmp_hwloc_get_nobjs_under_obj(hwloc_obj_t obj,
}
static int __kmp_hwloc_count_children_by_depth(hwloc_topology_t t,
- hwloc_obj_t o, unsigned depth,
+ hwloc_obj_t o,
+ kmp_hwloc_depth_t depth,
hwloc_obj_t *f) {
if (o->depth == depth) {
if (*f == NULL)
@@ -531,7 +531,7 @@ static int __kmp_hwloc_process_obj_core_pu(AddrUnsPair *addrPair,
static int __kmp_hwloc_check_numa() {
hwloc_topology_t &tp = __kmp_hwloc_topology;
hwloc_obj_t hT, hC, hL, hN, hS; // hwloc objects (pointers to)
- int depth;
+ int depth, l2cache_depth, package_depth;
// Get some PU
hT = hwloc_get_obj_by_type(tp, HWLOC_OBJ_PU, 0);
@@ -545,12 +545,14 @@ static int __kmp_hwloc_check_numa() {
if (hN != NULL && hN->depth > hS->depth) {
__kmp_numa_detected = TRUE; // socket includes node(s)
if (__kmp_affinity_gran == affinity_gran_node) {
- __kmp_affinity_gran == affinity_gran_numa;
+ __kmp_affinity_gran = affinity_gran_numa;
}
}
+ package_depth = hwloc_get_type_depth(tp, HWLOC_OBJ_PACKAGE);
+ l2cache_depth = hwloc_get_cache_type_depth(tp, 2, HWLOC_OBJ_CACHE_UNIFIED);
// check tile, get object by depth because of multiple caches possible
- depth = hwloc_get_cache_type_depth(tp, 2, HWLOC_OBJ_CACHE_UNIFIED);
+ depth = (l2cache_depth < package_depth) ? package_depth : l2cache_depth;
hL = hwloc_get_ancestor_obj_by_depth(tp, depth, hT);
hC = NULL; // not used, but reset it here just in case
if (hL != NULL &&
@@ -3017,8 +3019,6 @@ static void __kmp_affinity_process_proclist(kmp_affin_mask_t **out_masks,
KMP_CPU_FREE(sumMask);
}
-#if OMP_40_ENABLED
-
/*-----------------------------------------------------------------------------
Re-parse the OMP_PLACES proc id list, forming the newMasks for the different
places. Again, Here is the grammar:
@@ -3039,7 +3039,6 @@ signed := num
signed := + signed
signed := - signed
-----------------------------------------------------------------------------*/
-
static void __kmp_process_subplace_list(const char **scan,
kmp_affin_mask_t *osId2Mask,
int maxOsId, kmp_affin_mask_t *tempMask,
@@ -3358,8 +3357,6 @@ void __kmp_affinity_process_placelist(kmp_affin_mask_t **out_masks,
KMP_CPU_INTERNAL_FREE_ARRAY(newMasks, numNewMasks);
}
-#endif /* OMP_40_ENABLED */
-
#undef ADD_MASK
#undef ADD_MASK_OSID
@@ -4484,21 +4481,15 @@ static void __kmp_aux_affinity_initialize(void) {
case affinity_explicit:
KMP_DEBUG_ASSERT(__kmp_affinity_proclist != NULL);
-#if OMP_40_ENABLED
- if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_intel)
-#endif
- {
+ if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_intel) {
__kmp_affinity_process_proclist(
&__kmp_affinity_masks, &__kmp_affinity_num_masks,
__kmp_affinity_proclist, osId2Mask, maxIndex);
- }
-#if OMP_40_ENABLED
- else {
+ } else {
__kmp_affinity_process_placelist(
&__kmp_affinity_masks, &__kmp_affinity_num_masks,
__kmp_affinity_proclist, osId2Mask, maxIndex);
}
-#endif
if (__kmp_affinity_num_masks == 0) {
if (__kmp_affinity_verbose ||
(__kmp_affinity_warnings && (__kmp_affinity_type != affinity_none))) {
@@ -4614,13 +4605,11 @@ static void __kmp_aux_affinity_initialize(void) {
__kmp_affinity_num_masks = numUnique;
}
-#if OMP_40_ENABLED
if ((__kmp_nested_proc_bind.bind_types[0] != proc_bind_intel) &&
(__kmp_affinity_num_places > 0) &&
((unsigned)__kmp_affinity_num_places < __kmp_affinity_num_masks)) {
__kmp_affinity_num_masks = __kmp_affinity_num_places;
}
-#endif
KMP_CPU_ALLOC_ARRAY(__kmp_affinity_masks, __kmp_affinity_num_masks);
@@ -4690,9 +4679,7 @@ void __kmp_affinity_uninitialize(void) {
}
__kmp_affinity_num_masks = 0;
__kmp_affinity_type = affinity_default;
-#if OMP_40_ENABLED
__kmp_affinity_num_places = 0;
-#endif
if (__kmp_affinity_proclist != NULL) {
__kmp_free(__kmp_affinity_proclist);
__kmp_affinity_proclist = NULL;
@@ -4733,10 +4720,7 @@ void __kmp_affinity_set_init_mask(int gtid, int isa_root) {
kmp_affin_mask_t *mask;
int i;
-#if OMP_40_ENABLED
- if (KMP_AFFINITY_NON_PROC_BIND)
-#endif
- {
+ if (KMP_AFFINITY_NON_PROC_BIND) {
if ((__kmp_affinity_type == affinity_none) ||
(__kmp_affinity_type == affinity_balanced)) {
#if KMP_GROUP_AFFINITY
@@ -4752,9 +4736,7 @@ void __kmp_affinity_set_init_mask(int gtid, int isa_root) {
i = (gtid + __kmp_affinity_offset) % __kmp_affinity_num_masks;
mask = KMP_CPU_INDEX(__kmp_affinity_masks, i);
}
- }
-#if OMP_40_ENABLED
- else {
+ } else {
if ((!isa_root) ||
(__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)) {
#if KMP_GROUP_AFFINITY
@@ -4773,9 +4755,7 @@ void __kmp_affinity_set_init_mask(int gtid, int isa_root) {
mask = KMP_CPU_INDEX(__kmp_affinity_masks, i);
}
}
-#endif
-#if OMP_40_ENABLED
th->th.th_current_place = i;
if (isa_root) {
th->th.th_new_place = i;
@@ -4795,17 +4775,6 @@ void __kmp_affinity_set_init_mask(int gtid, int isa_root) {
KA_TRACE(100, ("__kmp_affinity_set_init_mask: binding T#%d to place %d\n",
gtid, i));
}
-#else
- if (i == -1) {
- KA_TRACE(
- 100,
- ("__kmp_affinity_set_init_mask: binding T#%d to __kmp_affin_fullMask\n",
- gtid));
- } else {
- KA_TRACE(100, ("__kmp_affinity_set_init_mask: binding T#%d to mask %d\n",
- gtid, i));
- }
-#endif /* OMP_40_ENABLED */
KMP_CPU_COPY(th->th.th_affin_mask, mask);
@@ -4831,8 +4800,6 @@ void __kmp_affinity_set_init_mask(int gtid, int isa_root) {
__kmp_set_system_affinity(th->th.th_affin_mask, TRUE);
}
-#if OMP_40_ENABLED
-
void __kmp_affinity_set_place(int gtid) {
if (!KMP_AFFINITY_CAPABLE()) {
return;
@@ -4873,8 +4840,6 @@ void __kmp_affinity_set_place(int gtid) {
__kmp_set_system_affinity(th->th.th_affin_mask, TRUE);
}
-#endif /* OMP_40_ENABLED */
-
int __kmp_aux_set_affinity(void **mask) {
int gtid;
kmp_info_t *th;
@@ -4885,7 +4850,7 @@ int __kmp_aux_set_affinity(void **mask) {
}
gtid = __kmp_entry_gtid();
- KA_TRACE(1000, ; {
+ KA_TRACE(1000, (""); {
char buf[KMP_AFFIN_MASK_PRINT_LEN];
__kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN,
(kmp_affin_mask_t *)(*mask));
@@ -4929,7 +4894,6 @@ int __kmp_aux_set_affinity(void **mask) {
KMP_CPU_COPY(th->th.th_affin_mask, (kmp_affin_mask_t *)(*mask));
}
-#if OMP_40_ENABLED
th->th.th_current_place = KMP_PLACE_UNDEFINED;
th->th.th_new_place = KMP_PLACE_UNDEFINED;
th->th.th_first_place = 0;
@@ -4937,7 +4901,6 @@ int __kmp_aux_set_affinity(void **mask) {
// Turn off 4.0 affinity for the current tread at this parallel level.
th->th.th_current_task->td_icvs.proc_bind = proc_bind_false;
-#endif
return retval;
}
@@ -4955,7 +4918,7 @@ int __kmp_aux_get_affinity(void **mask) {
th = __kmp_threads[gtid];
KMP_DEBUG_ASSERT(th->th.th_affin_mask != NULL);
- KA_TRACE(1000, ; {
+ KA_TRACE(1000, (""); {
char buf[KMP_AFFIN_MASK_PRINT_LEN];
__kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN,
th->th.th_affin_mask);
@@ -4972,7 +4935,7 @@ int __kmp_aux_get_affinity(void **mask) {
#if !KMP_OS_WINDOWS
retval = __kmp_get_system_affinity((kmp_affin_mask_t *)(*mask), FALSE);
- KA_TRACE(1000, ; {
+ KA_TRACE(1000, (""); {
char buf[KMP_AFFIN_MASK_PRINT_LEN];
__kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN,
(kmp_affin_mask_t *)(*mask));
@@ -5006,7 +4969,7 @@ int __kmp_aux_set_affinity_mask_proc(int proc, void **mask) {
return -1;
}
- KA_TRACE(1000, ; {
+ KA_TRACE(1000, (""); {
int gtid = __kmp_entry_gtid();
char buf[KMP_AFFIN_MASK_PRINT_LEN];
__kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN,
@@ -5038,7 +5001,7 @@ int __kmp_aux_unset_affinity_mask_proc(int proc, void **mask) {
return -1;
}
- KA_TRACE(1000, ; {
+ KA_TRACE(1000, (""); {
int gtid = __kmp_entry_gtid();
char buf[KMP_AFFIN_MASK_PRINT_LEN];
__kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN,
@@ -5070,7 +5033,7 @@ int __kmp_aux_get_affinity_mask_proc(int proc, void **mask) {
return -1;
}
- KA_TRACE(1000, ; {
+ KA_TRACE(1000, (""); {
int gtid = __kmp_entry_gtid();
char buf[KMP_AFFIN_MASK_PRINT_LEN];
__kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN,
diff --git a/runtime/src/kmp_affinity.h b/runtime/src/kmp_affinity.h
index 34147fd395bf..c00ad3645661 100644
--- a/runtime/src/kmp_affinity.h
+++ b/runtime/src/kmp_affinity.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_alloc.cpp b/runtime/src/kmp_alloc.cpp
index ae60fef02d12..861940120e90 100644
--- a/runtime/src/kmp_alloc.cpp
+++ b/runtime/src/kmp_alloc.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -34,7 +33,7 @@ typedef kmp_int64 bufsize;
#endif
#else
typedef ssize_t bufsize;
-#endif
+#endif // KMP_OS_WINDOWS
/* The three modes of operation are, fifo search, lifo search, and best-fit */
@@ -1221,74 +1220,216 @@ void ___kmp_thread_free(kmp_info_t *th, void *ptr KMP_SRC_LOC_DECL) {
KE_TRACE(30, ("<- __kmp_thread_free()\n"));
}
-#if OMP_50_ENABLED
/* OMP 5.0 Memory Management support */
-static int (*p_hbw_check)(void);
-static void *(*p_hbw_malloc)(size_t);
-static void (*p_hbw_free)(void *);
-static int (*p_hbw_set_policy)(int);
static const char *kmp_mk_lib_name;
static void *h_memkind;
+/* memkind experimental API: */
+// memkind_alloc
+static void *(*kmp_mk_alloc)(void *k, size_t sz);
+// memkind_free
+static void (*kmp_mk_free)(void *kind, void *ptr);
+// memkind_check_available
+static int (*kmp_mk_check)(void *kind);
+// kinds we are going to use
+static void **mk_default;
+static void **mk_interleave;
+static void **mk_hbw;
+static void **mk_hbw_interleave;
+static void **mk_hbw_preferred;
+static void **mk_hugetlb;
+static void **mk_hbw_hugetlb;
+static void **mk_hbw_preferred_hugetlb;
+
+#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
+static inline void chk_kind(void ***pkind) {
+ KMP_DEBUG_ASSERT(pkind);
+ if (*pkind) // symbol found
+ if (kmp_mk_check(**pkind)) // kind not available or error
+ *pkind = NULL;
+}
+#endif
void __kmp_init_memkind() {
+// as of 2018-07-31 memkind does not support Windows*, exclude it for now
#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
+ // use of statically linked memkind is problematic, as it depends on libnuma
kmp_mk_lib_name = "libmemkind.so";
h_memkind = dlopen(kmp_mk_lib_name, RTLD_LAZY);
if (h_memkind) {
- p_hbw_check = (int (*)())dlsym(h_memkind, "hbw_check_available");
- p_hbw_malloc = (void *(*)(size_t))dlsym(h_memkind, "hbw_malloc");
- p_hbw_free = (void (*)(void *))dlsym(h_memkind, "hbw_free");
- p_hbw_set_policy = (int (*)(int))dlsym(h_memkind, "hbw_set_policy");
- if (p_hbw_check && p_hbw_malloc && p_hbw_free && p_hbw_set_policy) {
+ kmp_mk_check = (int (*)(void *))dlsym(h_memkind, "memkind_check_available");
+ kmp_mk_alloc =
+ (void *(*)(void *, size_t))dlsym(h_memkind, "memkind_malloc");
+ kmp_mk_free = (void (*)(void *, void *))dlsym(h_memkind, "memkind_free");
+ mk_default = (void **)dlsym(h_memkind, "MEMKIND_DEFAULT");
+ if (kmp_mk_check && kmp_mk_alloc && kmp_mk_free && mk_default &&
+ !kmp_mk_check(*mk_default)) {
__kmp_memkind_available = 1;
- if (p_hbw_check() == 0) {
- p_hbw_set_policy(1); // return NULL is not enough memory
- __kmp_hbw_mem_available = 1; // found HBW memory available
- }
- return; // success - all symbols resolved
+ mk_interleave = (void **)dlsym(h_memkind, "MEMKIND_INTERLEAVE");
+ chk_kind(&mk_interleave);
+ mk_hbw = (void **)dlsym(h_memkind, "MEMKIND_HBW");
+ chk_kind(&mk_hbw);
+ mk_hbw_interleave = (void **)dlsym(h_memkind, "MEMKIND_HBW_INTERLEAVE");
+ chk_kind(&mk_hbw_interleave);
+ mk_hbw_preferred = (void **)dlsym(h_memkind, "MEMKIND_HBW_PREFERRED");
+ chk_kind(&mk_hbw_preferred);
+ mk_hugetlb = (void **)dlsym(h_memkind, "MEMKIND_HUGETLB");
+ chk_kind(&mk_hugetlb);
+ mk_hbw_hugetlb = (void **)dlsym(h_memkind, "MEMKIND_HBW_HUGETLB");
+ chk_kind(&mk_hbw_hugetlb);
+ mk_hbw_preferred_hugetlb =
+ (void **)dlsym(h_memkind, "MEMKIND_HBW_PREFERRED_HUGETLB");
+ chk_kind(&mk_hbw_preferred_hugetlb);
+ KE_TRACE(25, ("__kmp_init_memkind: memkind library initialized\n"));
+ return; // success
}
dlclose(h_memkind); // failure
h_memkind = NULL;
}
- p_hbw_check = NULL;
- p_hbw_malloc = NULL;
- p_hbw_free = NULL;
- p_hbw_set_policy = NULL;
+ kmp_mk_check = NULL;
+ kmp_mk_alloc = NULL;
+ kmp_mk_free = NULL;
+ mk_default = NULL;
+ mk_interleave = NULL;
+ mk_hbw = NULL;
+ mk_hbw_interleave = NULL;
+ mk_hbw_preferred = NULL;
+ mk_hugetlb = NULL;
+ mk_hbw_hugetlb = NULL;
+ mk_hbw_preferred_hugetlb = NULL;
#else
kmp_mk_lib_name = "";
h_memkind = NULL;
- p_hbw_check = NULL;
- p_hbw_malloc = NULL;
- p_hbw_free = NULL;
- p_hbw_set_policy = NULL;
+ kmp_mk_check = NULL;
+ kmp_mk_alloc = NULL;
+ kmp_mk_free = NULL;
+ mk_default = NULL;
+ mk_interleave = NULL;
+ mk_hbw = NULL;
+ mk_hbw_interleave = NULL;
+ mk_hbw_preferred = NULL;
+ mk_hugetlb = NULL;
+ mk_hbw_hugetlb = NULL;
+ mk_hbw_preferred_hugetlb = NULL;
#endif
}
void __kmp_fini_memkind() {
#if KMP_OS_UNIX && KMP_DYNAMIC_LIB
+ if (__kmp_memkind_available)
+ KE_TRACE(25, ("__kmp_fini_memkind: finalize memkind library\n"));
if (h_memkind) {
dlclose(h_memkind);
h_memkind = NULL;
}
- p_hbw_check = NULL;
- p_hbw_malloc = NULL;
- p_hbw_free = NULL;
- p_hbw_set_policy = NULL;
+ kmp_mk_check = NULL;
+ kmp_mk_alloc = NULL;
+ kmp_mk_free = NULL;
+ mk_default = NULL;
+ mk_interleave = NULL;
+ mk_hbw = NULL;
+ mk_hbw_interleave = NULL;
+ mk_hbw_preferred = NULL;
+ mk_hugetlb = NULL;
+ mk_hbw_hugetlb = NULL;
+ mk_hbw_preferred_hugetlb = NULL;
#endif
}
-void __kmpc_set_default_allocator(int gtid, const omp_allocator_t *allocator) {
- if (allocator == OMP_NULL_ALLOCATOR)
+omp_allocator_handle_t __kmpc_init_allocator(int gtid, omp_memspace_handle_t ms,
+ int ntraits,
+ omp_alloctrait_t traits[]) {
+ // OpenMP 5.0 only allows predefined memspaces
+ KMP_DEBUG_ASSERT(ms == omp_default_mem_space || ms == omp_low_lat_mem_space ||
+ ms == omp_large_cap_mem_space || ms == omp_const_mem_space ||
+ ms == omp_high_bw_mem_space);
+ kmp_allocator_t *al;
+ int i;
+ al = (kmp_allocator_t *)__kmp_allocate(sizeof(kmp_allocator_t)); // zeroed
+ al->memspace = ms; // not used currently
+ for (i = 0; i < ntraits; ++i) {
+ switch (traits[i].key) {
+ case OMP_ATK_THREADMODEL:
+ case OMP_ATK_ACCESS:
+ case OMP_ATK_PINNED:
+ break;
+ case OMP_ATK_ALIGNMENT:
+ al->alignment = traits[i].value;
+ KMP_ASSERT(IS_POWER_OF_TWO(al->alignment));
+ break;
+ case OMP_ATK_POOL_SIZE:
+ al->pool_size = traits[i].value;
+ break;
+ case OMP_ATK_FALLBACK:
+ al->fb = (omp_alloctrait_value_t)traits[i].value;
+ KMP_DEBUG_ASSERT(
+ al->fb == OMP_ATV_DEFAULT_MEM_FB || al->fb == OMP_ATV_NULL_FB ||
+ al->fb == OMP_ATV_ABORT_FB || al->fb == OMP_ATV_ALLOCATOR_FB);
+ break;
+ case OMP_ATK_FB_DATA:
+ al->fb_data = RCAST(kmp_allocator_t *, traits[i].value);
+ break;
+ case OMP_ATK_PARTITION:
+ al->memkind = RCAST(void **, traits[i].value);
+ break;
+ default:
+ KMP_ASSERT2(0, "Unexpected allocator trait");
+ }
+ }
+ if (al->fb == 0) {
+ // set default allocator
+ al->fb = OMP_ATV_DEFAULT_MEM_FB;
+ al->fb_data = (kmp_allocator_t *)omp_default_mem_alloc;
+ } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ KMP_ASSERT(al->fb_data != NULL);
+ } else if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ al->fb_data = (kmp_allocator_t *)omp_default_mem_alloc;
+ }
+ if (__kmp_memkind_available) {
+ // Let's use memkind library if available
+ if (ms == omp_high_bw_mem_space) {
+ if (al->memkind == (void *)OMP_ATV_INTERLEAVED && mk_hbw_interleave) {
+ al->memkind = mk_hbw_interleave;
+ } else if (mk_hbw_preferred) {
+ // AC: do not try to use MEMKIND_HBW for now, because memkind library
+ // cannot reliably detect exhaustion of HBW memory.
+ // It could be possible using hbw_verify_memory_region() but memkind
+ // manual says: "Using this function in production code may result in
+ // serious performance penalty".
+ al->memkind = mk_hbw_preferred;
+ } else {
+ // HBW is requested but not available --> return NULL allocator
+ __kmp_free(al);
+ return omp_null_allocator;
+ }
+ } else {
+ if (al->memkind == (void *)OMP_ATV_INTERLEAVED && mk_interleave) {
+ al->memkind = mk_interleave;
+ } else {
+ al->memkind = mk_default;
+ }
+ }
+ } else {
+ if (ms == omp_high_bw_mem_space) {
+ // cannot detect HBW memory presence without memkind library
+ __kmp_free(al);
+ return omp_null_allocator;
+ }
+ }
+ return (omp_allocator_handle_t)al;
+}
+
+void __kmpc_destroy_allocator(int gtid, omp_allocator_handle_t allocator) {
+ if (allocator > kmp_max_mem_alloc)
+ __kmp_free(allocator);
+}
+
+void __kmpc_set_default_allocator(int gtid, omp_allocator_handle_t allocator) {
+ if (allocator == omp_null_allocator)
allocator = omp_default_mem_alloc;
- KMP_DEBUG_ASSERT(
- allocator == omp_default_mem_alloc ||
- allocator == omp_large_cap_mem_alloc ||
- allocator == omp_const_mem_alloc || allocator == omp_high_bw_mem_alloc ||
- allocator == omp_low_lat_mem_alloc || allocator == omp_cgroup_mem_alloc ||
- allocator == omp_pteam_mem_alloc || allocator == omp_thread_mem_alloc);
__kmp_threads[gtid]->th.th_def_allocator = allocator;
}
-const omp_allocator_t *__kmpc_get_default_allocator(int gtid) {
+
+omp_allocator_handle_t __kmpc_get_default_allocator(int gtid) {
return __kmp_threads[gtid]->th.th_def_allocator;
}
@@ -1296,44 +1437,137 @@ typedef struct kmp_mem_desc { // Memory block descriptor
void *ptr_alloc; // Pointer returned by allocator
size_t size_a; // Size of allocated memory block (initial+descriptor+align)
void *ptr_align; // Pointer to aligned memory, returned
- const omp_allocator_t *allocator; // allocator
+ kmp_allocator_t *allocator; // allocator
} kmp_mem_desc_t;
static int alignment = sizeof(void *); // let's align to pointer size
-void *__kmpc_alloc(int gtid, size_t size, const omp_allocator_t *allocator) {
+void *__kmpc_alloc(int gtid, size_t size, omp_allocator_handle_t allocator) {
+ void *ptr = NULL;
+ kmp_allocator_t *al;
KMP_DEBUG_ASSERT(__kmp_init_serial);
- if (allocator == OMP_NULL_ALLOCATOR)
+ if (allocator == omp_null_allocator)
allocator = __kmp_threads[gtid]->th.th_def_allocator;
+ KE_TRACE(25, ("__kmpc_alloc: T#%d (%d, %p)\n", gtid, (int)size, allocator));
+ al = RCAST(kmp_allocator_t *, CCAST(omp_allocator_handle_t, allocator));
+
int sz_desc = sizeof(kmp_mem_desc_t);
- void *ptr = NULL;
kmp_mem_desc_t desc;
kmp_uintptr_t addr; // address returned by allocator
kmp_uintptr_t addr_align; // address to return to caller
kmp_uintptr_t addr_descr; // address of memory block descriptor
-
- KE_TRACE(25, ("__kmpc_alloc: T#%d (%d, %p)\n", gtid, (int)size, allocator));
-
- desc.size_a = size + sz_desc + alignment;
- if (allocator == omp_default_mem_alloc)
- ptr = __kmp_allocate(desc.size_a);
- if (allocator == omp_high_bw_mem_alloc && __kmp_hbw_mem_available) {
- KMP_DEBUG_ASSERT(p_hbw_malloc != NULL);
- ptr = p_hbw_malloc(desc.size_a);
+ int align = alignment; // default alignment
+ if (allocator > kmp_max_mem_alloc && al->alignment > 0) {
+ align = al->alignment; // alignment requested by user
}
+ desc.size_a = size + sz_desc + align;
- KE_TRACE(10, ("__kmpc_alloc: T#%d %p=alloc(%d) hbw %d\n", gtid, ptr,
- desc.size_a, __kmp_hbw_mem_available));
+ if (__kmp_memkind_available) {
+ if (allocator < kmp_max_mem_alloc) {
+ // pre-defined allocator
+ if (allocator == omp_high_bw_mem_alloc && mk_hbw_preferred) {
+ ptr = kmp_mk_alloc(*mk_hbw_preferred, desc.size_a);
+ } else {
+ ptr = kmp_mk_alloc(*mk_default, desc.size_a);
+ }
+ } else if (al->pool_size > 0) {
+ // custom allocator with pool size requested
+ kmp_uint64 used =
+ KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, desc.size_a);
+ if (used + desc.size_a > al->pool_size) {
+ // not enough space, need to go fallback path
+ KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, -desc.size_a);
+ if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ al = (kmp_allocator_t *)omp_default_mem_alloc;
+ ptr = kmp_mk_alloc(*mk_default, desc.size_a);
+ } else if (al->fb == OMP_ATV_ABORT_FB) {
+ KMP_ASSERT(0); // abort fallback requested
+ } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ KMP_ASSERT(al != al->fb_data);
+ al = al->fb_data;
+ return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
+ } // else ptr == NULL;
+ } else {
+ // pool has enough space
+ ptr = kmp_mk_alloc(*al->memkind, desc.size_a);
+ if (ptr == NULL) {
+ if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ al = (kmp_allocator_t *)omp_default_mem_alloc;
+ ptr = kmp_mk_alloc(*mk_default, desc.size_a);
+ } else if (al->fb == OMP_ATV_ABORT_FB) {
+ KMP_ASSERT(0); // abort fallback requested
+ } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ KMP_ASSERT(al != al->fb_data);
+ al = al->fb_data;
+ return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
+ }
+ }
+ }
+ } else {
+ // custom allocator, pool size not requested
+ ptr = kmp_mk_alloc(*al->memkind, desc.size_a);
+ if (ptr == NULL) {
+ if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ al = (kmp_allocator_t *)omp_default_mem_alloc;
+ ptr = kmp_mk_alloc(*mk_default, desc.size_a);
+ } else if (al->fb == OMP_ATV_ABORT_FB) {
+ KMP_ASSERT(0); // abort fallback requested
+ } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ KMP_ASSERT(al != al->fb_data);
+ al = al->fb_data;
+ return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
+ }
+ }
+ }
+ } else if (allocator < kmp_max_mem_alloc) {
+ // pre-defined allocator
+ if (allocator == omp_high_bw_mem_alloc) {
+ // ptr = NULL;
+ } else {
+ ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
+ }
+ } else if (al->pool_size > 0) {
+ // custom allocator with pool size requested
+ kmp_uint64 used =
+ KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, desc.size_a);
+ if (used + desc.size_a > al->pool_size) {
+ // not enough space, need to go fallback path
+ KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, -desc.size_a);
+ if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ al = (kmp_allocator_t *)omp_default_mem_alloc;
+ ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
+ } else if (al->fb == OMP_ATV_ABORT_FB) {
+ KMP_ASSERT(0); // abort fallback requested
+ } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ KMP_ASSERT(al != al->fb_data);
+ al = al->fb_data;
+ return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
+ } // else ptr == NULL;
+ } else {
+ // pool has enough space
+ ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
+ if (ptr == NULL && al->fb == OMP_ATV_ABORT_FB) {
+ KMP_ASSERT(0); // abort fallback requested
+ } // no sense to look for another fallback because of same internal alloc
+ }
+ } else {
+ // custom allocator, pool size not requested
+ ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
+ if (ptr == NULL && al->fb == OMP_ATV_ABORT_FB) {
+ KMP_ASSERT(0); // abort fallback requested
+ } // no sense to look for another fallback because of same internal alloc
+ }
+ KE_TRACE(10, ("__kmpc_alloc: T#%d %p=alloc(%d)\n", gtid, ptr, desc.size_a));
if (ptr == NULL)
return NULL;
addr = (kmp_uintptr_t)ptr;
- addr_align = (addr + sz_desc + alignment - 1) & ~(alignment - 1);
+ addr_align = (addr + sz_desc + align - 1) & ~(align - 1);
addr_descr = addr_align - sz_desc;
desc.ptr_alloc = ptr;
desc.ptr_align = (void *)addr_align;
- desc.allocator = allocator;
+ desc.allocator = al;
*((kmp_mem_desc_t *)addr_descr) = desc; // save descriptor contents
KMP_MB();
@@ -1341,11 +1575,14 @@ void *__kmpc_alloc(int gtid, size_t size, const omp_allocator_t *allocator) {
return desc.ptr_align;
}
-void __kmpc_free(int gtid, void *ptr, const omp_allocator_t *allocator) {
+void __kmpc_free(int gtid, void *ptr, const omp_allocator_handle_t allocator) {
KE_TRACE(25, ("__kmpc_free: T#%d free(%p,%p)\n", gtid, ptr, allocator));
if (ptr == NULL)
return;
+ kmp_allocator_t *al;
+ omp_allocator_handle_t oal;
+ al = RCAST(kmp_allocator_t *, CCAST(omp_allocator_handle_t, allocator));
kmp_mem_desc_t desc;
kmp_uintptr_t addr_align; // address to return to caller
kmp_uintptr_t addr_descr; // address of memory block descriptor
@@ -1356,24 +1593,42 @@ void __kmpc_free(int gtid, void *ptr, const omp_allocator_t *allocator) {
KMP_DEBUG_ASSERT(desc.ptr_align == ptr);
if (allocator) {
- KMP_DEBUG_ASSERT(desc.allocator == allocator);
- } else {
- allocator = desc.allocator;
+ KMP_DEBUG_ASSERT(desc.allocator == al || desc.allocator == al->fb_data);
}
- KMP_DEBUG_ASSERT(allocator);
-
- if (allocator == omp_default_mem_alloc)
- __kmp_free(desc.ptr_alloc);
- if (allocator == omp_high_bw_mem_alloc && __kmp_hbw_mem_available) {
- KMP_DEBUG_ASSERT(p_hbw_free != NULL);
- p_hbw_free(desc.ptr_alloc);
+ al = desc.allocator;
+ oal = (omp_allocator_handle_t)al; // cast to void* for comparisons
+ KMP_DEBUG_ASSERT(al);
+
+ if (__kmp_memkind_available) {
+ if (oal < kmp_max_mem_alloc) {
+ // pre-defined allocator
+ if (oal == omp_high_bw_mem_alloc && mk_hbw_preferred) {
+ kmp_mk_free(*mk_hbw_preferred, desc.ptr_alloc);
+ } else {
+ kmp_mk_free(*mk_default, desc.ptr_alloc);
+ }
+ } else {
+ if (al->pool_size > 0) { // custom allocator with pool size requested
+ kmp_uint64 used =
+ KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, -desc.size_a);
+ (void)used; // to suppress compiler warning
+ KMP_DEBUG_ASSERT(used >= desc.size_a);
+ }
+ kmp_mk_free(*al->memkind, desc.ptr_alloc);
+ }
+ } else {
+ if (oal > kmp_max_mem_alloc && al->pool_size > 0) {
+ kmp_uint64 used =
+ KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, -desc.size_a);
+ (void)used; // to suppress compiler warning
+ KMP_DEBUG_ASSERT(used >= desc.size_a);
+ }
+ __kmp_thread_free(__kmp_thread_from_gtid(gtid), desc.ptr_alloc);
}
KE_TRACE(10, ("__kmpc_free: T#%d freed %p (%p)\n", gtid, desc.ptr_alloc,
allocator));
}
-#endif
-
/* If LEAK_MEMORY is defined, __kmp_free() will *not* free memory. It causes
memory leaks, but it may be useful for debugging memory corruptions, used
freed pointers, etc. */
diff --git a/runtime/src/kmp_atomic.cpp b/runtime/src/kmp_atomic.cpp
index 437f1585a47c..f1ee3d2cd486 100644
--- a/runtime/src/kmp_atomic.cpp
+++ b/runtime/src/kmp_atomic.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -675,7 +674,7 @@ static inline void operator/=(kmp_cmplx128_a16_t &lhs,
lhs.q /= rhs.q;
}
-#endif
+#endif // (KMP_ARCH_X86) && KMP_HAVE_QUAD
// ATOMIC implementation routines -----------------------------------------
// One routine for each operation and operand type.
@@ -844,7 +843,7 @@ static inline void operator/=(kmp_cmplx128_a16_t &lhs,
OP_CMPXCHG_WORKAROUND(TYPE, BITS, OP) \
}
// end of the second part of the workaround for C78287
-#endif
+#endif // USE_CMPXCHG_FIX
#else
// -------------------------------------------------------------------------
@@ -1194,8 +1193,8 @@ MIN_MAX_CRITICAL(float16, max_a16, Quad_a16_t, <, 16r,
1) // __kmpc_atomic_float16_max_a16
MIN_MAX_CRITICAL(float16, min_a16, Quad_a16_t, >, 16r,
1) // __kmpc_atomic_float16_min_a16
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// ------------------------------------------------------------------------
// Need separate macros for .EQV. because of the need of complement (~)
// OP ignored for critical sections, ^=~ used instead
@@ -1290,8 +1289,8 @@ ATOMIC_CRITICAL(float16, mul_a16, Quad_a16_t, *, 16r,
1) // __kmpc_atomic_float16_mul_a16
ATOMIC_CRITICAL(float16, div_a16, Quad_a16_t, /, 16r,
1) // __kmpc_atomic_float16_div_a16
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// routines for complex types
#if USE_CMPXCHG_FIX
@@ -1342,10 +1341,8 @@ ATOMIC_CRITICAL(cmplx16, mul_a16, kmp_cmplx128_a16_t, *, 32c,
1) // __kmpc_atomic_cmplx16_mul_a16
ATOMIC_CRITICAL(cmplx16, div_a16, kmp_cmplx128_a16_t, /, 32c,
1) // __kmpc_atomic_cmplx16_div_a16
-#endif
-#endif
-
-#if OMP_40_ENABLED
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// OpenMP 4.0: x = expr binop x for non-commutative operations.
// Supported only on IA-32 architecture and Intel(R) 64
@@ -1524,8 +1521,8 @@ ATOMIC_CRITICAL_REV(float16, sub_a16, Quad_a16_t, -, 16r,
1) // __kmpc_atomic_float16_sub_a16_rev
ATOMIC_CRITICAL_REV(float16, div_a16, Quad_a16_t, /, 16r,
1) // __kmpc_atomic_float16_div_a16_rev
-#endif
-#endif
+#endif // KMP_ARCH_X86
+#endif // KMP_HAVE_QUAD
// routines for complex types
ATOMIC_CRITICAL_REV(cmplx4, sub, kmp_cmplx32, -, 8c,
@@ -1550,14 +1547,12 @@ ATOMIC_CRITICAL_REV(cmplx16, sub_a16, kmp_cmplx128_a16_t, -, 32c,
1) // __kmpc_atomic_cmplx16_sub_a16_rev
ATOMIC_CRITICAL_REV(cmplx16, div_a16, kmp_cmplx128_a16_t, /, 32c,
1) // __kmpc_atomic_cmplx16_div_a16_rev
-#endif
-#endif
+#endif // KMP_ARCH_X86
+#endif // KMP_HAVE_QUAD
#endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
// End of OpenMP 4.0: x = expr binop x for non-commutative operations.
-#endif // OMP_40_ENABLED
-
/* ------------------------------------------------------------------------ */
/* Routines for mixed types of LHS and RHS, when RHS is "larger" */
/* Note: in order to reduce the total number of types combinations */
@@ -1807,7 +1802,7 @@ ATOMIC_CRITICAL_REV_FP(float10, long double, div_rev, /, fp, _Quad, 10r,
1) // __kmpc_atomic_float10_div_rev_fp
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
-#endif
+#endif // KMP_HAVE_QUAD
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
// ------------------------------------------------------------------------
@@ -2021,7 +2016,7 @@ ATOMIC_CRITICAL_READ_WRK(cmplx4, rd, kmp_cmplx32, +, 8c,
#else
ATOMIC_CRITICAL_READ(cmplx4, rd, kmp_cmplx32, +, 8c,
1) // __kmpc_atomic_cmplx4_rd
-#endif
+#endif // (KMP_OS_WINDOWS)
ATOMIC_CRITICAL_READ(cmplx8, rd, kmp_cmplx64, +, 16c,
1) // __kmpc_atomic_cmplx8_rd
ATOMIC_CRITICAL_READ(cmplx10, rd, kmp_cmplx80, +, 20c,
@@ -2034,8 +2029,8 @@ ATOMIC_CRITICAL_READ(float16, a16_rd, Quad_a16_t, +, 16r,
1) // __kmpc_atomic_float16_a16_rd
ATOMIC_CRITICAL_READ(cmplx16, a16_rd, kmp_cmplx128_a16_t, +, 32c,
1) // __kmpc_atomic_cmplx16_a16_rd
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// ------------------------------------------------------------------------
// Atomic WRITE routines
@@ -2109,7 +2104,7 @@ ATOMIC_CMPXCHG_WR(fixed8, wr, kmp_int64, 64, =,
#else
ATOMIC_XCHG_WR(fixed8, wr, kmp_int64, 64, =,
KMP_ARCH_X86) // __kmpc_atomic_fixed8_wr
-#endif
+#endif // (KMP_ARCH_X86)
ATOMIC_XCHG_FLOAT_WR(float4, wr, kmp_real32, 32, =,
KMP_ARCH_X86) // __kmpc_atomic_float4_wr
@@ -2119,14 +2114,14 @@ ATOMIC_CMPXCHG_WR(float8, wr, kmp_real64, 64, =,
#else
ATOMIC_XCHG_FLOAT_WR(float8, wr, kmp_real64, 64, =,
KMP_ARCH_X86) // __kmpc_atomic_float8_wr
-#endif
+#endif // (KMP_ARCH_X86)
ATOMIC_CRITICAL_WR(float10, wr, long double, =, 10r,
1) // __kmpc_atomic_float10_wr
#if KMP_HAVE_QUAD
ATOMIC_CRITICAL_WR(float16, wr, QUAD_LEGACY, =, 16r,
1) // __kmpc_atomic_float16_wr
-#endif
+#endif // KMP_HAVE_QUAD
ATOMIC_CRITICAL_WR(cmplx4, wr, kmp_cmplx32, =, 8c, 1) // __kmpc_atomic_cmplx4_wr
ATOMIC_CRITICAL_WR(cmplx8, wr, kmp_cmplx64, =, 16c,
1) // __kmpc_atomic_cmplx8_wr
@@ -2140,8 +2135,8 @@ ATOMIC_CRITICAL_WR(float16, a16_wr, Quad_a16_t, =, 16r,
1) // __kmpc_atomic_float16_a16_wr
ATOMIC_CRITICAL_WR(cmplx16, a16_wr, kmp_cmplx128_a16_t, =, 32c,
1) // __kmpc_atomic_cmplx16_a16_wr
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// ------------------------------------------------------------------------
// Atomic CAPTURE routines
@@ -2566,6 +2561,8 @@ ATOMIC_CMPX_L_CPT(fixed8, orl_cpt, kmp_int64, 64, ||,
new_value = rhs; \
else \
new_value = old_value; \
+ } else { \
+ new_value = *lhs; \
} \
__kmp_release_atomic_lock(&ATOMIC_LOCK##LCK_ID, gtid); \
return new_value;
@@ -2659,8 +2656,8 @@ MIN_MAX_CRITICAL_CPT(float16, max_a16_cpt, Quad_a16_t, <, 16r,
1) // __kmpc_atomic_float16_max_a16_cpt
MIN_MAX_CRITICAL_CPT(float16, min_a16_cpt, Quad_a16_t, >, 16r,
1) // __kmpc_atomic_float16_mix_a16_cpt
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// ------------------------------------------------------------------------
#ifdef KMP_GOMP_COMPAT
@@ -2784,8 +2781,8 @@ ATOMIC_CRITICAL_CPT(float16, mul_a16_cpt, Quad_a16_t, *, 16r,
1) // __kmpc_atomic_float16_mul_a16_cpt
ATOMIC_CRITICAL_CPT(float16, div_a16_cpt, Quad_a16_t, /, 16r,
1) // __kmpc_atomic_float16_div_a16_cpt
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// routines for complex types
@@ -2833,10 +2830,8 @@ ATOMIC_CRITICAL_CPT(cmplx16, mul_a16_cpt, kmp_cmplx128_a16_t, *, 32c,
1) // __kmpc_atomic_cmplx16_mul_a16_cpt
ATOMIC_CRITICAL_CPT(cmplx16, div_a16_cpt, kmp_cmplx128_a16_t, /, 32c,
1) // __kmpc_atomic_cmplx16_div_a16_cpt
-#endif
-#endif
-
-#if OMP_40_ENABLED
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// OpenMP 4.0: v = x = expr binop x; { v = x; x = expr binop x; } { x = expr
// binop x; v = x; } for non-commutative operations.
@@ -2999,8 +2994,8 @@ ATOMIC_CRITICAL_CPT_REV(float16, sub_a16_cpt_rev, Quad_a16_t, -, 16r,
1) // __kmpc_atomic_float16_sub_a16_cpt_rev
ATOMIC_CRITICAL_CPT_REV(float16, div_a16_cpt_rev, Quad_a16_t, /, 16r,
1) // __kmpc_atomic_float16_div_a16_cpt_rev
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// routines for complex types
@@ -3066,8 +3061,8 @@ ATOMIC_CRITICAL_CPT_REV(cmplx16, sub_a16_cpt_rev, kmp_cmplx128_a16_t, -, 32c,
1) // __kmpc_atomic_cmplx16_sub_a16_cpt_rev
ATOMIC_CRITICAL_CPT_REV(cmplx16, div_a16_cpt_rev, kmp_cmplx128_a16_t, /, 32c,
1) // __kmpc_atomic_cmplx16_div_a16_cpt_rev
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// Capture reverse for mixed type: RHS=float16
#if KMP_HAVE_QUAD
@@ -3246,7 +3241,7 @@ ATOMIC_CMPXCHG_SWP(float8, kmp_real64, 64,
ATOMIC_XCHG_SWP(fixed8, kmp_int64, 64, KMP_ARCH_X86) // __kmpc_atomic_fixed8_swp
ATOMIC_XCHG_FLOAT_SWP(float8, kmp_real64, 64,
KMP_ARCH_X86) // __kmpc_atomic_float8_swp
-#endif
+#endif // (KMP_ARCH_X86)
// ------------------------------------------------------------------------
// Routines for Extended types: long double, _Quad, complex flavours (use
@@ -3301,7 +3296,7 @@ ATOMIC_XCHG_FLOAT_SWP(float8, kmp_real64, 64,
ATOMIC_CRITICAL_SWP(float10, long double, 10r, 1) // __kmpc_atomic_float10_swp
#if KMP_HAVE_QUAD
ATOMIC_CRITICAL_SWP(float16, QUAD_LEGACY, 16r, 1) // __kmpc_atomic_float16_swp
-#endif
+#endif // KMP_HAVE_QUAD
// cmplx4 routine to return void
ATOMIC_CRITICAL_SWP_WRK(cmplx4, kmp_cmplx32, 8c, 1) // __kmpc_atomic_cmplx4_swp
@@ -3317,13 +3312,11 @@ ATOMIC_CRITICAL_SWP(float16_a16, Quad_a16_t, 16r,
1) // __kmpc_atomic_float16_a16_swp
ATOMIC_CRITICAL_SWP(cmplx16_a16, kmp_cmplx128_a16_t, 32c,
1) // __kmpc_atomic_cmplx16_a16_swp
-#endif
-#endif
+#endif // (KMP_ARCH_X86)
+#endif // KMP_HAVE_QUAD
// End of OpenMP 4.0 Capture
-#endif // OMP_40_ENABLED
-
#endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
#undef OP_CRITICAL
@@ -3340,7 +3333,7 @@ void __kmpc_atomic_1(ident_t *id_ref, int gtid, void *lhs, void *rhs,
FALSE /* must use lock */
#else
TRUE
-#endif
+#endif // KMP_ARCH_X86 && defined(KMP_GOMP_COMPAT)
) {
kmp_int8 old_value, new_value;
@@ -3387,7 +3380,7 @@ void __kmpc_atomic_2(ident_t *id_ref, int gtid, void *lhs, void *rhs,
TRUE /* no alignment problems */
#else
!((kmp_uintptr_t)lhs & 0x1) /* make sure address is 2-byte aligned */
-#endif
+#endif // KMP_ARCH_X86 && defined(KMP_GOMP_COMPAT)
) {
kmp_int16 old_value, new_value;
@@ -3436,7 +3429,7 @@ void __kmpc_atomic_4(ident_t *id_ref, int gtid, void *lhs, void *rhs,
TRUE /* no alignment problems */
#else
!((kmp_uintptr_t)lhs & 0x3) /* make sure address is 4-byte aligned */
-#endif
+#endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
) {
kmp_int32 old_value, new_value;
@@ -3486,7 +3479,7 @@ void __kmpc_atomic_8(ident_t *id_ref, int gtid, void *lhs, void *rhs,
TRUE /* no alignment problems */
#else
!((kmp_uintptr_t)lhs & 0x7) /* make sure address is 8-byte aligned */
-#endif
+#endif // KMP_ARCH_X86 && defined(KMP_GOMP_COMPAT)
) {
kmp_int64 old_value, new_value;
diff --git a/runtime/src/kmp_atomic.h b/runtime/src/kmp_atomic.h
index 288916cd27c9..bb01c31646db 100644
--- a/runtime/src/kmp_atomic.h
+++ b/runtime/src/kmp_atomic.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -364,7 +363,7 @@ static inline void __kmp_acquire_atomic_lock(kmp_atomic_lock_t *lck,
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
- ompt_mutex_atomic, 0, kmp_mutex_impl_queuing, (ompt_wait_id_t)lck,
+ ompt_mutex_atomic, 0, kmp_mutex_impl_queuing, (ompt_wait_id_t)(uintptr_t)lck,
OMPT_GET_RETURN_ADDRESS(0));
}
#endif
@@ -374,7 +373,7 @@ static inline void __kmp_acquire_atomic_lock(kmp_atomic_lock_t *lck,
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_atomic, (ompt_wait_id_t)lck, OMPT_GET_RETURN_ADDRESS(0));
+ ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck, OMPT_GET_RETURN_ADDRESS(0));
}
#endif
}
@@ -390,7 +389,7 @@ static inline void __kmp_release_atomic_lock(kmp_atomic_lock_t *lck,
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (ompt_enabled.ompt_callback_mutex_released) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_atomic, (ompt_wait_id_t)lck, OMPT_GET_RETURN_ADDRESS(0));
+ ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck, OMPT_GET_RETURN_ADDRESS(0));
}
#endif
}
@@ -688,8 +687,6 @@ void __kmpc_atomic_cmplx16_div_a16(ident_t *id_ref, int gtid,
#endif
#endif
-#if OMP_40_ENABLED
-
// OpenMP 4.0: x = expr binop x for non-commutative operations.
// Supported only on IA-32 architecture and Intel(R) 64
#if KMP_ARCH_X86 || KMP_ARCH_X86_64
@@ -794,8 +791,6 @@ void __kmpc_atomic_cmplx16_div_a16_rev(ident_t *id_ref, int gtid,
#endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
-#endif // OMP_40_ENABLED
-
// routines for mixed types
// RHS=float8
@@ -1404,8 +1399,6 @@ kmp_cmplx128_a16_t __kmpc_atomic_cmplx16_div_a16_cpt(ident_t *id_ref, int gtid,
void __kmpc_atomic_start(void);
void __kmpc_atomic_end(void);
-#if OMP_40_ENABLED
-
// OpenMP 4.0: v = x = expr binop x; { v = x; x = expr binop x; } { x = expr
// binop x; v = x; } for non-commutative operations.
@@ -1761,8 +1754,6 @@ long double __kmpc_atomic_float10_div_cpt_rev_fp(ident_t *id_ref, int gtid,
// End of OpenMP 4.0 capture
-#endif // OMP_40_ENABLED
-
#endif // KMP_ARCH_X86 || KMP_ARCH_X86_64
/* ------------------------------------------------------------------------ */
diff --git a/runtime/src/kmp_barrier.cpp b/runtime/src/kmp_barrier.cpp
index b8e8d933905a..e17986b16a95 100644
--- a/runtime/src/kmp_barrier.cpp
+++ b/runtime/src/kmp_barrier.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -45,7 +44,8 @@ void __kmp_print_structure(void); // Forward declaration
// ---------------------------- Barrier Algorithms ----------------------------
// Linear Barrier
-static void __kmp_linear_barrier_gather(
+template <bool cancellable = false>
+static bool __kmp_linear_barrier_gather_template(
enum barrier_type bt, kmp_info_t *this_thr, int gtid, int tid,
void (*reduce)(void *, void *) USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(KMP_linear_gather);
@@ -105,7 +105,14 @@ static void __kmp_linear_barrier_gather(
// Wait for worker thread to arrive
kmp_flag_64 flag(&other_threads[i]->th.th_bar[bt].bb.b_arrived,
new_state);
- flag.wait(this_thr, FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ if (cancellable) {
+ bool cancelled = flag.wait_cancellable_nosleep(
+ this_thr, FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ if (cancelled)
+ return true;
+ } else {
+ flag.wait(this_thr, FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ }
ANNOTATE_BARRIER_END(other_threads[i]);
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - write min of the thread time and the other thread
@@ -138,9 +145,11 @@ static void __kmp_linear_barrier_gather(
20,
("__kmp_linear_barrier_gather: T#%d(%d:%d) exit for barrier type %d\n",
gtid, team->t.t_id, tid, bt));
+ return false;
}
-static void __kmp_linear_barrier_release(
+template <bool cancellable = false>
+static bool __kmp_linear_barrier_release_template(
enum barrier_type bt, kmp_info_t *this_thr, int gtid, int tid,
int propagate_icvs USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(KMP_linear_release);
@@ -202,7 +211,15 @@ static void __kmp_linear_barrier_release(
KA_TRACE(20, ("__kmp_linear_barrier_release: T#%d wait go(%p) == %u\n",
gtid, &thr_bar->b_go, KMP_BARRIER_STATE_BUMP));
kmp_flag_64 flag(&thr_bar->b_go, KMP_BARRIER_STATE_BUMP);
- flag.wait(this_thr, TRUE USE_ITT_BUILD_ARG(itt_sync_obj));
+ if (cancellable) {
+ bool cancelled = flag.wait_cancellable_nosleep(
+ this_thr, TRUE USE_ITT_BUILD_ARG(itt_sync_obj));
+ if (cancelled) {
+ return true;
+ }
+ } else {
+ flag.wait(this_thr, TRUE USE_ITT_BUILD_ARG(itt_sync_obj));
+ }
ANNOTATE_BARRIER_END(this_thr);
#if USE_ITT_BUILD && USE_ITT_NOTIFY
if ((__itt_sync_create_ptr && itt_sync_obj == NULL) || KMP_ITT_DEBUG) {
@@ -213,7 +230,7 @@ static void __kmp_linear_barrier_release(
__kmp_itt_task_starting(itt_sync_obj);
if (bt == bs_forkjoin_barrier && TCR_4(__kmp_global.g.g_done))
- return;
+ return false;
itt_sync_obj = __kmp_itt_barrier_object(gtid, bs_forkjoin_barrier);
if (itt_sync_obj != NULL)
@@ -223,7 +240,7 @@ static void __kmp_linear_barrier_release(
#endif /* USE_ITT_BUILD && USE_ITT_NOTIFY */
// Early exit for reaping threads releasing forkjoin barrier
if (bt == bs_forkjoin_barrier && TCR_4(__kmp_global.g.g_done))
- return;
+ return false;
// The worker thread may now assume that the team is valid.
#ifdef KMP_DEBUG
tid = __kmp_tid_from_gtid(gtid);
@@ -240,6 +257,35 @@ static void __kmp_linear_barrier_release(
20,
("__kmp_linear_barrier_release: T#%d(%d:%d) exit for barrier type %d\n",
gtid, team->t.t_id, tid, bt));
+ return false;
+}
+
+static void __kmp_linear_barrier_gather(
+ enum barrier_type bt, kmp_info_t *this_thr, int gtid, int tid,
+ void (*reduce)(void *, void *) USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
+ __kmp_linear_barrier_gather_template<false>(
+ bt, this_thr, gtid, tid, reduce USE_ITT_BUILD_ARG(itt_sync_obj));
+}
+
+static bool __kmp_linear_barrier_gather_cancellable(
+ enum barrier_type bt, kmp_info_t *this_thr, int gtid, int tid,
+ void (*reduce)(void *, void *) USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
+ return __kmp_linear_barrier_gather_template<true>(
+ bt, this_thr, gtid, tid, reduce USE_ITT_BUILD_ARG(itt_sync_obj));
+}
+
+static void __kmp_linear_barrier_release(
+ enum barrier_type bt, kmp_info_t *this_thr, int gtid, int tid,
+ int propagate_icvs USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
+ __kmp_linear_barrier_release_template<false>(
+ bt, this_thr, gtid, tid, propagate_icvs USE_ITT_BUILD_ARG(itt_sync_obj));
+}
+
+static bool __kmp_linear_barrier_release_cancellable(
+ enum barrier_type bt, kmp_info_t *this_thr, int gtid, int tid,
+ int propagate_icvs USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
+ return __kmp_linear_barrier_release_template<true>(
+ bt, this_thr, gtid, tid, propagate_icvs USE_ITT_BUILD_ARG(itt_sync_obj));
}
// Tree barrier
@@ -823,12 +869,10 @@ static void __kmp_hierarchical_barrier_gather(
kmp_uint64 new_state;
int level = team->t.t_level;
-#if OMP_40_ENABLED
if (other_threads[0]
->th.th_teams_microtask) // are we inside the teams construct?
if (this_thr->th.th_teams_size.nteams > 1)
++level; // level was not increased in teams construct for team_of_masters
-#endif
if (level == 1)
thr_bar->use_oncore_barrier = 1;
else
@@ -1053,7 +1097,6 @@ static void __kmp_hierarchical_barrier_release(
nproc = this_thr->th.th_team_nproc;
int level = team->t.t_level;
-#if OMP_40_ENABLED
if (team->t.t_threads[0]
->th.th_teams_microtask) { // are we inside the teams construct?
if (team->t.t_pkfn != (microtask_t)__kmp_teams_master &&
@@ -1062,7 +1105,6 @@ static void __kmp_hierarchical_barrier_release(
if (this_thr->th.th_teams_size.nteams > 1)
++level; // level was not increased in teams construct for team_of_masters
}
-#endif
if (level == 1)
thr_bar->use_oncore_barrier = 1;
else
@@ -1209,24 +1251,49 @@ static void __kmp_hierarchical_barrier_release(
// End of Barrier Algorithms
+// type traits for cancellable value
+// if cancellable is true, then is_cancellable is a normal boolean variable
+// if cancellable is false, then is_cancellable is a compile time constant
+template <bool cancellable> struct is_cancellable {};
+template <> struct is_cancellable<true> {
+ bool value;
+ is_cancellable() : value(false) {}
+ is_cancellable(bool b) : value(b) {}
+ is_cancellable &operator=(bool b) {
+ value = b;
+ return *this;
+ }
+ operator bool() const { return value; }
+};
+template <> struct is_cancellable<false> {
+ is_cancellable &operator=(bool b) { return *this; }
+ constexpr operator bool() const { return false; }
+};
+
// Internal function to do a barrier.
/* If is_split is true, do a split barrier, otherwise, do a plain barrier
If reduce is non-NULL, do a split reduction barrier, otherwise, do a split
barrier
- Returns 0 if master thread, 1 if worker thread. */
-int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
- size_t reduce_size, void *reduce_data,
- void (*reduce)(void *, void *)) {
+ When cancellable = false,
+ Returns 0 if master thread, 1 if worker thread.
+ When cancellable = true
+ Returns 0 if not cancelled, 1 if cancelled. */
+template <bool cancellable = false>
+static int __kmp_barrier_template(enum barrier_type bt, int gtid, int is_split,
+ size_t reduce_size, void *reduce_data,
+ void (*reduce)(void *, void *)) {
KMP_TIME_PARTITIONED_BLOCK(OMP_plain_barrier);
KMP_SET_THREAD_STATE_BLOCK(PLAIN_BARRIER);
int tid = __kmp_tid_from_gtid(gtid);
kmp_info_t *this_thr = __kmp_threads[gtid];
kmp_team_t *team = this_thr->th.th_team;
int status = 0;
+ is_cancellable<cancellable> cancelled;
#if OMPT_SUPPORT && OMPT_OPTIONAL
ompt_data_t *my_task_data;
ompt_data_t *my_parallel_data;
void *return_address;
+ ompt_sync_region_t barrier_kind;
#endif
KA_TRACE(15, ("__kmp_barrier: T#%d(%d:%d) has arrived\n", gtid,
@@ -1239,15 +1306,16 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
my_task_data = OMPT_CUR_TASK_DATA(this_thr);
my_parallel_data = OMPT_CUR_TEAM_DATA(this_thr);
return_address = OMPT_LOAD_RETURN_ADDRESS(gtid);
+ barrier_kind = __ompt_get_barrier_kind(bt, this_thr);
if (ompt_enabled.ompt_callback_sync_region) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
- ompt_sync_region_barrier, ompt_scope_begin, my_parallel_data,
- my_task_data, return_address);
+ barrier_kind, ompt_scope_begin, my_parallel_data, my_task_data,
+ return_address);
}
if (ompt_enabled.ompt_callback_sync_region_wait) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
- ompt_sync_region_barrier, ompt_scope_begin, my_parallel_data,
- my_task_data, return_address);
+ barrier_kind, ompt_scope_begin, my_parallel_data, my_task_data,
+ return_address);
}
#endif
// It is OK to report the barrier state after the barrier begin callback.
@@ -1306,41 +1374,45 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
}
if (KMP_MASTER_TID(tid) && __kmp_tasking_mode != tskm_immediate_exec)
- __kmp_task_team_setup(
- this_thr, team,
- 0); // use 0 to only setup the current team if nthreads > 1
-
- switch (__kmp_barrier_gather_pattern[bt]) {
- case bp_hyper_bar: {
- KMP_ASSERT(__kmp_barrier_gather_branch_bits[bt]); // don't set branch bits
- // to 0; use linear
- __kmp_hyper_barrier_gather(bt, this_thr, gtid, tid,
- reduce USE_ITT_BUILD_ARG(itt_sync_obj));
- break;
- }
- case bp_hierarchical_bar: {
- __kmp_hierarchical_barrier_gather(bt, this_thr, gtid, tid,
- reduce USE_ITT_BUILD_ARG(itt_sync_obj));
- break;
- }
- case bp_tree_bar: {
- KMP_ASSERT(__kmp_barrier_gather_branch_bits[bt]); // don't set branch bits
- // to 0; use linear
- __kmp_tree_barrier_gather(bt, this_thr, gtid, tid,
- reduce USE_ITT_BUILD_ARG(itt_sync_obj));
- break;
- }
- default: {
- __kmp_linear_barrier_gather(bt, this_thr, gtid, tid,
+ // use 0 to only setup the current team if nthreads > 1
+ __kmp_task_team_setup(this_thr, team, 0);
+
+ if (cancellable) {
+ cancelled = __kmp_linear_barrier_gather_cancellable(
+ bt, this_thr, gtid, tid, reduce USE_ITT_BUILD_ARG(itt_sync_obj));
+ } else {
+ switch (__kmp_barrier_gather_pattern[bt]) {
+ case bp_hyper_bar: {
+ // don't set branch bits to 0; use linear
+ KMP_ASSERT(__kmp_barrier_gather_branch_bits[bt]);
+ __kmp_hyper_barrier_gather(bt, this_thr, gtid, tid,
+ reduce USE_ITT_BUILD_ARG(itt_sync_obj));
+ break;
+ }
+ case bp_hierarchical_bar: {
+ __kmp_hierarchical_barrier_gather(
+ bt, this_thr, gtid, tid, reduce USE_ITT_BUILD_ARG(itt_sync_obj));
+ break;
+ }
+ case bp_tree_bar: {
+ // don't set branch bits to 0; use linear
+ KMP_ASSERT(__kmp_barrier_gather_branch_bits[bt]);
+ __kmp_tree_barrier_gather(bt, this_thr, gtid, tid,
reduce USE_ITT_BUILD_ARG(itt_sync_obj));
- }
+ break;
+ }
+ default: {
+ __kmp_linear_barrier_gather(bt, this_thr, gtid, tid,
+ reduce USE_ITT_BUILD_ARG(itt_sync_obj));
+ }
+ }
}
KMP_MB();
if (KMP_MASTER_TID(tid)) {
status = 0;
- if (__kmp_tasking_mode != tskm_immediate_exec) {
+ if (__kmp_tasking_mode != tskm_immediate_exec && !cancelled) {
__kmp_task_team_wait(this_thr, team USE_ITT_BUILD_ARG(itt_sync_obj));
}
#if USE_DEBUGGER
@@ -1349,13 +1421,14 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
team->t.t_bar[bt].b_team_arrived += 1;
#endif
-#if OMP_40_ENABLED
- kmp_int32 cancel_request = KMP_ATOMIC_LD_RLX(&team->t.t_cancel_request);
- // Reset cancellation flag for worksharing constructs
- if (cancel_request == cancel_loop || cancel_request == cancel_sections) {
- KMP_ATOMIC_ST_RLX(&team->t.t_cancel_request, cancel_noreq);
+ if (__kmp_omp_cancellation) {
+ kmp_int32 cancel_request = KMP_ATOMIC_LD_RLX(&team->t.t_cancel_request);
+ // Reset cancellation flag for worksharing constructs
+ if (cancel_request == cancel_loop ||
+ cancel_request == cancel_sections) {
+ KMP_ATOMIC_ST_RLX(&team->t.t_cancel_request, cancel_noreq);
+ }
}
-#endif
#if USE_ITT_BUILD
/* TODO: In case of split reduction barrier, master thread may send
acquired event early, before the final summation into the shared
@@ -1368,9 +1441,7 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
// Barrier - report frame end (only if active_level == 1)
if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
__kmp_forkjoin_frames_mode &&
-#if OMP_40_ENABLED
this_thr->th.th_teams_microtask == NULL &&
-#endif
team->t.t_active_level == 1) {
ident_t *loc = __kmp_threads[gtid]->th.th_ident;
kmp_uint64 cur_time = __itt_get_timestamp();
@@ -1417,31 +1488,36 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
__kmp_itt_barrier_middle(gtid, itt_sync_obj);
#endif /* USE_ITT_BUILD */
}
- if (status == 1 || !is_split) {
- switch (__kmp_barrier_release_pattern[bt]) {
- case bp_hyper_bar: {
- KMP_ASSERT(__kmp_barrier_release_branch_bits[bt]);
- __kmp_hyper_barrier_release(bt, this_thr, gtid, tid,
- FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
- break;
- }
- case bp_hierarchical_bar: {
- __kmp_hierarchical_barrier_release(
+ if ((status == 1 || !is_split) && !cancelled) {
+ if (cancellable) {
+ cancelled = __kmp_linear_barrier_release_cancellable(
bt, this_thr, gtid, tid, FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
- break;
- }
- case bp_tree_bar: {
- KMP_ASSERT(__kmp_barrier_release_branch_bits[bt]);
- __kmp_tree_barrier_release(bt, this_thr, gtid, tid,
- FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
- break;
- }
- default: {
- __kmp_linear_barrier_release(bt, this_thr, gtid, tid,
+ } else {
+ switch (__kmp_barrier_release_pattern[bt]) {
+ case bp_hyper_bar: {
+ KMP_ASSERT(__kmp_barrier_release_branch_bits[bt]);
+ __kmp_hyper_barrier_release(bt, this_thr, gtid, tid,
+ FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ break;
+ }
+ case bp_hierarchical_bar: {
+ __kmp_hierarchical_barrier_release(
+ bt, this_thr, gtid, tid, FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ break;
+ }
+ case bp_tree_bar: {
+ KMP_ASSERT(__kmp_barrier_release_branch_bits[bt]);
+ __kmp_tree_barrier_release(bt, this_thr, gtid, tid,
FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ break;
+ }
+ default: {
+ __kmp_linear_barrier_release(bt, this_thr, gtid, tid,
+ FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ }
+ }
}
- }
- if (__kmp_tasking_mode != tskm_immediate_exec) {
+ if (__kmp_tasking_mode != tskm_immediate_exec && !cancelled) {
__kmp_task_team_sync(this_thr, team);
}
}
@@ -1456,7 +1532,6 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
} else { // Team is serialized.
status = 0;
if (__kmp_tasking_mode != tskm_immediate_exec) {
-#if OMP_45_ENABLED
if (this_thr->th.th_task_team != NULL) {
#if USE_ITT_NOTIFY
void *itt_sync_obj = NULL;
@@ -1476,12 +1551,6 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
__kmp_itt_barrier_finished(gtid, itt_sync_obj);
#endif /* USE_ITT_BUILD */
}
-#else
- // The task team should be NULL for serialized code (tasks will be
- // executed immediately)
- KMP_DEBUG_ASSERT(team->t.t_task_team[this_thr->th.th_task_state] == NULL);
- KMP_DEBUG_ASSERT(this_thr->th.th_task_team == NULL);
-#endif
}
}
KA_TRACE(15, ("__kmp_barrier: T#%d(%d:%d) is leaving with return value %d\n",
@@ -1493,13 +1562,13 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
#if OMPT_OPTIONAL
if (ompt_enabled.ompt_callback_sync_region_wait) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
- ompt_sync_region_barrier, ompt_scope_end, my_parallel_data,
- my_task_data, return_address);
+ barrier_kind, ompt_scope_end, my_parallel_data, my_task_data,
+ return_address);
}
if (ompt_enabled.ompt_callback_sync_region) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
- ompt_sync_region_barrier, ompt_scope_end, my_parallel_data,
- my_task_data, return_address);
+ barrier_kind, ompt_scope_end, my_parallel_data, my_task_data,
+ return_address);
}
#endif
this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
@@ -1507,9 +1576,43 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
#endif
ANNOTATE_BARRIER_END(&team->t.t_bar);
+ if (cancellable)
+ return (int)cancelled;
return status;
}
+// Returns 0 if master thread, 1 if worker thread.
+int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
+ size_t reduce_size, void *reduce_data,
+ void (*reduce)(void *, void *)) {
+ return __kmp_barrier_template<>(bt, gtid, is_split, reduce_size, reduce_data,
+ reduce);
+}
+
+#if defined(KMP_GOMP_COMPAT)
+// Returns 1 if cancelled, 0 otherwise
+int __kmp_barrier_gomp_cancel(int gtid) {
+ if (__kmp_omp_cancellation) {
+ int cancelled = __kmp_barrier_template<true>(bs_plain_barrier, gtid, FALSE,
+ 0, NULL, NULL);
+ if (cancelled) {
+ int tid = __kmp_tid_from_gtid(gtid);
+ kmp_info_t *this_thr = __kmp_threads[gtid];
+ if (KMP_MASTER_TID(tid)) {
+ // Master does not need to revert anything
+ } else {
+ // Workers need to revert their private b_arrived flag
+ this_thr->th.th_bar[bs_plain_barrier].bb.b_arrived -=
+ KMP_BARRIER_STATE_BUMP;
+ }
+ }
+ return cancelled;
+ }
+ __kmp_barrier(bs_plain_barrier, gtid, FALSE, 0, NULL, NULL);
+ return FALSE;
+}
+#endif
+
void __kmp_end_split_barrier(enum barrier_type bt, int gtid) {
KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(KMP_end_split_barrier);
KMP_SET_THREAD_STATE_BLOCK(PLAIN_BARRIER);
@@ -1613,12 +1716,12 @@ void __kmp_join_barrier(int gtid) {
my_parallel_data = OMPT_CUR_TEAM_DATA(this_thr);
if (ompt_enabled.ompt_callback_sync_region) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
- ompt_sync_region_barrier, ompt_scope_begin, my_parallel_data,
+ ompt_sync_region_barrier_implicit, ompt_scope_begin, my_parallel_data,
my_task_data, codeptr);
}
if (ompt_enabled.ompt_callback_sync_region_wait) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
- ompt_sync_region_barrier, ompt_scope_begin, my_parallel_data,
+ ompt_sync_region_barrier_implicit, ompt_scope_begin, my_parallel_data,
my_task_data, codeptr);
}
if (!KMP_MASTER_TID(ds_tid))
@@ -1698,11 +1801,9 @@ void __kmp_join_barrier(int gtid) {
if (__kmp_tasking_mode != tskm_immediate_exec) {
__kmp_task_team_wait(this_thr, team USE_ITT_BUILD_ARG(itt_sync_obj));
}
-#if OMP_50_ENABLED
if (__kmp_display_affinity) {
KMP_CHECK_UPDATE(team->t.t_display_affinity, 0);
}
-#endif
#if KMP_STATS_ENABLED
// Have master thread flag the workers to indicate they are now waiting for
// next parallel region, Also wake them up so they switch their timers to
@@ -1726,10 +1827,7 @@ void __kmp_join_barrier(int gtid) {
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Join barrier - report frame end
if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
- __kmp_forkjoin_frames_mode &&
-#if OMP_40_ENABLED
- this_thr->th.th_teams_microtask == NULL &&
-#endif
+ __kmp_forkjoin_frames_mode && this_thr->th.th_teams_microtask == NULL &&
team->t.t_active_level == 1) {
kmp_uint64 cur_time = __itt_get_timestamp();
ident_t *loc = team->t.t_ident;
@@ -1901,11 +1999,13 @@ void __kmp_fork_barrier(int gtid, int tid) {
codeptr = team->t.ompt_team_info.master_return_address;
if (ompt_enabled.ompt_callback_sync_region_wait) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
- ompt_sync_region_barrier, ompt_scope_end, NULL, task_data, codeptr);
+ ompt_sync_region_barrier_implicit, ompt_scope_end, NULL, task_data,
+ codeptr);
}
if (ompt_enabled.ompt_callback_sync_region) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
- ompt_sync_region_barrier, ompt_scope_end, NULL, task_data, codeptr);
+ ompt_sync_region_barrier_implicit, ompt_scope_end, NULL, task_data,
+ codeptr);
}
#endif
if (!KMP_MASTER_TID(ds_tid) && ompt_enabled.ompt_callback_implicit_task) {
@@ -1968,17 +2068,13 @@ void __kmp_fork_barrier(int gtid, int tid) {
__kmp_task_team_sync(this_thr, team);
}
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
+#if KMP_AFFINITY_SUPPORTED
kmp_proc_bind_t proc_bind = team->t.t_proc_bind;
if (proc_bind == proc_bind_intel) {
-#endif
-#if KMP_AFFINITY_SUPPORTED
// Call dynamic affinity settings
if (__kmp_affinity_type == affinity_balanced && team->t.t_size_changed) {
__kmp_balanced_affinity(this_thr, team->t.t_nproc);
}
-#endif // KMP_AFFINITY_SUPPORTED
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
} else if (proc_bind != proc_bind_false) {
if (this_thr->th.th_new_place == this_thr->th.th_current_place) {
KA_TRACE(100, ("__kmp_fork_barrier: T#%d already in correct place %d\n",
@@ -1988,8 +2084,7 @@ void __kmp_fork_barrier(int gtid, int tid) {
__kmp_affinity_set_place(gtid);
}
}
-#endif
-#if OMP_50_ENABLED
+#endif // KMP_AFFINITY_SUPPORTED
// Perform the display affinity functionality
if (__kmp_display_affinity) {
if (team->t.t_display_affinity
@@ -2005,7 +2100,6 @@ void __kmp_fork_barrier(int gtid, int tid) {
}
if (!KMP_MASTER_TID(tid))
KMP_CHECK_UPDATE(this_thr->th.th_def_allocator, team->t.t_def_allocator);
-#endif
#if USE_ITT_BUILD && USE_ITT_NOTIFY
if (__itt_sync_create_ptr || KMP_ITT_DEBUG) {
diff --git a/runtime/src/kmp_cancel.cpp b/runtime/src/kmp_cancel.cpp
index 5ed91673b77b..d1290493daad 100644
--- a/runtime/src/kmp_cancel.cpp
+++ b/runtime/src/kmp_cancel.cpp
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -16,8 +15,6 @@
#include "ompt-specific.h"
#endif
-#if OMP_40_ENABLED
-
/*!
@ingroup CANCELLATION
@param loc_ref location of the original task directive
@@ -72,7 +69,7 @@ kmp_int32 __kmpc_cancel(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
task_data, type | ompt_cancel_activated,
OMPT_GET_RETURN_ADDRESS(0));
}
-#endif
+#endif // OMPT_SUPPORT && OMPT_OPTIONAL
return 1 /* true */;
}
break;
@@ -332,5 +329,3 @@ int __kmp_get_cancellation_status(int cancel_kind) {
return 0 /* false */;
}
-
-#endif
diff --git a/runtime/src/kmp_config.h.cmake b/runtime/src/kmp_config.h.cmake
index c9ebbc0bd77d..e3a1a8db7714 100644
--- a/runtime/src/kmp_config.h.cmake
+++ b/runtime/src/kmp_config.h.cmake
@@ -3,10 +3,9 @@
*/
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef KMP_CONFIG_H
@@ -65,11 +64,6 @@
#define KMP_LIBRARY_FILE "@LIBOMP_LIB_FILE@"
#define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@
#define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@
-#define LIBOMP_OMP_VERSION @LIBOMP_OMP_VERSION@
-#define OMP_50_ENABLED (LIBOMP_OMP_VERSION >= 50)
-#define OMP_45_ENABLED (LIBOMP_OMP_VERSION >= 45)
-#define OMP_40_ENABLED (LIBOMP_OMP_VERSION >= 40)
-#define OMP_30_ENABLED (LIBOMP_OMP_VERSION >= 30)
#cmakedefine01 LIBOMP_TSAN_SUPPORT
#if LIBOMP_TSAN_SUPPORT
#define TSAN_SUPPORT
diff --git a/runtime/src/kmp_csupport.cpp b/runtime/src/kmp_csupport.cpp
index 61d4a9301120..c778c97022f5 100644
--- a/runtime/src/kmp_csupport.cpp
+++ b/runtime/src/kmp_csupport.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -245,8 +244,6 @@ void __kmpc_pop_num_threads(ident_t *loc, kmp_int32 global_tid) {
/* the num_threads are automatically popped */
}
-#if OMP_40_ENABLED
-
void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid,
kmp_int32 proc_bind) {
KA_TRACE(20, ("__kmpc_push_proc_bind: enter T#%d proc_bind=%d\n", global_tid,
@@ -255,8 +252,6 @@ void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid,
__kmp_push_proc_bind(loc, global_tid, (kmp_proc_bind_t)proc_bind);
}
-#endif /* OMP_40_ENABLED */
-
/*!
@ingroup PARALLEL
@param loc source location information
@@ -345,7 +340,6 @@ void __kmpc_fork_call(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...) {
#endif // KMP_STATS_ENABLED
}
-#if OMP_40_ENABLED
/*!
@ingroup PARALLEL
@param loc source location information
@@ -383,7 +377,15 @@ void __kmpc_fork_teams(ident_t *loc, kmp_int32 argc, kmpc_micro microtask,
va_list ap;
va_start(ap, microtask);
+#if KMP_STATS_ENABLED
KMP_COUNT_BLOCK(OMP_TEAMS);
+ stats_state_e previous_state = KMP_GET_THREAD_STATE();
+ if (previous_state == stats_state_e::SERIAL_REGION) {
+ KMP_EXCHANGE_PARTITIONED_TIMER(OMP_teams_overhead);
+ } else {
+ KMP_PUSH_PARTITIONED_TIMER(OMP_teams_overhead);
+ }
+#endif
// remember teams entry point and nesting level
this_thr->th.th_teams_microtask = microtask;
@@ -426,12 +428,35 @@ void __kmpc_fork_teams(ident_t *loc, kmp_int32 argc, kmpc_micro microtask,
#endif
);
+ // Pop current CG root off list
+ KMP_DEBUG_ASSERT(this_thr->th.th_cg_roots);
+ kmp_cg_root_t *tmp = this_thr->th.th_cg_roots;
+ this_thr->th.th_cg_roots = tmp->up;
+ KA_TRACE(100, ("__kmpc_fork_teams: Thread %p popping node %p and moving up"
+ " to node %p. cg_nthreads was %d\n",
+ this_thr, tmp, this_thr->th.th_cg_roots, tmp->cg_nthreads));
+ KMP_DEBUG_ASSERT(tmp->cg_nthreads);
+ int i = tmp->cg_nthreads--;
+ if (i == 1) { // check is we are the last thread in CG (not always the case)
+ __kmp_free(tmp);
+ }
+ // Restore current task's thread_limit from CG root
+ KMP_DEBUG_ASSERT(this_thr->th.th_cg_roots);
+ this_thr->th.th_current_task->td_icvs.thread_limit =
+ this_thr->th.th_cg_roots->cg_thread_limit;
+
this_thr->th.th_teams_microtask = NULL;
this_thr->th.th_teams_level = 0;
*(kmp_int64 *)(&this_thr->th.th_teams_size) = 0L;
va_end(ap);
+#if KMP_STATS_ENABLED
+ if (previous_state == stats_state_e::SERIAL_REGION) {
+ KMP_EXCHANGE_PARTITIONED_TIMER(OMP_serial);
+ } else {
+ KMP_POP_PARTITIONED_TIMER();
+ }
+#endif // KMP_STATS_ENABLED
}
-#endif /* OMP_40_ENABLED */
// I don't think this function should ever have been exported.
// The __kmpc_ prefix was misapplied. I'm fairly certain that no generated
@@ -485,16 +510,15 @@ void __kmpc_end_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
this_thr = __kmp_threads[global_tid];
serial_team = this_thr->th.th_serial_team;
-#if OMP_45_ENABLED
kmp_task_team_t *task_team = this_thr->th.th_task_team;
-
// we need to wait for the proxy tasks before finishing the thread
if (task_team != NULL && task_team->tt.tt_found_proxy_tasks)
__kmp_task_team_wait(this_thr, serial_team USE_ITT_BUILD_ARG(NULL));
-#endif
KMP_MB();
KMP_DEBUG_ASSERT(serial_team);
@@ -549,9 +573,7 @@ void __kmpc_end_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
serial_team->t.t_dispatch->th_disp_buffer->next;
__kmp_free(disp_buffer);
}
-#if OMP_50_ENABLED
this_thr->th.th_def_allocator = serial_team->t.t_def_allocator; // restore
-#endif
--serial_team->t.t_serialized;
if (serial_team->t.t_serialized == 0) {
@@ -667,7 +689,7 @@ void __kmpc_flush(ident_t *loc) {
// }
// and adding the yield here is good for at least a 10x speedup
// when running >2 threads per core (on the NAS LU benchmark).
- __kmp_yield(TRUE);
+ __kmp_yield();
#endif
#else
#error Unknown or unsupported architecture
@@ -696,11 +718,12 @@ void __kmpc_barrier(ident_t *loc, kmp_int32 global_tid) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
if (__kmp_env_consistency_check) {
if (loc == 0) {
KMP_WARNING(ConstructIdentInvalid); // ??? What does it mean for the user?
}
-
__kmp_check_barrier(global_tid, ct_barrier, loc);
}
@@ -744,6 +767,8 @@ kmp_int32 __kmpc_master(ident_t *loc, kmp_int32 global_tid) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
if (KMP_MASTER_GTID(global_tid)) {
KMP_COUNT_BLOCK(OMP_MASTER);
KMP_PUSH_PARTITIONED_TIMER(OMP_master);
@@ -834,6 +859,8 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
#if USE_ITT_BUILD
__kmp_itt_ordered_prep(gtid);
// TODO: ordered_wait_id
@@ -848,7 +875,7 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
if (ompt_enabled.enabled) {
OMPT_STORE_RETURN_ADDRESS(gtid);
team = __kmp_team_from_gtid(gtid);
- lck = (ompt_wait_id_t)&team->t.t_ordered.dt.t_value;
+ lck = (ompt_wait_id_t)(uintptr_t)&team->t.t_ordered.dt.t_value;
/* OMPT state update */
th->th.ompt_thread_info.wait_id = lck;
th->th.ompt_thread_info.state = ompt_state_wait_ordered;
@@ -857,8 +884,8 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
codeptr_ra = OMPT_LOAD_RETURN_ADDRESS(gtid);
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
- ompt_mutex_ordered, omp_lock_hint_none, kmp_mutex_impl_spin,
- (ompt_wait_id_t)lck, codeptr_ra);
+ ompt_mutex_ordered, omp_lock_hint_none, kmp_mutex_impl_spin, lck,
+ codeptr_ra);
}
}
#endif
@@ -877,7 +904,7 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
/* OMPT event callback */
if (ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_ordered, (ompt_wait_id_t)lck, codeptr_ra);
+ ompt_mutex_ordered, (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
}
}
#endif
@@ -917,7 +944,8 @@ void __kmpc_end_ordered(ident_t *loc, kmp_int32 gtid) {
if (ompt_enabled.ompt_callback_mutex_released) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
ompt_mutex_ordered,
- (ompt_wait_id_t)&__kmp_team_from_gtid(gtid)->t.t_ordered.dt.t_value,
+ (ompt_wait_id_t)(uintptr_t)&__kmp_team_from_gtid(gtid)
+ ->t.t_ordered.dt.t_value,
OMPT_LOAD_RETURN_ADDRESS(gtid));
}
#endif
@@ -965,24 +993,18 @@ __kmp_init_indirect_csptr(kmp_critical_name *crit, ident_t const *loc,
kmp_uint32 spins; \
KMP_FSYNC_PREPARE(l); \
KMP_INIT_YIELD(spins); \
- if (TCR_4(__kmp_nth) > \
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \
- KMP_YIELD(TRUE); \
- } else { \
- KMP_YIELD_SPIN(spins); \
- } \
kmp_backoff_t backoff = __kmp_spin_backoff_params; \
- while ( \
- KMP_ATOMIC_LD_RLX(&l->lk.poll) != tas_free || \
- !__kmp_atomic_compare_store_acq(&l->lk.poll, tas_free, tas_busy)) { \
- __kmp_spin_backoff(&backoff); \
+ do { \
if (TCR_4(__kmp_nth) > \
(__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \
KMP_YIELD(TRUE); \
} else { \
KMP_YIELD_SPIN(spins); \
} \
- } \
+ __kmp_spin_backoff(&backoff); \
+ } while ( \
+ KMP_ATOMIC_LD_RLX(&l->lk.poll) != tas_free || \
+ !__kmp_atomic_compare_store_acq(&l->lk.poll, tas_free, tas_busy)); \
} \
KMP_FSYNC_ACQUIRED(l); \
}
@@ -1068,8 +1090,7 @@ __kmp_init_indirect_csptr(kmp_critical_name *crit, ident_t const *loc,
KMP_LOCK_BUSY(1, futex), NULL, NULL, 0); \
} \
KMP_MB(); \
- KMP_YIELD(TCR_4(__kmp_nth) > \
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)); \
+ KMP_YIELD_OVERSUB(); \
}
#endif // KMP_USE_FUTEX
@@ -1188,7 +1209,7 @@ void __kmpc_critical(ident_t *loc, kmp_int32 global_tid,
ti = __kmp_threads[global_tid]->th.ompt_thread_info;
/* OMPT state update */
prev_state = ti.state;
- ti.wait_id = (ompt_wait_id_t)lck;
+ ti.wait_id = (ompt_wait_id_t)(uintptr_t)lck;
ti.state = ompt_state_wait_critical;
/* OMPT event callback */
@@ -1196,7 +1217,7 @@ void __kmpc_critical(ident_t *loc, kmp_int32 global_tid,
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_critical, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
- (ompt_wait_id_t)crit, codeptr_ra);
+ (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
}
}
#endif
@@ -1216,7 +1237,7 @@ void __kmpc_critical(ident_t *loc, kmp_int32 global_tid,
/* OMPT event callback */
if (ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_critical, (ompt_wait_id_t)crit, codeptr_ra);
+ ompt_mutex_critical, (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
}
}
#endif
@@ -1402,14 +1423,15 @@ void __kmpc_critical_with_hint(ident_t *loc, kmp_int32 global_tid,
ti = __kmp_threads[global_tid]->th.ompt_thread_info;
/* OMPT state update */
prev_state = ti.state;
- ti.wait_id = (ompt_wait_id_t)lck;
+ ti.wait_id = (ompt_wait_id_t)(uintptr_t)lck;
ti.state = ompt_state_wait_critical;
/* OMPT event callback */
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_critical, (unsigned int)hint,
- __ompt_get_mutex_impl_type(crit), (ompt_wait_id_t)crit, codeptr);
+ __ompt_get_mutex_impl_type(crit), (ompt_wait_id_t)(uintptr_t)lck,
+ codeptr);
}
}
#endif
@@ -1440,14 +1462,15 @@ void __kmpc_critical_with_hint(ident_t *loc, kmp_int32 global_tid,
ti = __kmp_threads[global_tid]->th.ompt_thread_info;
/* OMPT state update */
prev_state = ti.state;
- ti.wait_id = (ompt_wait_id_t)lck;
+ ti.wait_id = (ompt_wait_id_t)(uintptr_t)lck;
ti.state = ompt_state_wait_critical;
/* OMPT event callback */
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_critical, (unsigned int)hint,
- __ompt_get_mutex_impl_type(0, ilk), (ompt_wait_id_t)crit, codeptr);
+ __ompt_get_mutex_impl_type(0, ilk), (ompt_wait_id_t)(uintptr_t)lck,
+ codeptr);
}
}
#endif
@@ -1467,7 +1490,7 @@ void __kmpc_critical_with_hint(ident_t *loc, kmp_int32 global_tid,
/* OMPT event callback */
if (ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_critical, (ompt_wait_id_t)crit, codeptr);
+ ompt_mutex_critical, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
}
#endif
@@ -1565,7 +1588,8 @@ void __kmpc_end_critical(ident_t *loc, kmp_int32 global_tid,
OMPT_STORE_RETURN_ADDRESS(global_tid);
if (ompt_enabled.ompt_callback_mutex_released) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_critical, (ompt_wait_id_t)crit, OMPT_LOAD_RETURN_ADDRESS(0));
+ ompt_mutex_critical, (ompt_wait_id_t)(uintptr_t)lck,
+ OMPT_LOAD_RETURN_ADDRESS(0));
}
#endif
@@ -1590,6 +1614,8 @@ kmp_int32 __kmpc_barrier_master(ident_t *loc, kmp_int32 global_tid) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
if (__kmp_env_consistency_check)
__kmp_check_barrier(global_tid, ct_barrier, loc);
@@ -1648,6 +1674,8 @@ kmp_int32 __kmpc_barrier_master_nowait(ident_t *loc, kmp_int32 global_tid) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
if (__kmp_env_consistency_check) {
if (loc == 0) {
KMP_WARNING(ConstructIdentInvalid); // ??? What does it mean for the user?
@@ -1843,7 +1871,7 @@ void ompc_set_nested(int flag) {
__kmp_save_internal_controls(thread);
- set__nested(thread, flag ? TRUE : FALSE);
+ set__max_active_levels(thread, flag ? __kmp_dflt_max_active_levels : 1);
}
void ompc_set_max_active_levels(int max_active_levels) {
@@ -1867,7 +1895,6 @@ int ompc_get_team_size(int level) {
return __kmp_get_team_size(__kmp_entry_gtid(), level);
}
-#if OMP_50_ENABLED
/* OpenMP 5.0 Affinity Format API */
void ompc_set_affinity_format(char const *format) {
@@ -1918,7 +1945,6 @@ size_t ompc_capture_affinity(char *buffer, size_t buf_size,
__kmp_str_buf_free(&capture_buf);
return num_required;
}
-#endif /* OMP_50_ENABLED */
void kmpc_set_stacksize(int arg) {
// __kmp_aux_set_stacksize initializes the library if needed
@@ -2189,8 +2215,8 @@ void __kmpc_init_lock_with_hint(ident_t *loc, kmp_int32 gtid, void **user_lock,
if (ompt_enabled.ompt_callback_lock_init) {
ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
ompt_mutex_lock, (omp_lock_hint_t)hint,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
}
@@ -2213,8 +2239,8 @@ void __kmpc_init_nest_lock_with_hint(ident_t *loc, kmp_int32 gtid,
if (ompt_enabled.ompt_callback_lock_init) {
ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
ompt_mutex_nest_lock, (omp_lock_hint_t)hint,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
}
@@ -2239,8 +2265,8 @@ void __kmpc_init_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_lock_init) {
ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
ompt_mutex_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2282,7 +2308,7 @@ void __kmpc_init_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_lock_init) {
ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
ompt_mutex_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
- (ompt_wait_id_t)user_lock, codeptr);
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2311,8 +2337,8 @@ void __kmpc_init_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_lock_init) {
ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
ompt_mutex_nest_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2357,7 +2383,7 @@ void __kmpc_init_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_lock_init) {
ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
ompt_mutex_nest_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
- (ompt_wait_id_t)user_lock, codeptr);
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2393,7 +2419,7 @@ void __kmpc_destroy_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
lck = (kmp_user_lock_p)user_lock;
}
ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
- ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
KMP_D_LOCK_FUNC(user_lock, destroy)((kmp_dyna_lock_t *)user_lock);
@@ -2421,7 +2447,7 @@ void __kmpc_destroy_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
codeptr = OMPT_GET_RETURN_ADDRESS(0);
if (ompt_enabled.ompt_callback_lock_destroy) {
ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
- ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2461,7 +2487,7 @@ void __kmpc_destroy_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
codeptr = OMPT_GET_RETURN_ADDRESS(0);
if (ompt_enabled.ompt_callback_lock_destroy) {
ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
KMP_D_LOCK_FUNC(user_lock, destroy)((kmp_dyna_lock_t *)user_lock);
@@ -2493,7 +2519,7 @@ void __kmpc_destroy_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
codeptr = OMPT_GET_RETURN_ADDRESS(0);
if (ompt_enabled.ompt_callback_lock_destroy) {
ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2538,8 +2564,8 @@ void __kmpc_set_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
#if KMP_USE_INLINED_TAS
@@ -2560,7 +2586,7 @@ void __kmpc_set_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2593,7 +2619,7 @@ void __kmpc_set_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
- (ompt_wait_id_t)lck, codeptr);
+ (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
#endif
@@ -2606,7 +2632,7 @@ void __kmpc_set_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
#endif
@@ -2628,8 +2654,8 @@ void __kmpc_set_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_nest_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
}
#endif
@@ -2646,13 +2672,14 @@ void __kmpc_set_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquired) {
// lock_first
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock,
+ codeptr);
}
} else {
if (ompt_enabled.ompt_callback_nest_lock) {
// lock_next
ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
- ompt_scope_begin, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_scope_begin, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
}
}
@@ -2690,7 +2717,8 @@ void __kmpc_set_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_nest_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(), (ompt_wait_id_t)lck, codeptr);
+ __ompt_get_mutex_impl_type(), (ompt_wait_id_t)(uintptr_t)lck,
+ codeptr);
}
}
#endif
@@ -2707,13 +2735,13 @@ void __kmpc_set_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquired) {
// lock_first
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
} else {
if (ompt_enabled.ompt_callback_nest_lock) {
// lock_next
ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
- ompt_scope_begin, (ompt_wait_id_t)lck, codeptr);
+ ompt_scope_begin, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
}
}
@@ -2749,7 +2777,7 @@ void __kmpc_unset_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
codeptr = OMPT_GET_RETURN_ADDRESS(0);
if (ompt_enabled.ompt_callback_mutex_released) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
@@ -2778,7 +2806,7 @@ void __kmpc_unset_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
codeptr = OMPT_GET_RETURN_ADDRESS(0);
if (ompt_enabled.ompt_callback_mutex_released) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
#endif
@@ -2810,7 +2838,7 @@ void __kmpc_unset_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
codeptr = OMPT_GET_RETURN_ADDRESS(0);
if (ompt_enabled.ompt_callback_mutex_released) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
#endif
@@ -2838,12 +2866,13 @@ void __kmpc_unset_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_released) {
// release_lock_last
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock,
+ codeptr);
}
} else if (ompt_enabled.ompt_callback_nest_lock) {
// release_lock_prev
ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
- ompt_scope_end, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_scope_end, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
}
#endif
@@ -2887,12 +2916,12 @@ void __kmpc_unset_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_released) {
// release_lock_last
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
} else if (ompt_enabled.ompt_callback_nest_lock) {
// release_lock_previous
ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
- ompt_mutex_scope_end, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_scope_end, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
}
#endif
@@ -2929,12 +2958,12 @@ void __kmpc_unset_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_released) {
// release_lock_last
ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
} else if (ompt_enabled.ompt_callback_nest_lock) {
// release_lock_previous
ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
- ompt_mutex_scope_end, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_scope_end, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
}
#endif
@@ -2960,8 +2989,8 @@ int __kmpc_test_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
#if KMP_USE_INLINED_TAS
@@ -2983,7 +3012,7 @@ int __kmpc_test_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
return FTN_TRUE;
@@ -3024,7 +3053,7 @@ int __kmpc_test_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
- (ompt_wait_id_t)lck, codeptr);
+ (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
#endif
@@ -3039,7 +3068,7 @@ int __kmpc_test_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
#if OMPT_SUPPORT && OMPT_OPTIONAL
if (rc && ompt_enabled.ompt_callback_mutex_acquired) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
#endif
@@ -3065,8 +3094,8 @@ int __kmpc_test_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_nest_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
- codeptr);
+ __ompt_get_mutex_impl_type(user_lock),
+ (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
#endif
rc = KMP_D_LOCK_FUNC(user_lock, test)((kmp_dyna_lock_t *)user_lock, gtid);
@@ -3083,13 +3112,14 @@ int __kmpc_test_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquired) {
// lock_first
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock,
+ codeptr);
}
} else {
if (ompt_enabled.ompt_callback_nest_lock) {
// lock_next
ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
- ompt_scope_begin, (ompt_wait_id_t)user_lock, codeptr);
+ ompt_scope_begin, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
}
}
}
@@ -3130,7 +3160,8 @@ int __kmpc_test_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
ompt_enabled.ompt_callback_mutex_acquire) {
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
ompt_mutex_nest_lock, omp_lock_hint_none,
- __ompt_get_mutex_impl_type(), (ompt_wait_id_t)lck, codeptr);
+ __ompt_get_mutex_impl_type(), (ompt_wait_id_t)(uintptr_t)lck,
+ codeptr);
}
#endif
@@ -3148,13 +3179,13 @@ int __kmpc_test_nest_lock(ident_t *loc, kmp_int32 gtid, void **user_lock) {
if (ompt_enabled.ompt_callback_mutex_acquired) {
// lock_first
ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
- ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
} else {
if (ompt_enabled.ompt_callback_nest_lock) {
// lock_next
ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
- ompt_mutex_scope_begin, (ompt_wait_id_t)lck, codeptr);
+ ompt_mutex_scope_begin, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
}
}
}
@@ -3288,7 +3319,6 @@ __kmp_end_critical_section_reduce_block(ident_t *loc, kmp_int32 global_tid,
#endif // KMP_USE_DYNAMIC_LOCK
} // __kmp_end_critical_section_reduce_block
-#if OMP_40_ENABLED
static __forceinline int
__kmp_swap_teams_for_teams_reduction(kmp_info_t *th, kmp_team_t **team_p,
int *task_state) {
@@ -3323,7 +3353,6 @@ __kmp_restore_swapped_teams(kmp_info_t *th, kmp_team_t *team, int task_state) {
th->th.th_task_team = team->t.t_task_team[task_state];
th->th.th_task_state = task_state;
}
-#endif
/* 2.a.i. Reduce Block without a terminating barrier */
/*!
@@ -3350,11 +3379,9 @@ __kmpc_reduce_nowait(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
KMP_COUNT_BLOCK(REDUCE_nowait);
int retval = 0;
PACKED_REDUCTION_METHOD_T packed_reduction_method;
-#if OMP_40_ENABLED
kmp_info_t *th;
kmp_team_t *team;
int teams_swapped = 0, task_state;
-#endif
KA_TRACE(10, ("__kmpc_reduce_nowait() enter: called T#%d\n", global_tid));
// why do we need this initialization here at all?
@@ -3366,6 +3393,8 @@ __kmpc_reduce_nowait(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
// check correctness of reduce block nesting
#if KMP_USE_DYNAMIC_LOCK
if (__kmp_env_consistency_check)
@@ -3375,10 +3404,8 @@ __kmpc_reduce_nowait(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
__kmp_push_sync(global_tid, ct_reduce, loc, NULL);
#endif
-#if OMP_40_ENABLED
th = __kmp_thread_from_gtid(global_tid);
teams_swapped = __kmp_swap_teams_for_teams_reduction(th, &team, &task_state);
-#endif // OMP_40_ENABLED
// packed_reduction_method value will be reused by __kmp_end_reduce* function,
// the value should be kept in a variable
@@ -3479,11 +3506,9 @@ __kmpc_reduce_nowait(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
// should never reach this block
KMP_ASSERT(0); // "unexpected method"
}
-#if OMP_40_ENABLED
if (teams_swapped) {
__kmp_restore_swapped_teams(th, team, task_state);
}
-#endif
KA_TRACE(
10,
("__kmpc_reduce_nowait() exit: called T#%d: method %08x, returns %08x\n",
@@ -3569,11 +3594,9 @@ kmp_int32 __kmpc_reduce(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
KMP_COUNT_BLOCK(REDUCE_wait);
int retval = 0;
PACKED_REDUCTION_METHOD_T packed_reduction_method;
-#if OMP_40_ENABLED
kmp_info_t *th;
kmp_team_t *team;
int teams_swapped = 0, task_state;
-#endif
KA_TRACE(10, ("__kmpc_reduce() enter: called T#%d\n", global_tid));
@@ -3586,6 +3609,8 @@ kmp_int32 __kmpc_reduce(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
// check correctness of reduce block nesting
#if KMP_USE_DYNAMIC_LOCK
if (__kmp_env_consistency_check)
@@ -3595,10 +3620,8 @@ kmp_int32 __kmpc_reduce(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
__kmp_push_sync(global_tid, ct_reduce, loc, NULL);
#endif
-#if OMP_40_ENABLED
th = __kmp_thread_from_gtid(global_tid);
teams_swapped = __kmp_swap_teams_for_teams_reduction(th, &team, &task_state);
-#endif // OMP_40_ENABLED
packed_reduction_method = __kmp_determine_reduction_method(
loc, global_tid, num_vars, reduce_size, reduce_data, reduce_func, lck);
@@ -3661,16 +3684,13 @@ kmp_int32 __kmpc_reduce(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_vars,
// should never reach this block
KMP_ASSERT(0); // "unexpected method"
}
-#if OMP_40_ENABLED
if (teams_swapped) {
__kmp_restore_swapped_teams(th, team, task_state);
}
-#endif
KA_TRACE(10,
("__kmpc_reduce() exit: called T#%d: method %08x, returns %08x\n",
global_tid, packed_reduction_method, retval));
-
return retval;
}
@@ -3688,18 +3708,14 @@ void __kmpc_end_reduce(ident_t *loc, kmp_int32 global_tid,
kmp_critical_name *lck) {
PACKED_REDUCTION_METHOD_T packed_reduction_method;
-#if OMP_40_ENABLED
kmp_info_t *th;
kmp_team_t *team;
int teams_swapped = 0, task_state;
-#endif
KA_TRACE(10, ("__kmpc_end_reduce() enter: called T#%d\n", global_tid));
-#if OMP_40_ENABLED
th = __kmp_thread_from_gtid(global_tid);
teams_swapped = __kmp_swap_teams_for_teams_reduction(th, &team, &task_state);
-#endif // OMP_40_ENABLED
packed_reduction_method = __KMP_GET_REDUCTION_METHOD(global_tid);
@@ -3707,7 +3723,6 @@ void __kmpc_end_reduce(ident_t *loc, kmp_int32 global_tid,
// tool (it's a terminating barrier on constructs if NOWAIT not specified)
if (packed_reduction_method == critical_reduce_block) {
-
__kmp_end_critical_section_reduce_block(loc, global_tid, lck);
// TODO: implicit barrier: should be exposed
@@ -3788,11 +3803,9 @@ void __kmpc_end_reduce(ident_t *loc, kmp_int32 global_tid,
// should never reach this block
KMP_ASSERT(0); // "unexpected method"
}
-#if OMP_40_ENABLED
if (teams_swapped) {
__kmp_restore_swapped_teams(th, team, task_state);
}
-#endif
if (__kmp_env_consistency_check)
__kmp_pop_sync(global_tid, ct_reduce, loc);
@@ -3838,7 +3851,6 @@ kmp_uint64 __kmpc_get_parent_taskid() {
} // __kmpc_get_parent_taskid
-#if OMP_45_ENABLED
/*!
@ingroup WORK_SHARING
@param loc source location information.
@@ -3932,8 +3944,8 @@ void __kmpc_doacross_init(ident_t *loc, int gtid, int num_dims,
// __kmp_dispatch_num_buffers)
if (idx != sh_buf->doacross_buf_idx) {
// Shared buffer is occupied, wait for it to be free
- __kmp_wait_yield_4((volatile kmp_uint32 *)&sh_buf->doacross_buf_idx, idx,
- __kmp_eq_4, NULL);
+ __kmp_wait_4((volatile kmp_uint32 *)&sh_buf->doacross_buf_idx, idx,
+ __kmp_eq_4, NULL);
}
#if KMP_32_BIT_ARCH
// Check if we are the first thread. After the CAS the first thread gets 0,
@@ -4150,15 +4162,26 @@ void __kmpc_doacross_fini(ident_t *loc, int gtid) {
pr_buf->th_doacross_info = NULL;
KA_TRACE(20, ("__kmpc_doacross_fini() exit: T#%d\n", gtid));
}
-#endif
-#if OMP_50_ENABLED
+/* omp_alloc/omp_free only defined for C/C++, not for Fortran */
+void *omp_alloc(size_t size, omp_allocator_handle_t allocator) {
+ return __kmpc_alloc(__kmp_entry_gtid(), size, allocator);
+}
+
+void omp_free(void *ptr, omp_allocator_handle_t allocator) {
+ __kmpc_free(__kmp_entry_gtid(), ptr, allocator);
+}
+
int __kmpc_get_target_offload(void) {
if (!__kmp_init_serial) {
__kmp_serial_initialize();
}
return __kmp_target_offload;
}
-#endif // OMP_50_ENABLED
-// end of file //
+int __kmpc_pause_resource(kmp_pause_status_t level) {
+ if (!__kmp_init_serial) {
+ return 1; // Can't pause if runtime is not initialized
+ }
+ return __kmp_pause_resource(level);
+}
diff --git a/runtime/src/kmp_debug.cpp b/runtime/src/kmp_debug.cpp
index 50d3876abf84..6c397c5d8e25 100644
--- a/runtime/src/kmp_debug.cpp
+++ b/runtime/src/kmp_debug.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_debug.h b/runtime/src/kmp_debug.h
index 29cc15c5cf8c..08d52cc04a10 100644
--- a/runtime/src/kmp_debug.h
+++ b/runtime/src/kmp_debug.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_debugger.cpp b/runtime/src/kmp_debugger.cpp
index 8de2cbaedba9..490300f9b207 100644
--- a/runtime/src/kmp_debugger.cpp
+++ b/runtime/src/kmp_debugger.cpp
@@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -102,13 +101,11 @@ kmp_omp_struct_info_t __kmp_omp_debug_struct_info = {
offset_and_size_of(kmp_base_info_t, th_bar),
offset_and_size_of(kmp_bstate_t, b_worker_arrived),
-#if OMP_40_ENABLED
// teams information
offset_and_size_of(kmp_base_info_t, th_teams_microtask),
offset_and_size_of(kmp_base_info_t, th_teams_level),
offset_and_size_of(kmp_teams_size_t, nteams),
offset_and_size_of(kmp_teams_size_t, nth),
-#endif
// kmp_desc structure (for info field above)
sizeof(kmp_desc_base_t),
@@ -134,9 +131,7 @@ kmp_omp_struct_info_t __kmp_omp_debug_struct_info = {
offset_and_size_of(kmp_base_team_t, t_pkfn),
offset_and_size_of(kmp_base_team_t, t_task_team),
offset_and_size_of(kmp_base_team_t, t_implicit_task_taskdata),
-#if OMP_40_ENABLED
offset_and_size_of(kmp_base_team_t, t_cancel_request),
-#endif
offset_and_size_of(kmp_base_team_t, t_bar),
offset_and_size_of(kmp_balign_team_t, b_master_arrived),
offset_and_size_of(kmp_balign_team_t, b_team_arrived),
@@ -196,7 +191,6 @@ kmp_omp_struct_info_t __kmp_omp_debug_struct_info = {
offset_and_size_of(kmp_taskdata_t, td_taskwait_counter),
offset_and_size_of(kmp_taskdata_t, td_taskwait_thread),
-#if OMP_40_ENABLED
offset_and_size_of(kmp_taskdata_t, td_taskgroup),
offset_and_size_of(kmp_taskgroup_t, count),
offset_and_size_of(kmp_taskgroup_t, cancel_request),
@@ -208,7 +202,6 @@ kmp_omp_struct_info_t __kmp_omp_debug_struct_info = {
offset_and_size_of(kmp_base_depnode_t, task),
offset_and_size_of(kmp_base_depnode_t, npredecessors),
offset_and_size_of(kmp_base_depnode_t, nrefs),
-#endif
offset_and_size_of(kmp_task_t, routine),
// thread_data_t.
diff --git a/runtime/src/kmp_debugger.h b/runtime/src/kmp_debugger.h
index 6c747b2c8241..7ec74287d721 100644
--- a/runtime/src/kmp_debugger.h
+++ b/runtime/src/kmp_debugger.h
@@ -5,10 +5,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_dispatch.cpp b/runtime/src/kmp_dispatch.cpp
index 1090e9de1d0e..161a2c696357 100644
--- a/runtime/src/kmp_dispatch.cpp
+++ b/runtime/src/kmp_dispatch.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -69,6 +68,20 @@ void __kmp_dispatch_dxo_error(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
}
}
+// Returns either SCHEDULE_MONOTONIC or SCHEDULE_NONMONOTONIC
+static inline int __kmp_get_monotonicity(enum sched_type schedule,
+ bool use_hier = false) {
+ // Pick up the nonmonotonic/monotonic bits from the scheduling type
+ int monotonicity;
+ // default to monotonic
+ monotonicity = SCHEDULE_MONOTONIC;
+ if (SCHEDULE_HAS_NONMONOTONIC(schedule))
+ monotonicity = SCHEDULE_NONMONOTONIC;
+ else if (SCHEDULE_HAS_MONOTONIC(schedule))
+ monotonicity = SCHEDULE_MONOTONIC;
+ return monotonicity;
+}
+
// Initialize a dispatch_private_info_template<T> buffer for a particular
// type of schedule,chunk. The loop description is found in lb (lower bound),
// ub (upper bound), and st (stride). nproc is the number of threads relevant
@@ -96,6 +109,8 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
T tc;
kmp_info_t *th;
kmp_team_t *team;
+ int monotonicity;
+ bool use_hier;
#ifdef KMP_DEBUG
typedef typename traits_t<T>::signed_t ST;
@@ -118,21 +133,21 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
active = !team->t.t_serialized;
#if USE_ITT_BUILD
- int itt_need_metadata_reporting = __itt_metadata_add_ptr &&
- __kmp_forkjoin_frames_mode == 3 &&
- KMP_MASTER_GTID(gtid) &&
-#if OMP_40_ENABLED
- th->th.th_teams_microtask == NULL &&
+ int itt_need_metadata_reporting =
+ __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
+ KMP_MASTER_GTID(gtid) && th->th.th_teams_microtask == NULL &&
+ team->t.t_active_level == 1;
#endif
- team->t.t_active_level == 1;
-#endif
-#if (KMP_STATIC_STEAL_ENABLED)
- if (SCHEDULE_HAS_NONMONOTONIC(schedule))
- // AC: we now have only one implementation of stealing, so use it
- schedule = kmp_sch_static_steal;
- else
+
+#if KMP_USE_HIER_SCHED
+ use_hier = pr->flags.use_hier;
+#else
+ use_hier = false;
#endif
- schedule = SCHEDULE_WITHOUT_MODIFIERS(schedule);
+
+ /* Pick up the nonmonotonic/monotonic bits from the scheduling type */
+ monotonicity = __kmp_get_monotonicity(schedule, use_hier);
+ schedule = SCHEDULE_WITHOUT_MODIFIERS(schedule);
/* Pick up the nomerge/ordered bits from the scheduling type */
if ((schedule >= kmp_nm_lower) && (schedule < kmp_nm_upper)) {
@@ -150,6 +165,10 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
} else {
pr->flags.ordered = FALSE;
}
+ // Ordered overrides nonmonotonic
+ if (pr->flags.ordered) {
+ monotonicity = SCHEDULE_MONOTONIC;
+ }
if (schedule == kmp_sch_static) {
schedule = __kmp_static;
@@ -158,6 +177,8 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
// Use the scheduling specified by OMP_SCHEDULE (or __kmp_sch_default if
// not specified)
schedule = team->t.t_sched.r_sched_type;
+ monotonicity = __kmp_get_monotonicity(schedule, use_hier);
+ schedule = SCHEDULE_WITHOUT_MODIFIERS(schedule);
// Detail the schedule if needed (global controls are differentiated
// appropriately)
if (schedule == kmp_sch_guided_chunked) {
@@ -208,16 +229,23 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
}
#endif
}
-
+#if KMP_STATIC_STEAL_ENABLED
+ // map nonmonotonic:dynamic to static steal
+ if (schedule == kmp_sch_dynamic_chunked) {
+ if (monotonicity == SCHEDULE_NONMONOTONIC)
+ schedule = kmp_sch_static_steal;
+ }
+#endif
/* guided analytical not safe for too many threads */
if (schedule == kmp_sch_guided_analytical_chunked && nproc > 1 << 20) {
schedule = kmp_sch_guided_iterative_chunked;
KMP_WARNING(DispatchManyThreads);
}
-#if OMP_45_ENABLED
if (schedule == kmp_sch_runtime_simd) {
// compiler provides simd_width in the chunk parameter
schedule = team->t.t_sched.r_sched_type;
+ monotonicity = __kmp_get_monotonicity(schedule, use_hier);
+ schedule = SCHEDULE_WITHOUT_MODIFIERS(schedule);
// Detail the schedule if needed (global controls are differentiated
// appropriately)
if (schedule == kmp_sch_static || schedule == kmp_sch_auto ||
@@ -237,15 +265,15 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
{
char *buff;
// create format specifiers before the debug output
- buff = __kmp_str_format("__kmp_dispatch_init: T#%%d new: schedule:%%d"
- " chunk:%%%s\n",
- traits_t<ST>::spec);
+ buff = __kmp_str_format(
+ "__kmp_dispatch_init_algorithm: T#%%d new: schedule:%%d"
+ " chunk:%%%s\n",
+ traits_t<ST>::spec);
KD_TRACE(10, (buff, gtid, schedule, chunk));
__kmp_str_free(&buff);
}
#endif
}
-#endif // OMP_45_ENABLED
pr->u.p.parm1 = chunk;
}
KMP_ASSERT2((kmp_sch_lower < schedule && schedule < kmp_sch_upper),
@@ -284,6 +312,12 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
}
}
+#if KMP_STATS_ENABLED
+ if (KMP_MASTER_GTID(gtid)) {
+ KMP_COUNT_VALUE(OMP_loop_dynamic_total_iterations, tc);
+ }
+#endif
+
pr->u.p.lb = lb;
pr->u.p.ub = ub;
pr->u.p.st = st;
@@ -326,7 +360,10 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
pr->u.p.ub = init + small_chunk + (id < extras ? 1 : 0);
pr->u.p.parm2 = lb;
- // pr->pfields.parm3 = 0; // it's not used in static_steal
+ // parm3 is the number of times to attempt stealing which is
+ // proportional to the number of chunks per thread up until
+ // the maximum value of nproc.
+ pr->u.p.parm3 = KMP_MIN(small_chunk + extras, nproc);
pr->u.p.parm4 = (id + 1) % nproc; // remember neighbour tid
pr->u.p.st = st;
if (traits_t<T>::type_size > 4) {
@@ -349,6 +386,7 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
/* too few iterations: fall-through to kmp_sch_static_balanced */
} // if
/* FALL-THROUGH to static balanced */
+ KMP_FALLTHROUGH();
} // case
#endif
case kmp_sch_static_balanced: {
@@ -418,7 +456,6 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
}
break;
} // case
-#if OMP_45_ENABLED
case kmp_sch_static_balanced_chunked: {
// similar to balanced, but chunk adjusted to multiple of simd width
T nth = nproc;
@@ -433,7 +470,6 @@ void __kmp_dispatch_init_algorithm(ident_t *loc, int gtid,
break;
} // case
case kmp_sch_guided_simd:
-#endif // OMP_45_ENABLED
case kmp_sch_guided_iterative_chunked: {
KD_TRACE(
100,
@@ -740,6 +776,8 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
#if INCLUDE_SSC_MARKS
SSC_MARK_DISPATCH_INIT();
#endif
@@ -804,13 +842,10 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
#if USE_ITT_BUILD
kmp_uint64 cur_chunk = chunk;
- int itt_need_metadata_reporting = __itt_metadata_add_ptr &&
- __kmp_forkjoin_frames_mode == 3 &&
- KMP_MASTER_GTID(gtid) &&
-#if OMP_40_ENABLED
- th->th.th_teams_microtask == NULL &&
-#endif
- team->t.t_active_level == 1;
+ int itt_need_metadata_reporting =
+ __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
+ KMP_MASTER_GTID(gtid) && th->th.th_teams_microtask == NULL &&
+ team->t.t_active_level == 1;
#endif
if (!active) {
pr = reinterpret_cast<dispatch_private_info_template<T> *>(
@@ -854,9 +889,9 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
KD_TRACE(100, ("__kmp_dispatch_init: T#%d before wait: my_buffer_index:%d "
"sh->buffer_index:%d\n",
gtid, my_buffer_index, sh->buffer_index));
- __kmp_wait_yield<kmp_uint32>(&sh->buffer_index, my_buffer_index,
- __kmp_eq<kmp_uint32> USE_ITT_BUILD_ARG(NULL));
- // Note: KMP_WAIT_YIELD() cannot be used there: buffer index and
+ __kmp_wait<kmp_uint32>(&sh->buffer_index, my_buffer_index,
+ __kmp_eq<kmp_uint32> USE_ITT_BUILD_ARG(NULL));
+ // Note: KMP_WAIT() cannot be used there: buffer index and
// my_buffer_index are *always* 32-bit integers.
KMP_MB(); /* is this necessary? */
KD_TRACE(100, ("__kmp_dispatch_init: T#%d after wait: my_buffer_index:%d "
@@ -886,9 +921,7 @@ __kmp_dispatch_init(ident_t *loc, int gtid, enum sched_type schedule, T lb,
break;
case kmp_sch_guided_iterative_chunked:
case kmp_sch_guided_analytical_chunked:
-#if OMP_45_ENABLED
case kmp_sch_guided_simd:
-#endif
schedtype = 2;
break;
default:
@@ -1000,8 +1033,8 @@ static void __kmp_dispatch_finish(int gtid, ident_t *loc) {
}
#endif
- __kmp_wait_yield<UT>(&sh->u.s.ordered_iteration, lower,
- __kmp_ge<UT> USE_ITT_BUILD_ARG(NULL));
+ __kmp_wait<UT>(&sh->u.s.ordered_iteration, lower,
+ __kmp_ge<UT> USE_ITT_BUILD_ARG(NULL));
KMP_MB(); /* is this necessary? */
#ifdef KMP_DEBUG
{
@@ -1069,8 +1102,8 @@ static void __kmp_dispatch_finish_chunk(int gtid, ident_t *loc) {
}
#endif
- __kmp_wait_yield<UT>(&sh->u.s.ordered_iteration, lower,
- __kmp_ge<UT> USE_ITT_BUILD_ARG(NULL));
+ __kmp_wait<UT>(&sh->u.s.ordered_iteration, lower,
+ __kmp_ge<UT> USE_ITT_BUILD_ARG(NULL));
KMP_MB(); /* is this necessary? */
KD_TRACE(1000, ("__kmp_dispatch_finish_chunk: T#%d resetting "
@@ -1174,7 +1207,7 @@ int __kmp_dispatch_next_algorithm(int gtid,
}
if (!status) { // try to steal
kmp_info_t **other_threads = team->t.t_threads;
- int while_limit = nproc; // nproc attempts to find a victim
+ int while_limit = pr->u.p.parm3;
int while_index = 0;
// TODO: algorithm of searching for a victim
// should be cleaned up and measured
@@ -1272,7 +1305,7 @@ int __kmp_dispatch_next_algorithm(int gtid,
if (!status) {
kmp_info_t **other_threads = team->t.t_threads;
- int while_limit = nproc; // nproc attempts to find a victim
+ int while_limit = pr->u.p.parm3;
int while_index = 0;
// TODO: algorithm of searching for a victim
@@ -1547,7 +1580,6 @@ int __kmp_dispatch_next_algorithm(int gtid,
} // case
break;
-#if OMP_45_ENABLED
case kmp_sch_guided_simd: {
// same as iterative but curr-chunk adjusted to be multiple of given
// chunk
@@ -1620,7 +1652,6 @@ int __kmp_dispatch_next_algorithm(int gtid,
} // if
} // case
break;
-#endif // OMP_45_ENABLED
case kmp_sch_guided_analytical_chunked: {
T chunkspec = pr->u.p.parm1;
@@ -2156,10 +2187,8 @@ static void __kmp_dist_get_bounds(ident_t *loc, kmp_int32 gtid,
}
th = __kmp_threads[gtid];
team = th->th.th_team;
-#if OMP_40_ENABLED
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
nteams = th->th.th_teams_size.nteams;
-#endif
team_id = team->t.t_master_tid;
KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
@@ -2485,10 +2514,10 @@ kmp_uint32 __kmp_le_4(kmp_uint32 value, kmp_uint32 checker) {
}
kmp_uint32
-__kmp_wait_yield_4(volatile kmp_uint32 *spinner, kmp_uint32 checker,
- kmp_uint32 (*pred)(kmp_uint32, kmp_uint32),
- void *obj // Higher-level synchronization object, or NULL.
- ) {
+__kmp_wait_4(volatile kmp_uint32 *spinner, kmp_uint32 checker,
+ kmp_uint32 (*pred)(kmp_uint32, kmp_uint32),
+ void *obj // Higher-level synchronization object, or NULL.
+ ) {
// note: we may not belong to a team at this point
volatile kmp_uint32 *spin = spinner;
kmp_uint32 check = checker;
@@ -2505,20 +2534,16 @@ __kmp_wait_yield_4(volatile kmp_uint32 *spinner, kmp_uint32 checker,
split. It causes problems with infinite recursion because of exit lock */
/* if ( TCR_4(__kmp_global.g.g_done) && __kmp_global.g.g_abort)
__kmp_abort_thread(); */
-
- /* if we have waited a bit, or are oversubscribed, yield */
- /* pause is in the following code */
- KMP_YIELD(TCR_4(__kmp_nth) > __kmp_avail_proc);
- KMP_YIELD_SPIN(spins);
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
}
KMP_FSYNC_SPIN_ACQUIRED(obj);
return r;
}
-void __kmp_wait_yield_4_ptr(
- void *spinner, kmp_uint32 checker, kmp_uint32 (*pred)(void *, kmp_uint32),
- void *obj // Higher-level synchronization object, or NULL.
- ) {
+void __kmp_wait_4_ptr(void *spinner, kmp_uint32 checker,
+ kmp_uint32 (*pred)(void *, kmp_uint32),
+ void *obj // Higher-level synchronization object, or NULL.
+ ) {
// note: we may not belong to a team at this point
void *spin = spinner;
kmp_uint32 check = checker;
@@ -2530,10 +2555,9 @@ void __kmp_wait_yield_4_ptr(
// main wait spin loop
while (!f(spin, check)) {
KMP_FSYNC_SPIN_PREPARE(obj);
- /* if we have waited a bit, or are oversubscribed, yield */
+ /* if we have waited a bit, or are noversubscribed, yield */
/* pause is in the following code */
- KMP_YIELD(TCR_4(__kmp_nth) > __kmp_avail_proc);
- KMP_YIELD_SPIN(spins);
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
}
KMP_FSYNC_SPIN_ACQUIRED(obj);
}
diff --git a/runtime/src/kmp_dispatch.h b/runtime/src/kmp_dispatch.h
index 955807113ef1..8b3e98435a3f 100644
--- a/runtime/src/kmp_dispatch.h
+++ b/runtime/src/kmp_dispatch.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -172,11 +171,9 @@ template <typename T> struct dispatch_shared_info_template {
dispatch_shared_info64_t s64;
} u;
volatile kmp_uint32 buffer_index;
-#if OMP_45_ENABLED
volatile kmp_int32 doacross_buf_idx; // teamwise index
kmp_uint32 *doacross_flags; // array of iteration flags (0/1)
kmp_int32 doacross_num_done; // count finished threads
-#endif
#if KMP_USE_HIER_SCHED
kmp_hier_t<T> *hier;
#endif
@@ -270,7 +267,7 @@ template <typename T> kmp_uint32 __kmp_eq(T value, T checker) {
}
/*
- Spin wait loop that first does pause, then yield.
+ Spin wait loop that pauses between checks.
Waits until function returns non-zero when called with *spinner and check.
Does NOT put threads to sleep.
Arguments:
@@ -283,15 +280,14 @@ template <typename T> kmp_uint32 __kmp_eq(T value, T checker) {
is used to report locks consistently. For example, if lock is acquired
immediately, its address is reported to ittnotify via
KMP_FSYNC_ACQUIRED(). However, it lock cannot be acquired immediately
- and lock routine calls to KMP_WAIT_YIELD(), the later should report the
+ and lock routine calls to KMP_WAIT(), the later should report the
same address, not an address of low-level spinner.
#endif // USE_ITT_BUILD
TODO: make inline function (move to header file for icl)
*/
template <typename UT>
-static UT __kmp_wait_yield(volatile UT *spinner, UT checker,
- kmp_uint32 (*pred)(UT, UT)
- USE_ITT_BUILD_ARG(void *obj)) {
+static UT __kmp_wait(volatile UT *spinner, UT checker,
+ kmp_uint32 (*pred)(UT, UT) USE_ITT_BUILD_ARG(void *obj)) {
// note: we may not belong to a team at this point
volatile UT *spin = spinner;
UT check = checker;
@@ -309,12 +305,8 @@ static UT __kmp_wait_yield(volatile UT *spinner, UT checker,
It causes problems with infinite recursion because of exit lock */
/* if ( TCR_4(__kmp_global.g.g_done) && __kmp_global.g.g_abort)
__kmp_abort_thread(); */
-
- // if we are oversubscribed,
- // or have waited a bit (and KMP_LIBRARY=throughput, then yield
- // pause is in the following code
- KMP_YIELD(TCR_4(__kmp_nth) > __kmp_avail_proc);
- KMP_YIELD_SPIN(spins);
+ // If oversubscribed, or have waited a bit then yield.
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
}
KMP_FSYNC_SPIN_ACQUIRED(obj);
return r;
@@ -380,8 +372,8 @@ void __kmp_dispatch_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
__kmp_str_free(&buff);
}
#endif
- __kmp_wait_yield<UT>(&sh->u.s.ordered_iteration, lower,
- __kmp_ge<UT> USE_ITT_BUILD_ARG(NULL));
+ __kmp_wait<UT>(&sh->u.s.ordered_iteration, lower,
+ __kmp_ge<UT> USE_ITT_BUILD_ARG(NULL));
KMP_MB(); /* is this necessary? */
#ifdef KMP_DEBUG
{
diff --git a/runtime/src/kmp_dispatch_hier.h b/runtime/src/kmp_dispatch_hier.h
index 8277eaa5a042..24a6d6691240 100644
--- a/runtime/src/kmp_dispatch_hier.h
+++ b/runtime/src/kmp_dispatch_hier.h
@@ -1,3 +1,15 @@
+/*
+ * kmp_dispatch_hier.h -- hierarchical scheduling methods and data structures
+ */
+
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
#ifndef KMP_DISPATCH_HIER_H
#define KMP_DISPATCH_HIER_H
#include "kmp.h"
@@ -196,7 +208,7 @@ template <typename T> struct kmp_hier_shared_bdata_t {
// Can be used in a unit with between 2 to 8 threads
template <typename T> class core_barrier_impl {
static inline kmp_uint64 get_wait_val(int num_active) {
- kmp_uint64 wait_val;
+ kmp_uint64 wait_val = 0LL;
switch (num_active) {
case 2:
wait_val = 0x0101LL;
@@ -263,8 +275,8 @@ void core_barrier_impl<T>::barrier(kmp_int32 id,
next_wait_value));
char v = (current_wait_value ? 0x1 : 0x0);
(RCAST(volatile char *, &(bdata->val[current_index])))[id] = v;
- __kmp_wait_yield<kmp_uint64>(&(bdata->val[current_index]), current_wait_value,
- __kmp_eq<kmp_uint64> USE_ITT_BUILD_ARG(NULL));
+ __kmp_wait<kmp_uint64>(&(bdata->val[current_index]), current_wait_value,
+ __kmp_eq<kmp_uint64> USE_ITT_BUILD_ARG(NULL));
tdata->wait_val[current_index] = next_wait_value;
tdata->index = next_index;
}
@@ -310,8 +322,8 @@ void counter_barrier_impl<T>::barrier(kmp_int32 id,
next_wait_value));
val = RCAST(volatile kmp_int64 *, &(bdata->val[current_index]));
KMP_TEST_THEN_INC64(val);
- __kmp_wait_yield<kmp_uint64>(&(bdata->val[current_index]), current_wait_value,
- __kmp_ge<kmp_uint64> USE_ITT_BUILD_ARG(NULL));
+ __kmp_wait<kmp_uint64>(&(bdata->val[current_index]), current_wait_value,
+ __kmp_ge<kmp_uint64> USE_ITT_BUILD_ARG(NULL));
tdata->wait_val[current_index] = next_wait_value;
tdata->index = next_index;
}
@@ -412,6 +424,7 @@ template <typename T> struct kmp_hier_top_unit_t {
kmp_int32 is_active() const { return active; }
kmp_int32 get_num_active() const { return active; }
+#ifdef KMP_DEBUG
void print() {
KD_TRACE(
10,
@@ -419,6 +432,7 @@ template <typename T> struct kmp_hier_top_unit_t {
active, &hier_pr, hier_pr.u.p.lb, hier_pr.u.p.ub, hier_pr.u.p.st,
hier_pr.u.p.tc));
}
+#endif
};
// Information regarding a single layer within the scheduling hierarchy
@@ -429,6 +443,7 @@ template <typename T> struct kmp_hier_layer_info_t {
typename traits_t<T>::signed_t chunk; // chunk size associated with schedule
int length; // length of the kmp_hier_top_unit_t array
+#ifdef KMP_DEBUG
// Print this layer's information
void print() {
const char *t = __kmp_get_hier_str(type);
@@ -438,6 +453,7 @@ template <typename T> struct kmp_hier_layer_info_t {
"length:%d\n",
num_active, t, sched, chunk, length));
}
+#endif
};
/*
@@ -675,6 +691,7 @@ public:
sizeof(kmp_hier_top_unit_t<T>) * max);
for (int j = 0; j < max; ++j) {
layers[i][j].active = 0;
+ layers[i][j].hier_pr.flags.use_hier = TRUE;
}
}
valid = true;
@@ -875,6 +892,7 @@ public:
int get_top_level_nproc() const { return top_level_nproc; }
// Return whether this hierarchy is valid or not
bool is_valid() const { return valid; }
+#ifdef KMP_DEBUG
// Print the hierarchy
void print() {
KD_TRACE(10, ("kmp_hier_t:\n"));
@@ -889,6 +907,7 @@ public:
}
}
}
+#endif
};
template <typename T>
@@ -898,8 +917,6 @@ void __kmp_dispatch_init_hierarchy(ident_t *loc, int n,
typename traits_t<T>::signed_t *new_chunks,
T lb, T ub,
typename traits_t<T>::signed_t st) {
- typedef typename traits_t<T>::signed_t ST;
- typedef typename traits_t<T>::unsigned_t UT;
int tid, gtid, num_hw_threads, num_threads_per_layer1, active;
int my_buffer_index;
kmp_info_t *th;
@@ -924,31 +941,30 @@ void __kmp_dispatch_init_hierarchy(ident_t *loc, int n,
KMP_DEBUG_ASSERT(new_chunks);
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
+
th = __kmp_threads[gtid];
team = th->th.th_team;
active = !team->t.t_serialized;
th->th.th_ident = loc;
num_hw_threads = __kmp_hier_max_units[kmp_hier_layer_e::LAYER_THREAD + 1];
+ KMP_DEBUG_ASSERT(th->th.th_dispatch ==
+ &th->th.th_team->t.t_dispatch[th->th.th_info.ds.ds_tid]);
+ my_buffer_index = th->th.th_dispatch->th_disp_index;
+ pr = reinterpret_cast<dispatch_private_info_template<T> *>(
+ &th->th.th_dispatch
+ ->th_disp_buffer[my_buffer_index % __kmp_dispatch_num_buffers]);
+ sh = reinterpret_cast<dispatch_shared_info_template<T> volatile *>(
+ &team->t.t_disp_buffer[my_buffer_index % __kmp_dispatch_num_buffers]);
if (!active) {
KD_TRACE(10, ("__kmp_dispatch_init_hierarchy: T#%d not active parallel. "
"Using normal dispatch functions.\n",
gtid));
- pr = reinterpret_cast<dispatch_private_info_template<T> *>(
- th->th.th_dispatch->th_disp_buffer);
KMP_DEBUG_ASSERT(pr);
pr->flags.use_hier = FALSE;
pr->flags.contains_last = FALSE;
return;
}
- KMP_DEBUG_ASSERT(th->th.th_dispatch ==
- &th->th.th_team->t.t_dispatch[th->th.th_info.ds.ds_tid]);
-
- my_buffer_index = th->th.th_dispatch->th_disp_index;
- pr = reinterpret_cast<dispatch_private_info_template<T> *>(
- &th->th.th_dispatch
- ->th_disp_buffer[my_buffer_index % __kmp_dispatch_num_buffers]);
- sh = reinterpret_cast<dispatch_shared_info_template<T> volatile *>(
- &team->t.t_disp_buffer[my_buffer_index % __kmp_dispatch_num_buffers]);
KMP_DEBUG_ASSERT(pr);
KMP_DEBUG_ASSERT(sh);
pr->flags.use_hier = TRUE;
diff --git a/runtime/src/kmp_environment.cpp b/runtime/src/kmp_environment.cpp
index 22c2941133e1..51bc3cf45589 100644
--- a/runtime/src/kmp_environment.cpp
+++ b/runtime/src/kmp_environment.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_environment.h b/runtime/src/kmp_environment.h
index 474aa3495555..76a9672f3240 100644
--- a/runtime/src/kmp_environment.h
+++ b/runtime/src/kmp_environment.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_error.cpp b/runtime/src/kmp_error.cpp
index 1a708b58758e..b30b26e3ab2b 100644
--- a/runtime/src/kmp_error.cpp
+++ b/runtime/src/kmp_error.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -29,10 +28,8 @@ static char const *cons_text_c[] = {
"\"sections\"",
"work-sharing", /* this is not called "single" because of lowering of
"sections" pragmas */
- "\"taskq\"", "\"taskq\"", "\"taskq ordered\"", "\"critical\"",
- "\"ordered\"", /* in PARALLEL */
+ "\"critical\"", "\"ordered\"", /* in PARALLEL */
"\"ordered\"", /* in PDO */
- "\"ordered\"", /* in TASKQ */
"\"master\"", "\"reduce\"", "\"barrier\""};
#define get_src(ident) ((ident) == NULL ? NULL : (ident)->psource)
@@ -215,9 +212,7 @@ void __kmp_check_workshare(int gtid, enum cons_type ct, ident_t const *ident) {
if (p->stack_top >= p->stack_size) {
__kmp_expand_cons_stack(gtid, p);
}
- if (p->w_top > p->p_top &&
- !(IS_CONS_TYPE_TASKQ(p->stack_data[p->w_top].type) &&
- IS_CONS_TYPE_TASKQ(ct))) {
+ if (p->w_top > p->p_top) {
// We are already in a WORKSHARE construct for this PARALLEL region.
__kmp_error_construct2(kmp_i18n_msg_CnsInvalidNesting, ct, ident,
&p->stack_data[p->w_top]);
@@ -258,8 +253,7 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
if (p->stack_top >= p->stack_size)
__kmp_expand_cons_stack(gtid, p);
- if (ct == ct_ordered_in_parallel || ct == ct_ordered_in_pdo ||
- ct == ct_ordered_in_taskq) {
+ if (ct == ct_ordered_in_parallel || ct == ct_ordered_in_pdo) {
if (p->w_top <= p->p_top) {
/* we are not in a worksharing construct */
#ifdef BUILD_PARALLEL_ORDERED
@@ -271,13 +265,8 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
} else {
/* inside a WORKSHARING construct for this PARALLEL region */
if (!IS_CONS_TYPE_ORDERED(p->stack_data[p->w_top].type)) {
- if (p->stack_data[p->w_top].type == ct_taskq) {
- __kmp_error_construct2(kmp_i18n_msg_CnsNotInTaskConstruct, ct, ident,
- &p->stack_data[p->w_top]);
- } else {
- __kmp_error_construct2(kmp_i18n_msg_CnsNoOrderedClause, ct, ident,
- &p->stack_data[p->w_top]);
- }
+ __kmp_error_construct2(kmp_i18n_msg_CnsNoOrderedClause, ct, ident,
+ &p->stack_data[p->w_top]);
}
}
if (p->s_top > p->p_top && p->s_top > p->w_top) {
@@ -289,10 +278,8 @@ __kmp_check_sync( int gtid, enum cons_type ct, ident_t const * ident, kmp_user_l
if (stack_type == ct_critical ||
((stack_type == ct_ordered_in_parallel ||
- stack_type == ct_ordered_in_pdo ||
- stack_type ==
- ct_ordered_in_taskq) && /* C doesn't allow named ordered;
- ordered in ordered gets error */
+ stack_type == ct_ordered_in_pdo) &&
+ /* C doesn't allow named ordered; ordered in ordered gets error */
p->stack_data[index].ident != NULL &&
(p->stack_data[index].ident->flags & KMP_IDENT_KMPC))) {
/* we are in ORDERED which is inside an ORDERED or CRITICAL construct */
@@ -400,9 +387,8 @@ enum cons_type __kmp_pop_workshare(int gtid, enum cons_type ct,
if (tos != p->w_top ||
(p->stack_data[tos].type != ct &&
- // below are two exceptions to the rule that construct types must match
- !(p->stack_data[tos].type == ct_pdo_ordered && ct == ct_pdo) &&
- !(p->stack_data[tos].type == ct_task_ordered && ct == ct_task))) {
+ // below is the exception to the rule that construct types must match
+ !(p->stack_data[tos].type == ct_pdo_ordered && ct == ct_pdo))) {
__kmp_check_null_func();
__kmp_error_construct2(kmp_i18n_msg_CnsExpectedEnd, ct, ident,
&p->stack_data[tos]);
diff --git a/runtime/src/kmp_error.h b/runtime/src/kmp_error.h
index e1bf8176fab3..fe6fd34299a2 100644
--- a/runtime/src/kmp_error.h
+++ b/runtime/src/kmp_error.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_ftn_cdecl.cpp b/runtime/src/kmp_ftn_cdecl.cpp
index 702fd0d628c4..cf1d429a915c 100644
--- a/runtime/src/kmp_ftn_cdecl.cpp
+++ b/runtime/src/kmp_ftn_cdecl.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_ftn_entry.h b/runtime/src/kmp_ftn_entry.h
index c08e31b034dd..e480e0151e1c 100644
--- a/runtime/src/kmp_ftn_entry.h
+++ b/runtime/src/kmp_ftn_entry.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -21,11 +20,9 @@
#include "kmp_i18n.h"
-#if OMP_50_ENABLED
// For affinity format functions
#include "kmp_io.h"
#include "kmp_str.h"
-#endif
#if OMPT_SUPPORT
#include "ompt-specific.h"
@@ -350,7 +347,6 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_THREADS)(void) {
#endif
}
-#if OMP_50_ENABLED
int FTN_STDCALL FTN_CONTROL_TOOL(int command, int modifier, void *arg) {
#if defined(KMP_STUB) || !OMPT_SUPPORT
return -2;
@@ -369,35 +365,36 @@ int FTN_STDCALL FTN_CONTROL_TOOL(int command, int modifier, void *arg) {
}
/* OpenMP 5.0 Memory Management support */
-void FTN_STDCALL FTN_SET_DEFAULT_ALLOCATOR(const omp_allocator_t *allocator) {
-#ifndef KMP_STUB
- __kmpc_set_default_allocator(__kmp_entry_gtid(), allocator);
-#endif
-}
-const omp_allocator_t *FTN_STDCALL FTN_GET_DEFAULT_ALLOCATOR(void) {
+omp_allocator_handle_t FTN_STDCALL
+FTN_INIT_ALLOCATOR(omp_memspace_handle_t KMP_DEREF m, int KMP_DEREF ntraits,
+ omp_alloctrait_t tr[]) {
#ifdef KMP_STUB
return NULL;
#else
- return __kmpc_get_default_allocator(__kmp_entry_gtid());
+ return __kmpc_init_allocator(__kmp_entry_gtid(), KMP_DEREF m,
+ KMP_DEREF ntraits, tr);
#endif
}
-void *FTN_STDCALL FTN_ALLOC(size_t size, const omp_allocator_t *allocator) {
-#ifdef KMP_STUB
- return malloc(size);
-#else
- return __kmpc_alloc(__kmp_entry_gtid(), size, allocator);
+
+void FTN_STDCALL FTN_DESTROY_ALLOCATOR(omp_allocator_handle_t al) {
+#ifndef KMP_STUB
+ __kmpc_destroy_allocator(__kmp_entry_gtid(), al);
#endif
}
-void FTN_STDCALL FTN_FREE(void *ptr, const omp_allocator_t *allocator) {
+void FTN_STDCALL FTN_SET_DEFAULT_ALLOCATOR(omp_allocator_handle_t al) {
+#ifndef KMP_STUB
+ __kmpc_set_default_allocator(__kmp_entry_gtid(), al);
+#endif
+}
+omp_allocator_handle_t FTN_STDCALL FTN_GET_DEFAULT_ALLOCATOR(void) {
#ifdef KMP_STUB
- free(ptr);
+ return NULL;
#else
- __kmpc_free(__kmp_entry_gtid(), ptr, allocator);
+ return __kmpc_get_default_allocator(__kmp_entry_gtid());
#endif
}
/* OpenMP 5.0 affinity format support */
-
#ifndef KMP_STUB
static void __kmp_fortran_strncpy_truncate(char *buffer, size_t buf_size,
char const *csrc, size_t csrc_size) {
@@ -526,7 +523,6 @@ size_t FTN_STDCALL FTN_CAPTURE_AFFINITY(char *buffer, char const *format,
return num_required;
#endif
}
-#endif /* OMP_50_ENABLED */
int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_THREAD_NUM)(void) {
#ifdef KMP_STUB
@@ -596,6 +592,7 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NUM_PROCS)(void) {
}
void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_NESTED)(int KMP_DEREF flag) {
+ KMP_INFORM(APIDeprecated, "omp_set_nested", "omp_set_max_active_levels");
#ifdef KMP_STUB
__kmps_set_nested(KMP_DEREF flag);
#else
@@ -603,17 +600,22 @@ void FTN_STDCALL KMP_EXPAND_NAME(FTN_SET_NESTED)(int KMP_DEREF flag) {
/* For the thread-private internal controls implementation */
thread = __kmp_entry_thread();
__kmp_save_internal_controls(thread);
- set__nested(thread, ((KMP_DEREF flag) ? TRUE : FALSE));
+ // Somewhat arbitrarily decide where to get a value for max_active_levels
+ int max_active_levels = get__max_active_levels(thread);
+ if (max_active_levels == 1)
+ max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
+ set__max_active_levels(thread, (KMP_DEREF flag) ? max_active_levels : 1);
#endif
}
int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NESTED)(void) {
+ KMP_INFORM(APIDeprecated, "omp_get_nested", "omp_get_max_active_levels");
#ifdef KMP_STUB
return __kmps_get_nested();
#else
kmp_info_t *thread;
thread = __kmp_entry_thread();
- return get__nested(thread);
+ return get__max_active_levels(thread) > 1;
#endif
}
@@ -645,7 +647,6 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_IN_PARALLEL)(void) {
return 0;
#else
kmp_info_t *th = __kmp_entry_thread();
-#if OMP_40_ENABLED
if (th->th.th_teams_microtask) {
// AC: r_in_parallel does not work inside teams construct where real
// parallel is inactive, but all threads have same root, so setting it in
@@ -653,7 +654,6 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_IN_PARALLEL)(void) {
// The solution is to use per-team nesting level
return (th->th.th_team->t.t_active_level ? 1 : 0);
} else
-#endif /* OMP_40_ENABLED */
return (th->th.th_root->r.r_in_parallel ? FTN_TRUE : FTN_FALSE);
#endif
}
@@ -735,11 +735,15 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_THREAD_LIMIT)(void) {
#ifdef KMP_STUB
return 1; // TO DO: clarify whether it returns 1 or 0?
#else
+ int gtid;
+ kmp_info_t *thread;
if (!__kmp_init_serial) {
__kmp_serial_initialize();
}
- /* global ICV */
- return __kmp_cg_max_nth;
+
+ gtid = __kmp_entry_gtid();
+ thread = __kmp_threads[gtid];
+ return thread->th.th_current_task->td_icvs.thread_limit;
#endif
}
@@ -754,8 +758,6 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_IN_FINAL)(void) {
#endif
}
-#if OMP_40_ENABLED
-
kmp_proc_bind_t FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PROC_BIND)(void) {
#ifdef KMP_STUB
return __kmps_get_proc_bind();
@@ -764,7 +766,6 @@ kmp_proc_bind_t FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_PROC_BIND)(void) {
#endif
}
-#if OMP_45_ENABLED
int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NUM_PLACES)(void) {
#if defined(KMP_STUB) || !KMP_AFFINITY_SUPPORTED
return 0;
@@ -902,7 +903,6 @@ void
}
#endif
}
-#endif
int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_NUM_TEAMS)(void) {
#ifdef KMP_STUB
@@ -962,11 +962,6 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_IS_INITIAL_DEVICE)(void) {
return 1; // This is the host
}
-#endif // OMP_40_ENABLED
-
-#if OMP_45_ENABLED
-// OpenMP 4.5 entries
-
// libomptarget, if loaded, provides this function
int FTN_STDCALL FTN_GET_INITIAL_DEVICE(void) KMP_WEAK_ATTRIBUTE;
int FTN_STDCALL FTN_GET_INITIAL_DEVICE(void) {
@@ -1015,7 +1010,6 @@ int FTN_STDCALL FTN_TARGET_DISASSOCIATE_PTR(void *host_ptr, int device_num) {
return -1;
}
#endif // defined(KMP_STUB)
-#endif // OMP_45_ENABLED
#ifdef KMP_STUB
typedef enum { UNINIT = -1, UNLOCKED, LOCKED } kmp_stub_lock_t;
@@ -1288,7 +1282,6 @@ void FTN_STDCALL FTN_SET_DEFAULTS(char const *str
/* ------------------------------------------------------------------------ */
-#if OMP_40_ENABLED
/* returns the status of cancellation */
int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_CANCELLATION)(void) {
#ifdef KMP_STUB
@@ -1310,9 +1303,6 @@ int FTN_STDCALL FTN_GET_CANCELLATION_STATUS(int cancel_kind) {
#endif
}
-#endif // OMP_40_ENABLED
-
-#if OMP_45_ENABLED
/* returns the maximum allowed task priority */
int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_TASK_PRIORITY)(void) {
#ifdef KMP_STUB
@@ -1324,15 +1314,62 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_TASK_PRIORITY)(void) {
return __kmp_max_task_priority;
#endif
}
-#endif
-#if OMP_50_ENABLED
// This function will be defined in libomptarget. When libomptarget is not
// loaded, we assume we are on the host and return KMP_HOST_DEVICE.
// Compiler/libomptarget will handle this if called inside target.
int FTN_STDCALL FTN_GET_DEVICE_NUM(void) KMP_WEAK_ATTRIBUTE;
int FTN_STDCALL FTN_GET_DEVICE_NUM(void) { return KMP_HOST_DEVICE; }
-#endif // OMP_50_ENABLED
+
+// Compiler will ensure that this is only called from host in sequential region
+int FTN_STDCALL FTN_PAUSE_RESOURCE(kmp_pause_status_t kind, int device_num) {
+#ifdef KMP_STUB
+ return 1; // just fail
+#else
+ if (device_num == KMP_HOST_DEVICE)
+ return __kmpc_pause_resource(kind);
+ else {
+#if !KMP_OS_WINDOWS
+ int (*fptr)(kmp_pause_status_t, int);
+ if ((*(void **)(&fptr) = dlsym(RTLD_DEFAULT, "tgt_pause_resource")))
+ return (*fptr)(kind, device_num);
+ else
+#endif
+ return 1; // just fail if there is no libomptarget
+ }
+#endif
+}
+
+// Compiler will ensure that this is only called from host in sequential region
+int FTN_STDCALL FTN_PAUSE_RESOURCE_ALL(kmp_pause_status_t kind) {
+#ifdef KMP_STUB
+ return 1; // just fail
+#else
+ int fails = 0;
+#if !KMP_OS_WINDOWS
+ int (*fptr)(kmp_pause_status_t, int);
+ if ((*(void **)(&fptr) = dlsym(RTLD_DEFAULT, "tgt_pause_resource")))
+ fails = (*fptr)(kind, KMP_DEVICE_ALL); // pause devices
+#endif
+ fails += __kmpc_pause_resource(kind); // pause host
+ return fails;
+#endif
+}
+
+// Returns the maximum number of nesting levels supported by implementation
+int FTN_STDCALL FTN_GET_SUPPORTED_ACTIVE_LEVELS(void) {
+#ifdef KMP_STUB
+ return 1;
+#else
+ return KMP_MAX_ACTIVE_LEVELS_LIMIT;
+#endif
+}
+
+void FTN_STDCALL FTN_FULFILL_EVENT(kmp_event_t *event) {
+#ifndef KMP_STUB
+ __kmp_fulfill_event(event);
+#endif
+}
// GCC compatibility (versioned symbols)
#ifdef KMP_USE_VERSION_SYMBOLS
@@ -1408,7 +1445,6 @@ KMP_VERSION_SYMBOL(FTN_TEST_NEST_LOCK, 30, "OMP_3.0");
// OMP_3.1 versioned symbol
KMP_VERSION_SYMBOL(FTN_IN_FINAL, 31, "OMP_3.1");
-#if OMP_40_ENABLED
// OMP_4.0 versioned symbols
KMP_VERSION_SYMBOL(FTN_GET_PROC_BIND, 40, "OMP_4.0");
KMP_VERSION_SYMBOL(FTN_GET_NUM_TEAMS, 40, "OMP_4.0");
@@ -1418,9 +1454,7 @@ KMP_VERSION_SYMBOL(FTN_GET_DEFAULT_DEVICE, 40, "OMP_4.0");
KMP_VERSION_SYMBOL(FTN_SET_DEFAULT_DEVICE, 40, "OMP_4.0");
KMP_VERSION_SYMBOL(FTN_IS_INITIAL_DEVICE, 40, "OMP_4.0");
KMP_VERSION_SYMBOL(FTN_GET_NUM_DEVICES, 40, "OMP_4.0");
-#endif /* OMP_40_ENABLED */
-#if OMP_45_ENABLED
// OMP_4.5 versioned symbols
KMP_VERSION_SYMBOL(FTN_GET_MAX_TASK_PRIORITY, 45, "OMP_4.5");
KMP_VERSION_SYMBOL(FTN_GET_NUM_PLACES, 45, "OMP_4.5");
@@ -1430,12 +1464,13 @@ KMP_VERSION_SYMBOL(FTN_GET_PLACE_NUM, 45, "OMP_4.5");
KMP_VERSION_SYMBOL(FTN_GET_PARTITION_NUM_PLACES, 45, "OMP_4.5");
KMP_VERSION_SYMBOL(FTN_GET_PARTITION_PLACE_NUMS, 45, "OMP_4.5");
// KMP_VERSION_SYMBOL(FTN_GET_INITIAL_DEVICE, 45, "OMP_4.5");
-#endif
-#if OMP_50_ENABLED
// OMP_5.0 versioned symbols
// KMP_VERSION_SYMBOL(FTN_GET_DEVICE_NUM, 50, "OMP_5.0");
-#endif
+// KMP_VERSION_SYMBOL(FTN_PAUSE_RESOURCE, 50, "OMP_5.0");
+// KMP_VERSION_SYMBOL(FTN_PAUSE_RESOURCE_ALL, 50, "OMP_5.0");
+// KMP_VERSION_SYMBOL(FTN_GET_SUPPORTED_ACTIVE_LEVELS, 50, "OMP_5.0");
+// KMP_VERSION_SYMBOL(FTN_FULFILL_EVENT, 50, "OMP_5.0");
#endif // KMP_USE_VERSION_SYMBOLS
diff --git a/runtime/src/kmp_ftn_extra.cpp b/runtime/src/kmp_ftn_extra.cpp
index ec27dd6e2422..74b3e96ab300 100644
--- a/runtime/src/kmp_ftn_extra.cpp
+++ b/runtime/src/kmp_ftn_extra.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_ftn_os.h b/runtime/src/kmp_ftn_os.h
index 776db392a68d..856479cbe212 100644
--- a/runtime/src/kmp_ftn_os.h
+++ b/runtime/src/kmp_ftn_os.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -71,13 +70,9 @@
#define FTN_GET_ANCESTOR_THREAD_NUM omp_get_ancestor_thread_num
#define FTN_GET_TEAM_SIZE omp_get_team_size
#define FTN_IN_FINAL omp_in_final
-// #define FTN_SET_PROC_BIND omp_set_proc_bind
#define FTN_GET_PROC_BIND omp_get_proc_bind
-// #define FTN_CURR_PROC_BIND omp_curr_proc_bind
-#if OMP_40_ENABLED
#define FTN_GET_NUM_TEAMS omp_get_num_teams
#define FTN_GET_TEAM_NUM omp_get_team_num
-#endif
#define FTN_INIT_LOCK omp_init_lock
#if KMP_USE_DYNAMIC_LOCK
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint
@@ -99,19 +94,14 @@
#define FTN_GET_WTIME omp_get_wtime
#define FTN_GET_WTICK omp_get_wtick
-#if OMP_40_ENABLED
#define FTN_GET_NUM_DEVICES omp_get_num_devices
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device
-#endif
-#if OMP_40_ENABLED
#define FTN_GET_CANCELLATION omp_get_cancellation
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status
-#endif
-#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority
#define FTN_GET_NUM_PLACES omp_get_num_places
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs
@@ -129,20 +119,21 @@
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr
#endif
-#endif
-#if OMP_50_ENABLED
#define FTN_CONTROL_TOOL omp_control_tool
+#define FTN_INIT_ALLOCATOR omp_init_allocator
+#define FTN_DESTROY_ALLOCATOR omp_destroy_allocator
#define FTN_SET_DEFAULT_ALLOCATOR omp_set_default_allocator
#define FTN_GET_DEFAULT_ALLOCATOR omp_get_default_allocator
-#define FTN_ALLOC omp_alloc
-#define FTN_FREE omp_free
#define FTN_GET_DEVICE_NUM omp_get_device_num
#define FTN_SET_AFFINITY_FORMAT omp_set_affinity_format
#define FTN_GET_AFFINITY_FORMAT omp_get_affinity_format
#define FTN_DISPLAY_AFFINITY omp_display_affinity
#define FTN_CAPTURE_AFFINITY omp_capture_affinity
-#endif
+#define FTN_PAUSE_RESOURCE omp_pause_resource
+#define FTN_PAUSE_RESOURCE_ALL omp_pause_resource_all
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS omp_get_supported_active_levels
+#define FTN_FULFILL_EVENT omp_fulfill_event
#endif /* KMP_FTN_PLAIN */
@@ -200,13 +191,9 @@
#define FTN_GET_ANCESTOR_THREAD_NUM omp_get_ancestor_thread_num_
#define FTN_GET_TEAM_SIZE omp_get_team_size_
#define FTN_IN_FINAL omp_in_final_
-// #define FTN_SET_PROC_BIND omp_set_proc_bind_
#define FTN_GET_PROC_BIND omp_get_proc_bind_
-// #define FTN_CURR_PROC_BIND omp_curr_proc_bind_
-#if OMP_40_ENABLED
#define FTN_GET_NUM_TEAMS omp_get_num_teams_
#define FTN_GET_TEAM_NUM omp_get_team_num_
-#endif
#define FTN_INIT_LOCK omp_init_lock_
#if KMP_USE_DYNAMIC_LOCK
#define FTN_INIT_LOCK_WITH_HINT omp_init_lock_with_hint_
@@ -228,19 +215,14 @@
#define FTN_GET_WTIME omp_get_wtime_
#define FTN_GET_WTICK omp_get_wtick_
-#if OMP_40_ENABLED
#define FTN_GET_NUM_DEVICES omp_get_num_devices_
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device_
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device_
#define FTN_IS_INITIAL_DEVICE omp_is_initial_device_
-#endif
-#if OMP_40_ENABLED
#define FTN_GET_CANCELLATION omp_get_cancellation_
#define FTN_GET_CANCELLATION_STATUS kmp_get_cancellation_status_
-#endif
-#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY omp_get_max_task_priority_
#define FTN_GET_NUM_PLACES omp_get_num_places_
#define FTN_GET_PLACE_NUM_PROCS omp_get_place_num_procs_
@@ -258,10 +240,10 @@
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr_
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr_
#endif
-#endif
-#if OMP_50_ENABLED
#define FTN_CONTROL_TOOL omp_control_tool_
+#define FTN_INIT_ALLOCATOR omp_init_allocator_
+#define FTN_DESTROY_ALLOCATOR omp_destroy_allocator_
#define FTN_SET_DEFAULT_ALLOCATOR omp_set_default_allocator_
#define FTN_GET_DEFAULT_ALLOCATOR omp_get_default_allocator_
#define FTN_ALLOC omp_alloc_
@@ -271,7 +253,10 @@
#define FTN_GET_AFFINITY_FORMAT omp_get_affinity_format_
#define FTN_DISPLAY_AFFINITY omp_display_affinity_
#define FTN_CAPTURE_AFFINITY omp_capture_affinity_
-#endif
+#define FTN_PAUSE_RESOURCE omp_pause_resource_
+#define FTN_PAUSE_RESOURCE_ALL omp_pause_resource_all_
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS omp_get_supported_active_levels_
+#define FTN_FULFILL_EVENT omp_fulfill_event_
#endif /* KMP_FTN_APPEND */
@@ -329,13 +314,9 @@
#define FTN_GET_ANCESTOR_THREAD_NUM OMP_GET_ANCESTOR_THREAD_NUM
#define FTN_GET_TEAM_SIZE OMP_GET_TEAM_SIZE
#define FTN_IN_FINAL OMP_IN_FINAL
-// #define FTN_SET_PROC_BIND OMP_SET_PROC_BIND
#define FTN_GET_PROC_BIND OMP_GET_PROC_BIND
-// #define FTN_CURR_PROC_BIND OMP_CURR_PROC_BIND
-#if OMP_40_ENABLED
#define FTN_GET_NUM_TEAMS OMP_GET_NUM_TEAMS
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM
-#endif
#define FTN_INIT_LOCK OMP_INIT_LOCK
#if KMP_USE_DYNAMIC_LOCK
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT
@@ -357,19 +338,14 @@
#define FTN_GET_WTIME OMP_GET_WTIME
#define FTN_GET_WTICK OMP_GET_WTICK
-#if OMP_40_ENABLED
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE
-#endif
-#if OMP_40_ENABLED
#define FTN_GET_CANCELLATION OMP_GET_CANCELLATION
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS
-#endif
-#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS
@@ -387,20 +363,21 @@
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR
#endif
-#endif
-#if OMP_50_ENABLED
#define FTN_CONTROL_TOOL OMP_CONTROL_TOOL
+#define FTN_INIT_ALLOCATOR OMP_INIT_ALLOCATOR
+#define FTN_DESTROY_ALLOCATOR OMP_DESTROY_ALLOCATOR
#define FTN_SET_DEFAULT_ALLOCATOR OMP_SET_DEFAULT_ALLOCATOR
#define FTN_GET_DEFAULT_ALLOCATOR OMP_GET_DEFAULT_ALLOCATOR
-#define FTN_ALLOC OMP_ALLOC
-#define FTN_FREE OMP_FREE
#define FTN_GET_DEVICE_NUM OMP_GET_DEVICE_NUM
#define FTN_SET_AFFINITY_FORMAT OMP_SET_AFFINITY_FORMAT
#define FTN_GET_AFFINITY_FORMAT OMP_GET_AFFINITY_FORMAT
#define FTN_DISPLAY_AFFINITY OMP_DISPLAY_AFFINITY
#define FTN_CAPTURE_AFFINITY OMP_CAPTURE_AFFINITY
-#endif
+#define FTN_PAUSE_RESOURCE OMP_PAUSE_RESOURCE
+#define FTN_PAUSE_RESOURCE_ALL OMP_PAUSE_RESOURCE_ALL
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS OMP_GET_SUPPORTED_ACTIVE_LEVELS
+#define FTN_FULFILL_EVENT OMP_FULFILL_EVENT
#endif /* KMP_FTN_UPPER */
@@ -458,13 +435,9 @@
#define FTN_GET_ANCESTOR_THREAD_NUM OMP_GET_ANCESTOR_THREAD_NUM_
#define FTN_GET_TEAM_SIZE OMP_GET_TEAM_SIZE_
#define FTN_IN_FINAL OMP_IN_FINAL_
-// #define FTN_SET_PROC_BIND OMP_SET_PROC_BIND_
#define FTN_GET_PROC_BIND OMP_GET_PROC_BIND_
-// #define FTN_CURR_PROC_BIND OMP_CURR_PROC_BIND_
-#if OMP_40_ENABLED
#define FTN_GET_NUM_TEAMS OMP_GET_NUM_TEAMS_
#define FTN_GET_TEAM_NUM OMP_GET_TEAM_NUM_
-#endif
#define FTN_INIT_LOCK OMP_INIT_LOCK_
#if KMP_USE_DYNAMIC_LOCK
#define FTN_INIT_LOCK_WITH_HINT OMP_INIT_LOCK_WITH_HINT_
@@ -486,19 +459,14 @@
#define FTN_GET_WTIME OMP_GET_WTIME_
#define FTN_GET_WTICK OMP_GET_WTICK_
-#if OMP_40_ENABLED
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES_
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE_
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE_
#define FTN_IS_INITIAL_DEVICE OMP_IS_INITIAL_DEVICE_
-#endif
-#if OMP_40_ENABLED
#define FTN_GET_CANCELLATION OMP_GET_CANCELLATION_
#define FTN_GET_CANCELLATION_STATUS KMP_GET_CANCELLATION_STATUS_
-#endif
-#if OMP_45_ENABLED
#define FTN_GET_MAX_TASK_PRIORITY OMP_GET_MAX_TASK_PRIORITY_
#define FTN_GET_NUM_PLACES OMP_GET_NUM_PLACES_
#define FTN_GET_PLACE_NUM_PROCS OMP_GET_PLACE_NUM_PROCS_
@@ -516,10 +484,10 @@
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR_
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR_
#endif
-#endif
-#if OMP_50_ENABLED
#define FTN_CONTROL_TOOL OMP_CONTROL_TOOL_
+#define FTN_INIT_ALLOCATOR OMP_INIT_ALLOCATOR_
+#define FTN_DESTROY_ALLOCATOR OMP_DESTROY_ALLOCATOR_
#define FTN_SET_DEFAULT_ALLOCATOR OMP_SET_DEFAULT_ALLOCATOR_
#define FTN_GET_DEFAULT_ALLOCATOR OMP_GET_DEFAULT_ALLOCATOR_
#define FTN_ALLOC OMP_ALLOC_
@@ -529,7 +497,10 @@
#define FTN_GET_AFFINITY_FORMAT OMP_GET_AFFINITY_FORMAT_
#define FTN_DISPLAY_AFFINITY OMP_DISPLAY_AFFINITY_
#define FTN_CAPTURE_AFFINITY OMP_CAPTURE_AFFINITY_
-#endif
+#define FTN_PAUSE_RESOURCE OMP_PAUSE_RESOURCE_
+#define FTN_PAUSE_RESOURCE_ALL OMP_PAUSE_RESOURCE_ALL_
+#define FTN_GET_SUPPORTED_ACTIVE_LEVELS OMP_GET_SUPPORTED_ACTIVE_LEVELS_
+#define FTN_FULFILL_EVENT OMP_FULFILL_EVENT_
#endif /* KMP_FTN_UAPPEND */
@@ -619,8 +590,6 @@
#define KMP_API_NAME_GOMP_TASKYIELD GOMP_taskyield
// All GOMP_4.0 symbols
-// TODO: As of 2013-10-14, none of the GOMP_4.0 functions are implemented in
-// libomp
#define KMP_API_NAME_GOMP_BARRIER_CANCEL GOMP_barrier_cancel
#define KMP_API_NAME_GOMP_CANCEL GOMP_cancel
#define KMP_API_NAME_GOMP_CANCELLATION_POINT GOMP_cancellation_point
diff --git a/runtime/src/kmp_ftn_stdcall.cpp b/runtime/src/kmp_ftn_stdcall.cpp
index ccf95f464ecd..174c21973cac 100644
--- a/runtime/src/kmp_ftn_stdcall.cpp
+++ b/runtime/src/kmp_ftn_stdcall.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_global.cpp b/runtime/src/kmp_global.cpp
index 5f38009af8f0..1ec73b82e99c 100644
--- a/runtime/src/kmp_global.cpp
+++ b/runtime/src/kmp_global.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -63,11 +62,6 @@ int __kmp_version = 0;
std::atomic<kmp_int32> __kmp_team_counter = ATOMIC_VAR_INIT(0);
std::atomic<kmp_int32> __kmp_task_counter = ATOMIC_VAR_INIT(0);
-unsigned int __kmp_init_wait =
- KMP_DEFAULT_INIT_WAIT; /* initial number of spin-tests */
-unsigned int __kmp_next_wait =
- KMP_DEFAULT_NEXT_WAIT; /* susequent number of spin-tests */
-
size_t __kmp_stksize = KMP_DEFAULT_STKSIZE;
#if KMP_USE_MONITOR
size_t __kmp_monitor_stksize = 0; // auto adjust
@@ -133,10 +127,9 @@ int __kmp_dflt_team_nth = 0;
int __kmp_dflt_team_nth_ub = 0;
int __kmp_tp_capacity = 0;
int __kmp_tp_cached = 0;
-int __kmp_dflt_nested = FALSE;
int __kmp_dispatch_num_buffers = KMP_DFLT_DISP_NUM_BUFF;
-int __kmp_dflt_max_active_levels =
- KMP_MAX_ACTIVE_LEVELS_LIMIT; /* max_active_levels limit */
+int __kmp_dflt_max_active_levels = 1; // Nesting off by default
+bool __kmp_dflt_max_active_levels_set = false; // Don't override set value
#if KMP_NESTED_HOT_TEAMS
int __kmp_hot_teams_mode = 0; /* 0 - free extra threads when reduced */
/* 1 - keep extra threads when reduced */
@@ -209,11 +202,9 @@ const char *__kmp_speculative_statsfile = "-";
#endif // KMP_USE_ADAPTIVE_LOCKS
-#if OMP_40_ENABLED
int __kmp_display_env = FALSE;
int __kmp_display_env_verbose = FALSE;
int __kmp_omp_cancellation = FALSE;
-#endif
/* map OMP 3.0 schedule types with our internal schedule types */
enum sched_type __kmp_sch_map[kmp_sched_upper - kmp_sched_lower_ext +
@@ -277,15 +268,10 @@ char *__kmp_cpuinfo_file = NULL;
#endif /* KMP_AFFINITY_SUPPORTED */
-#if OMP_40_ENABLED
kmp_nested_proc_bind_t __kmp_nested_proc_bind = {NULL, 0, 0};
int __kmp_affinity_num_places = 0;
-#endif
-
-#if OMP_50_ENABLED
int __kmp_display_affinity = FALSE;
char *__kmp_affinity_format = NULL;
-#endif // OMP_50_ENABLED
kmp_hws_item_t __kmp_hws_socket = {0, 0};
kmp_hws_item_t __kmp_hws_node = {0, 0};
@@ -295,30 +281,44 @@ kmp_hws_item_t __kmp_hws_proc = {0, 0};
int __kmp_hws_requested = 0;
int __kmp_hws_abs_flag = 0; // absolute or per-item number requested
-#if OMP_40_ENABLED
kmp_int32 __kmp_default_device = 0;
-#endif
kmp_tasking_mode_t __kmp_tasking_mode = tskm_task_teams;
-#if OMP_45_ENABLED
kmp_int32 __kmp_max_task_priority = 0;
kmp_uint64 __kmp_taskloop_min_tasks = 0;
-#endif
-#if OMP_50_ENABLED
int __kmp_memkind_available = 0;
-int __kmp_hbw_mem_available = 0;
-const omp_allocator_t *OMP_NULL_ALLOCATOR = NULL;
-const omp_allocator_t *omp_default_mem_alloc = (const omp_allocator_t *)1;
-const omp_allocator_t *omp_large_cap_mem_alloc = (const omp_allocator_t *)2;
-const omp_allocator_t *omp_const_mem_alloc = (const omp_allocator_t *)3;
-const omp_allocator_t *omp_high_bw_mem_alloc = (const omp_allocator_t *)4;
-const omp_allocator_t *omp_low_lat_mem_alloc = (const omp_allocator_t *)5;
-const omp_allocator_t *omp_cgroup_mem_alloc = (const omp_allocator_t *)6;
-const omp_allocator_t *omp_pteam_mem_alloc = (const omp_allocator_t *)7;
-const omp_allocator_t *omp_thread_mem_alloc = (const omp_allocator_t *)8;
-void *const *__kmp_def_allocator = omp_default_mem_alloc;
-#endif
+omp_allocator_handle_t const omp_null_allocator = NULL;
+omp_allocator_handle_t const omp_default_mem_alloc =
+ (omp_allocator_handle_t const)1;
+omp_allocator_handle_t const omp_large_cap_mem_alloc =
+ (omp_allocator_handle_t const)2;
+omp_allocator_handle_t const omp_const_mem_alloc =
+ (omp_allocator_handle_t const)3;
+omp_allocator_handle_t const omp_high_bw_mem_alloc =
+ (omp_allocator_handle_t const)4;
+omp_allocator_handle_t const omp_low_lat_mem_alloc =
+ (omp_allocator_handle_t const)5;
+omp_allocator_handle_t const omp_cgroup_mem_alloc =
+ (omp_allocator_handle_t const)6;
+omp_allocator_handle_t const omp_pteam_mem_alloc =
+ (omp_allocator_handle_t const)7;
+omp_allocator_handle_t const omp_thread_mem_alloc =
+ (omp_allocator_handle_t const)8;
+omp_allocator_handle_t const kmp_max_mem_alloc =
+ (omp_allocator_handle_t const)1024;
+omp_allocator_handle_t __kmp_def_allocator = omp_default_mem_alloc;
+
+omp_memspace_handle_t const omp_default_mem_space =
+ (omp_memspace_handle_t const)0;
+omp_memspace_handle_t const omp_large_cap_mem_space =
+ (omp_memspace_handle_t const)1;
+omp_memspace_handle_t const omp_const_mem_space =
+ (omp_memspace_handle_t const)2;
+omp_memspace_handle_t const omp_high_bw_mem_space =
+ (omp_memspace_handle_t const)3;
+omp_memspace_handle_t const omp_low_lat_mem_space =
+ (omp_memspace_handle_t const)4;
/* This check ensures that the compiler is passing the correct data type for the
flags formal parameter of the function kmpc_omp_task_alloc(). If the type is
@@ -328,6 +328,7 @@ void *const *__kmp_def_allocator = omp_default_mem_alloc;
KMP_BUILD_ASSERT(sizeof(kmp_tasking_flags_t) == 4);
int __kmp_task_stealing_constraint = 1; /* Constrain task stealing by default */
+int __kmp_enable_task_throttling = 1;
#ifdef DEBUG_SUSPEND
int __kmp_suspend_count = 0;
@@ -396,22 +397,17 @@ int __kmp_env_blocktime = FALSE; /* KMP_BLOCKTIME specified? */
int __kmp_env_checks = FALSE; /* KMP_CHECKS specified? */
int __kmp_env_consistency_check = FALSE; /* KMP_CONSISTENCY_CHECK specified? */
+// From KMP_USE_YIELD:
+// 0 = never yield;
+// 1 = always yield (default);
+// 2 = yield only if oversubscribed
+kmp_int32 __kmp_use_yield = 1;
+// This will be 1 if KMP_USE_YIELD environment variable was set explicitly
+kmp_int32 __kmp_use_yield_exp_set = 0;
+
kmp_uint32 __kmp_yield_init = KMP_INIT_WAIT;
kmp_uint32 __kmp_yield_next = KMP_NEXT_WAIT;
-#if KMP_USE_MONITOR
-kmp_uint32 __kmp_yielding_on = 1;
-#endif
-#if KMP_OS_CNK
-kmp_uint32 __kmp_yield_cycle = 0;
-#else
-kmp_uint32 __kmp_yield_cycle = 1; /* Yield-cycle is on by default */
-#endif
-kmp_int32 __kmp_yield_on_count =
- 10; /* By default, yielding is on for 10 monitor periods. */
-kmp_int32 __kmp_yield_off_count =
- 1; /* By default, yielding is off for 1 monitor periods. */
-
/* ------------------------------------------------------ */
/* STATE mostly syncronized with global lock */
/* data written to rarely by masters, read often by workers */
@@ -426,7 +422,6 @@ kmp_root_t **__kmp_root = NULL;
KMP_ALIGN_CACHE
volatile int __kmp_nth = 0;
volatile int __kmp_all_nth = 0;
-int __kmp_thread_pool_nth = 0;
volatile kmp_info_t *__kmp_thread_pool = NULL;
volatile kmp_team_t *__kmp_team_pool = NULL;
@@ -531,7 +526,9 @@ int _You_must_link_with_Intel_OpenMP_library = 1;
int _You_must_link_with_Microsoft_OpenMP_library = 1;
#endif
-#if OMP_50_ENABLED
kmp_target_offload_kind_t __kmp_target_offload = tgt_default;
-#endif
+
+// OMP Pause Resources
+kmp_pause_status_t __kmp_pause_status = kmp_not_paused;
+
// end of file //
diff --git a/runtime/src/kmp_gsupport.cpp b/runtime/src/kmp_gsupport.cpp
index c1f9bdd24c57..d41e027eb2b0 100644
--- a/runtime/src/kmp_gsupport.cpp
+++ b/runtime/src/kmp_gsupport.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -119,6 +118,7 @@ int KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SINGLE_START)(void) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
// 3rd parameter == FALSE prevents kmp_enter_single from pushing a
// workshare when USE_CHECKS is defined. We need to avoid the push,
@@ -167,6 +167,7 @@ void *KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SINGLE_COPY_START)(void) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
// If this is the first thread to enter, return NULL. The generated code will
// then call GOMP_single_copy_end() for this thread only, with the
@@ -588,14 +589,10 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_END)(void) {
return status; \
}
-#if OMP_45_ENABLED
#define KMP_DOACROSS_FINI(status, gtid) \
if (!status && __kmp_threads[gtid]->th.th_dispatch->th_doacross_flags) { \
__kmpc_doacross_fini(NULL, gtid); \
}
-#else
-#define KMP_DOACROSS_FINI(status, gtid) /* Nothing */
-#endif
#define LOOP_NEXT(func, fini_code) \
int func(long *p_lb, long *p_ub) { \
@@ -651,7 +648,6 @@ LOOP_RUNTIME_START(
LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ORDERED_RUNTIME_NEXT),
{ KMP_DISPATCH_FINI_CHUNK(&loc, gtid); })
-#if OMP_45_ENABLED
#define LOOP_DOACROSS_START(func, schedule) \
bool func(unsigned ncounts, long *counts, long chunk_sz, long *p_lb, \
long *p_ub) { \
@@ -757,7 +753,6 @@ LOOP_DOACROSS_START(
LOOP_DOACROSS_RUNTIME_START(
KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DOACROSS_RUNTIME_START),
kmp_sch_runtime)
-#endif // OMP_45_ENABLED
void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END)(void) {
int gtid = __kmp_get_gtid();
@@ -920,7 +915,6 @@ LOOP_RUNTIME_START_ULL(
LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT),
{ KMP_DISPATCH_FINI_CHUNK_ULL(&loc, gtid); })
-#if OMP_45_ENABLED
#define LOOP_DOACROSS_START_ULL(func, schedule) \
int func(unsigned ncounts, unsigned long long *counts, \
unsigned long long chunk_sz, unsigned long long *p_lb, \
@@ -1030,7 +1024,6 @@ LOOP_DOACROSS_START_ULL(
LOOP_DOACROSS_RUNTIME_START_ULL(
KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START),
kmp_sch_runtime)
-#endif
// Combined parallel / loop worksharing constructs
//
@@ -1113,12 +1106,8 @@ PARALLEL_LOOP_START(
void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data,
void (*copy_func)(void *, void *),
long arg_size, long arg_align,
- bool if_cond, unsigned gomp_flags
-#if OMP_40_ENABLED
- ,
- void **depend
-#endif
- ) {
+ bool if_cond, unsigned gomp_flags,
+ void **depend) {
MKLOC(loc, "GOMP_task");
int gtid = __kmp_entry_gtid();
kmp_int32 flags = 0;
@@ -1169,7 +1158,6 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data,
#endif
if (if_cond) {
-#if OMP_40_ENABLED
if (gomp_flags & 8) {
KMP_ASSERT(depend);
const size_t ndeps = (kmp_intptr_t)depend[0];
@@ -1184,7 +1172,6 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASK)(void (*func)(void *), void *data,
}
__kmpc_omp_task_with_deps(&loc, gtid, task, ndeps, dep_list, 0, NULL);
} else {
-#endif
__kmpc_omp_task(&loc, gtid, task);
}
} else {
@@ -1369,8 +1356,6 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKYIELD)(void) {
return;
}
-#if OMP_40_ENABLED // these are new GOMP_4.0 entry points
-
void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL)(void (*task)(void *),
void *data,
unsigned num_threads,
@@ -1537,11 +1522,7 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TASKGROUP_END)(void) {
return;
}
-#ifndef KMP_DEBUG
-static
-#endif /* KMP_DEBUG */
- kmp_int32
- __kmp_gomp_to_omp_cancellation_kind(int gomp_kind) {
+static kmp_int32 __kmp_gomp_to_omp_cancellation_kind(int gomp_kind) {
kmp_int32 cncl_kind = 0;
switch (gomp_kind) {
case 1:
@@ -1560,71 +1541,49 @@ static
return cncl_kind;
}
+// Return true if cancellation should take place, false otherwise
bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CANCELLATION_POINT)(int which) {
- if (__kmp_omp_cancellation) {
- KMP_FATAL(NoGompCancellation);
- }
int gtid = __kmp_get_gtid();
MKLOC(loc, "GOMP_cancellation_point");
- KA_TRACE(20, ("GOMP_cancellation_point: T#%d\n", gtid));
-
+ KA_TRACE(20, ("GOMP_cancellation_point: T#%d which:%d\n", gtid, which));
kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
-
return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
}
-bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_BARRIER_CANCEL)(void) {
- if (__kmp_omp_cancellation) {
- KMP_FATAL(NoGompCancellation);
- }
- KMP_FATAL(NoGompCancellation);
- int gtid = __kmp_get_gtid();
- MKLOC(loc, "GOMP_barrier_cancel");
- KA_TRACE(20, ("GOMP_barrier_cancel: T#%d\n", gtid));
-
- return __kmpc_cancel_barrier(&loc, gtid);
-}
-
+// Return true if cancellation should take place, false otherwise
bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CANCEL)(int which, bool do_cancel) {
- if (__kmp_omp_cancellation) {
- KMP_FATAL(NoGompCancellation);
- } else {
- return FALSE;
- }
-
int gtid = __kmp_get_gtid();
MKLOC(loc, "GOMP_cancel");
- KA_TRACE(20, ("GOMP_cancel: T#%d\n", gtid));
-
+ KA_TRACE(20, ("GOMP_cancel: T#%d which:%d do_cancel:%d\n", gtid, which,
+ (int)do_cancel));
kmp_int32 cncl_kind = __kmp_gomp_to_omp_cancellation_kind(which);
if (do_cancel == FALSE) {
- return KMP_EXPAND_NAME(KMP_API_NAME_GOMP_CANCELLATION_POINT)(which);
+ return __kmpc_cancellationpoint(&loc, gtid, cncl_kind);
} else {
return __kmpc_cancel(&loc, gtid, cncl_kind);
}
}
+// Return true if cancellation should take place, false otherwise
+bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_BARRIER_CANCEL)(void) {
+ int gtid = __kmp_get_gtid();
+ KA_TRACE(20, ("GOMP_barrier_cancel: T#%d\n", gtid));
+ return __kmp_barrier_gomp_cancel(gtid);
+}
+
+// Return true if cancellation should take place, false otherwise
bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_END_CANCEL)(void) {
- if (__kmp_omp_cancellation) {
- KMP_FATAL(NoGompCancellation);
- }
int gtid = __kmp_get_gtid();
- MKLOC(loc, "GOMP_sections_end_cancel");
KA_TRACE(20, ("GOMP_sections_end_cancel: T#%d\n", gtid));
-
- return __kmpc_cancel_barrier(&loc, gtid);
+ return __kmp_barrier_gomp_cancel(gtid);
}
+// Return true if cancellation should take place, false otherwise
bool KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_END_CANCEL)(void) {
- if (__kmp_omp_cancellation) {
- KMP_FATAL(NoGompCancellation);
- }
int gtid = __kmp_get_gtid();
- MKLOC(loc, "GOMP_loop_end_cancel");
KA_TRACE(20, ("GOMP_loop_end_cancel: T#%d\n", gtid));
-
- return __kmpc_cancel_barrier(&loc, gtid);
+ return __kmp_barrier_gomp_cancel(gtid);
}
// All target functions are empty as of 2014-05-29
@@ -1654,9 +1613,6 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_TEAMS)(unsigned int num_teams,
unsigned int thread_limit) {
return;
}
-#endif // OMP_40_ENABLED
-
-#if OMP_45_ENABLED
// Task duplication function which copies src to dest (both are
// preallocated task structures)
@@ -1857,8 +1813,6 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_DOACROSS_ULL_WAIT)(
va_end(args);
}
-#endif // OMP_45_ENABLED
-
/* The following sections of code create aliases for the GOMP_* functions, then
create versioned symbols using the assembler directive .symver. This is only
pertinent for ELF .so library. The KMP_VERSION_SYMBOL macro is defined in
@@ -1946,7 +1900,6 @@ KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_STATIC_START, 20, "GOMP_2.0");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKYIELD, 30, "GOMP_3.0");
// GOMP_4.0 versioned symbols
-#if OMP_40_ENABLED
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL, 40, "GOMP_4.0");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_SECTIONS, 40, "GOMP_4.0");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC, 40, "GOMP_4.0");
@@ -1965,10 +1918,8 @@ KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_DATA, 40, "GOMP_4.0");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_END_DATA, 40, "GOMP_4.0");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TARGET_UPDATE, 40, "GOMP_4.0");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TEAMS, 40, "GOMP_4.0");
-#endif
// GOMP_4.5 versioned symbols
-#if OMP_45_ENABLED
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKLOOP, 45, "GOMP_4.5");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_TASKLOOP_ULL, 45, "GOMP_4.5");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_DOACROSS_POST, 45, "GOMP_4.5");
@@ -1991,7 +1942,6 @@ KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, 45,
"GOMP_4.5");
KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, 45,
"GOMP_4.5");
-#endif
#endif // KMP_USE_VERSION_SYMBOLS
diff --git a/runtime/src/kmp_i18n.cpp b/runtime/src/kmp_i18n.cpp
index 95daac2065eb..53c442715b0b 100644
--- a/runtime/src/kmp_i18n.cpp
+++ b/runtime/src/kmp_i18n.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_i18n.h b/runtime/src/kmp_i18n.h
index 56dae2270075..9d79a21bb2df 100644
--- a/runtime/src/kmp_i18n.h
+++ b/runtime/src/kmp_i18n.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_import.cpp b/runtime/src/kmp_import.cpp
index 8ad7d1d1dd46..39d841d9d468 100644
--- a/runtime/src/kmp_import.cpp
+++ b/runtime/src/kmp_import.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_io.cpp b/runtime/src/kmp_io.cpp
index 24c6e725aefa..4e6ea6a38a33 100644
--- a/runtime/src/kmp_io.cpp
+++ b/runtime/src/kmp_io.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_io.h b/runtime/src/kmp_io.h
index dac7a42e2e4d..49afda59ee6d 100644
--- a/runtime/src/kmp_io.h
+++ b/runtime/src/kmp_io.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_itt.cpp b/runtime/src/kmp_itt.cpp
index 820bb591a0d7..fa286eccad22 100644
--- a/runtime/src/kmp_itt.cpp
+++ b/runtime/src/kmp_itt.cpp
@@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_itt.h b/runtime/src/kmp_itt.h
index 2062e01c4b13..b14a19301459 100644
--- a/runtime/src/kmp_itt.h
+++ b/runtime/src/kmp_itt.h
@@ -5,10 +5,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -220,7 +219,7 @@ __kmp_inline void __kmp_itt_stack_callee_leave(__itt_caller);
with a delay (and not called at all if waiting time is small). So, in spin
loops, do not use KMP_FSYNC_PREPARE(), but use KMP_FSYNC_SPIN_INIT() (before
spin loop), KMP_FSYNC_SPIN_PREPARE() (whithin the spin loop), and
- KMP_FSYNC_SPIN_ACQUIRED(). See KMP_WAIT_YIELD() for example. */
+ KMP_FSYNC_SPIN_ACQUIRED(). See KMP_WAIT() for example. */
#undef KMP_FSYNC_SPIN_INIT
#define KMP_FSYNC_SPIN_INIT(obj, spin) \
diff --git a/runtime/src/kmp_itt.inl b/runtime/src/kmp_itt.inl
index a0789fca2abe..6e37ce0f083c 100644
--- a/runtime/src/kmp_itt.inl
+++ b/runtime/src/kmp_itt.inl
@@ -5,10 +5,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_lock.cpp b/runtime/src/kmp_lock.cpp
index c0f228ea421e..78d63c67852d 100644
--- a/runtime/src/kmp_lock.cpp
+++ b/runtime/src/kmp_lock.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -101,23 +100,12 @@ __kmp_acquire_tas_lock_timed_template(kmp_tas_lock_t *lck, kmp_int32 gtid) {
kmp_uint32 spins;
KMP_FSYNC_PREPARE(lck);
KMP_INIT_YIELD(spins);
- if (TCR_4(__kmp_nth) > (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) {
- KMP_YIELD(TRUE);
- } else {
- KMP_YIELD_SPIN(spins);
- }
-
kmp_backoff_t backoff = __kmp_spin_backoff_params;
- while (KMP_ATOMIC_LD_RLX(&lck->lk.poll) != tas_free ||
- !__kmp_atomic_compare_store_acq(&lck->lk.poll, tas_free, tas_busy)) {
+ do {
__kmp_spin_backoff(&backoff);
- if (TCR_4(__kmp_nth) >
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) {
- KMP_YIELD(TRUE);
- } else {
- KMP_YIELD_SPIN(spins);
- }
- }
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
+ } while (KMP_ATOMIC_LD_RLX(&lck->lk.poll) != tas_free ||
+ !__kmp_atomic_compare_store_acq(&lck->lk.poll, tas_free, tas_busy));
KMP_FSYNC_ACQUIRED(lck);
return KMP_LOCK_ACQUIRED_FIRST;
}
@@ -170,8 +158,7 @@ int __kmp_release_tas_lock(kmp_tas_lock_t *lck, kmp_int32 gtid) {
KMP_ATOMIC_ST_REL(&lck->lk.poll, KMP_LOCK_FREE(tas));
KMP_MB(); /* Flush all pending memory write invalidates. */
- KMP_YIELD(TCR_4(__kmp_nth) >
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc));
+ KMP_YIELD_OVERSUB();
return KMP_LOCK_RELEASED;
}
@@ -475,8 +462,7 @@ int __kmp_release_futex_lock(kmp_futex_lock_t *lck, kmp_int32 gtid) {
KA_TRACE(1000, ("__kmp_release_futex_lock: lck:%p(0x%x), T#%d exiting\n", lck,
lck->lk.poll, gtid));
- KMP_YIELD(TCR_4(__kmp_nth) >
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc));
+ KMP_YIELD_OVERSUB();
return KMP_LOCK_RELEASED;
}
@@ -652,7 +638,7 @@ __kmp_acquire_ticket_lock_timed_template(kmp_ticket_lock_t *lck,
std::memory_order_acquire) == my_ticket) {
return KMP_LOCK_ACQUIRED_FIRST;
}
- KMP_WAIT_YIELD_PTR(&lck->lk.now_serving, my_ticket, __kmp_bakery_check, lck);
+ KMP_WAIT_PTR(&lck->lk.now_serving, my_ticket, __kmp_bakery_check, lck);
return KMP_LOCK_ACQUIRED_FIRST;
}
@@ -1250,10 +1236,9 @@ __kmp_acquire_queuing_lock_timed_template(kmp_queuing_lock_t *lck,
("__kmp_acquire_queuing_lock: lck:%p, T#%d waiting for lock\n",
lck, gtid));
- /* ToDo: May want to consider using __kmp_wait_sleep or something that
- sleeps for throughput only here. */
KMP_MB();
- KMP_WAIT_YIELD(spin_here_p, FALSE, KMP_EQ, lck);
+ // ToDo: Use __kmp_wait_sleep or similar when blocktime != inf
+ KMP_WAIT(spin_here_p, FALSE, KMP_EQ, lck);
#ifdef DEBUG_QUEUING_LOCKS
TRACE_LOCK(gtid + 1, "acq spin");
@@ -1283,8 +1268,8 @@ __kmp_acquire_queuing_lock_timed_template(kmp_queuing_lock_t *lck,
/* Yield if number of threads > number of logical processors */
/* ToDo: Not sure why this should only be in oversubscription case,
maybe should be traditional YIELD_INIT/YIELD_WHEN loop */
- KMP_YIELD(TCR_4(__kmp_nth) >
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc));
+ KMP_YIELD_OVERSUB();
+
#ifdef DEBUG_QUEUING_LOCKS
TRACE_LOCK(gtid + 1, "acq retry");
#endif
@@ -1463,8 +1448,8 @@ int __kmp_release_queuing_lock(kmp_queuing_lock_t *lck, kmp_int32 gtid) {
KMP_MB();
/* make sure enqueuing thread has time to update next waiting thread
* field */
- *head_id_p = KMP_WAIT_YIELD((volatile kmp_uint32 *)waiting_id_p, 0,
- KMP_NEQ, NULL);
+ *head_id_p =
+ KMP_WAIT((volatile kmp_uint32 *)waiting_id_p, 0, KMP_NEQ, NULL);
#ifdef DEBUG_QUEUING_LOCKS
TRACE_LOCK(gtid + 1, "rel deq: (h,t)->(h',t)");
#endif
@@ -2132,7 +2117,7 @@ static void __kmp_acquire_adaptive_lock(kmp_adaptive_lock_t *lck,
// lock from now on.
while (!__kmp_is_unlocked_queuing_lock(GET_QLK_PTR(lck))) {
KMP_INC_STAT(lck, lemmingYields);
- __kmp_yield(TRUE);
+ KMP_YIELD(TRUE);
}
if (__kmp_test_adaptive_lock_only(lck, gtid))
@@ -2260,23 +2245,14 @@ __kmp_acquire_drdpa_lock_timed_template(kmp_drdpa_lock_t *lck, kmp_int32 gtid) {
// polling area has been reconfigured. Unless it is reconfigured, the
// reloads stay in L1 cache and are cheap.
//
- // Keep this code in sync with KMP_WAIT_YIELD, in kmp_dispatch.cpp !!!
- //
- // The current implementation of KMP_WAIT_YIELD doesn't allow for mask
+ // Keep this code in sync with KMP_WAIT, in kmp_dispatch.cpp !!!
+ // The current implementation of KMP_WAIT doesn't allow for mask
// and poll to be re-read every spin iteration.
kmp_uint32 spins;
-
KMP_FSYNC_PREPARE(lck);
KMP_INIT_YIELD(spins);
while (polls[ticket & mask] < ticket) { // atomic load
- // If we are oversubscribed,
- // or have waited a bit (and KMP_LIBRARY=turnaround), then yield.
- // CPU Pause is in the macros for yield.
- //
- KMP_YIELD(TCR_4(__kmp_nth) >
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc));
- KMP_YIELD_SPIN(spins);
-
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
// Re-read the mask and the poll pointer from the lock structure.
//
// Make certain that "mask" is read before "polls" !!!
@@ -2808,8 +2784,9 @@ static void __kmp_acquire_rtm_lock(kmp_queuing_lock_t *lck, kmp_int32 gtid) {
}
if ((status & _XABORT_EXPLICIT) && _XABORT_CODE(status) == 0xff) {
// Wait until lock becomes free
- while (!__kmp_is_unlocked_queuing_lock(lck))
- __kmp_yield(TRUE);
+ while (!__kmp_is_unlocked_queuing_lock(lck)) {
+ KMP_YIELD(TRUE);
+ }
} else if (!(status & _XABORT_RETRY))
break;
} while (retries--);
diff --git a/runtime/src/kmp_lock.h b/runtime/src/kmp_lock.h
index 6a88d7bc52af..ccd84eb821d9 100644
--- a/runtime/src/kmp_lock.h
+++ b/runtime/src/kmp_lock.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -653,21 +652,11 @@ extern int (*__kmp_acquire_user_lock_with_checks_)(kmp_user_lock_p lck,
kmp_uint32 spins; \
KMP_FSYNC_PREPARE(lck); \
KMP_INIT_YIELD(spins); \
- if (TCR_4(__kmp_nth) > \
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \
- KMP_YIELD(TRUE); \
- } else { \
- KMP_YIELD_SPIN(spins); \
- } \
- while (lck->tas.lk.poll != 0 || !__kmp_atomic_compare_store_acq( \
- &lck->tas.lk.poll, 0, gtid + 1)) { \
- if (TCR_4(__kmp_nth) > \
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \
- KMP_YIELD(TRUE); \
- } else { \
- KMP_YIELD_SPIN(spins); \
- } \
- } \
+ do { \
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins); \
+ } while ( \
+ lck->tas.lk.poll != 0 || \
+ !__kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)); \
} \
KMP_FSYNC_ACQUIRED(lck); \
} else { \
@@ -771,22 +760,11 @@ extern int (*__kmp_acquire_nested_user_lock_with_checks_)(kmp_user_lock_p lck,
kmp_uint32 spins; \
KMP_FSYNC_PREPARE(lck); \
KMP_INIT_YIELD(spins); \
- if (TCR_4(__kmp_nth) > \
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \
- KMP_YIELD(TRUE); \
- } else { \
- KMP_YIELD_SPIN(spins); \
- } \
- while ( \
+ do { \
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins); \
+ } while ( \
(lck->tas.lk.poll != 0) || \
- !__kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)) { \
- if (TCR_4(__kmp_nth) > \
- (__kmp_avail_proc ? __kmp_avail_proc : __kmp_xproc)) { \
- KMP_YIELD(TRUE); \
- } else { \
- KMP_YIELD_SPIN(spins); \
- } \
- } \
+ !__kmp_atomic_compare_store_acq(&lck->tas.lk.poll, 0, gtid + 1)); \
} \
lck->tas.lk.depth_locked = 1; \
*depth = KMP_LOCK_ACQUIRED_FIRST; \
diff --git a/runtime/src/kmp_omp.h b/runtime/src/kmp_omp.h
index 8dcb7d2634c0..27b550d1f663 100644
--- a/runtime/src/kmp_omp.h
+++ b/runtime/src/kmp_omp.h
@@ -6,10 +6,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -107,16 +106,14 @@ typedef struct {
th_task_state; // alternating 0/1 for task team identification
offset_and_size_t th_bar;
offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it
-// arrives to the barrier
+ // arrives to the barrier
-#if OMP_40_ENABLED
/* teams information */
offset_and_size_t th_teams_microtask; // entry address for teams construct
offset_and_size_t th_teams_level; // initial level of teams construct
offset_and_size_t th_teams_nteams; // number of teams in a league
offset_and_size_t
th_teams_nth; // number of threads in each team of the league
-#endif
/* kmp_desc structure (for info field above) */
kmp_int32 ds_sizeof_struct;
@@ -136,9 +133,7 @@ typedef struct {
offset_and_size_t t_pkfn;
offset_and_size_t t_task_team; // task team structure
offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task
-#if OMP_40_ENABLED
offset_and_size_t t_cancel_request;
-#endif
offset_and_size_t t_bar;
offset_and_size_t
t_b_master_arrived; // increased by 1 when master arrives to a barrier
@@ -204,7 +199,6 @@ typedef struct {
offset_and_size_t
td_taskwait_thread; // gtid + 1 of thread encountered taskwait
-#if OMP_40_ENABLED
/* Taskgroup */
offset_and_size_t td_taskgroup; // pointer to the current taskgroup
offset_and_size_t
@@ -220,7 +214,6 @@ typedef struct {
offset_and_size_t dn_task;
offset_and_size_t dn_npredecessors;
offset_and_size_t dn_nrefs;
-#endif
offset_and_size_t dn_routine;
/* kmp_thread_data_t */
diff --git a/runtime/src/kmp_os.h b/runtime/src/kmp_os.h
index 3c2426bcae46..c4c7bcf6cc57 100644
--- a/runtime/src/kmp_os.h
+++ b/runtime/src/kmp_os.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -40,6 +39,14 @@
#define KMP_MEM_CONS_MODEL KMP_MEM_CONS_VOLATILE
#endif
+#ifndef __has_cpp_attribute
+#define __has_cpp_attribute(x) 0
+#endif
+
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
/* ------------------------- Compiler recognition ---------------------- */
#define KMP_COMPILER_ICC 0
#define KMP_COMPILER_GCC 0
@@ -297,6 +304,20 @@ extern "C" {
#define KMP_CACHE_PREFETCH(ADDR) /* nothing */
+// Define attribute that indicates that the fall through from the previous
+// case label is intentional and should not be diagnosed by a compiler
+// Code from libcxx/include/__config
+// Use a function like macro to imply that it must be followed by a semicolon
+#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
+# define KMP_FALLTHROUGH() [[fallthrough]]
+#elif __has_cpp_attribute(clang::fallthrough)
+# define KMP_FALLTHROUGH() [[clang::fallthrough]]
+#elif __has_attribute(fallthough) || __GNUC__ >= 7
+# define KMP_FALLTHROUGH() __attribute__((__fallthrough__))
+#else
+# define KMP_FALLTHROUGH() ((void)0)
+#endif
+
// Define attribute that indicates a function does not return
#if __cplusplus >= 201103L
#define KMP_NORETURN [[noreturn]]
@@ -512,32 +533,56 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v);
__sync_fetch_and_add((volatile kmp_int32 *)(p), 1)
#define KMP_TEST_THEN_INC_ACQ32(p) \
__sync_fetch_and_add((volatile kmp_int32 *)(p), 1)
+#if KMP_ARCH_MIPS
+#define KMP_TEST_THEN_INC64(p) \
+ __atomic_fetch_add((volatile kmp_int64 *)(p), 1LL, __ATOMIC_SEQ_CST)
+#define KMP_TEST_THEN_INC_ACQ64(p) \
+ __atomic_fetch_add((volatile kmp_int64 *)(p), 1LL, __ATOMIC_SEQ_CST)
+#else
#define KMP_TEST_THEN_INC64(p) \
__sync_fetch_and_add((volatile kmp_int64 *)(p), 1LL)
#define KMP_TEST_THEN_INC_ACQ64(p) \
__sync_fetch_and_add((volatile kmp_int64 *)(p), 1LL)
+#endif
#define KMP_TEST_THEN_ADD4_32(p) \
__sync_fetch_and_add((volatile kmp_int32 *)(p), 4)
#define KMP_TEST_THEN_ADD4_ACQ32(p) \
__sync_fetch_and_add((volatile kmp_int32 *)(p), 4)
+#if KMP_ARCH_MIPS
+#define KMP_TEST_THEN_ADD4_64(p) \
+ __atomic_fetch_add((volatile kmp_int64 *)(p), 4LL, __ATOMIC_SEQ_CST)
+#define KMP_TEST_THEN_ADD4_ACQ64(p) \
+ __atomic_fetch_add((volatile kmp_int64 *)(p), 4LL, __ATOMIC_SEQ_CST)
+#define KMP_TEST_THEN_DEC64(p) \
+ __atomic_fetch_sub((volatile kmp_int64 *)(p), 1LL, __ATOMIC_SEQ_CST)
+#define KMP_TEST_THEN_DEC_ACQ64(p) \
+ __atomic_fetch_sub((volatile kmp_int64 *)(p), 1LL, __ATOMIC_SEQ_CST)
+#else
#define KMP_TEST_THEN_ADD4_64(p) \
__sync_fetch_and_add((volatile kmp_int64 *)(p), 4LL)
#define KMP_TEST_THEN_ADD4_ACQ64(p) \
__sync_fetch_and_add((volatile kmp_int64 *)(p), 4LL)
-#define KMP_TEST_THEN_DEC32(p) \
- __sync_fetch_and_sub((volatile kmp_int32 *)(p), 1)
-#define KMP_TEST_THEN_DEC_ACQ32(p) \
- __sync_fetch_and_sub((volatile kmp_int32 *)(p), 1)
#define KMP_TEST_THEN_DEC64(p) \
__sync_fetch_and_sub((volatile kmp_int64 *)(p), 1LL)
#define KMP_TEST_THEN_DEC_ACQ64(p) \
__sync_fetch_and_sub((volatile kmp_int64 *)(p), 1LL)
+#endif
+#define KMP_TEST_THEN_DEC32(p) \
+ __sync_fetch_and_sub((volatile kmp_int32 *)(p), 1)
+#define KMP_TEST_THEN_DEC_ACQ32(p) \
+ __sync_fetch_and_sub((volatile kmp_int32 *)(p), 1)
#define KMP_TEST_THEN_ADD8(p, v) \
__sync_fetch_and_add((volatile kmp_int8 *)(p), (kmp_int8)(v))
#define KMP_TEST_THEN_ADD32(p, v) \
__sync_fetch_and_add((volatile kmp_int32 *)(p), (kmp_int32)(v))
+#if KMP_ARCH_MIPS
+#define KMP_TEST_THEN_ADD64(p, v) \
+ __atomic_fetch_add((volatile kmp_uint64 *)(p), (kmp_uint64)(v), \
+ __ATOMIC_SEQ_CST)
+#else
#define KMP_TEST_THEN_ADD64(p, v) \
__sync_fetch_and_add((volatile kmp_int64 *)(p), (kmp_int64)(v))
+#endif
#define KMP_TEST_THEN_OR8(p, v) \
__sync_fetch_and_or((volatile kmp_int8 *)(p), (kmp_int8)(v))
@@ -547,10 +592,19 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v);
__sync_fetch_and_or((volatile kmp_uint32 *)(p), (kmp_uint32)(v))
#define KMP_TEST_THEN_AND32(p, v) \
__sync_fetch_and_and((volatile kmp_uint32 *)(p), (kmp_uint32)(v))
+#if KMP_ARCH_MIPS
+#define KMP_TEST_THEN_OR64(p, v) \
+ __atomic_fetch_or((volatile kmp_uint64 *)(p), (kmp_uint64)(v), \
+ __ATOMIC_SEQ_CST)
+#define KMP_TEST_THEN_AND64(p, v) \
+ __atomic_fetch_and((volatile kmp_uint64 *)(p), (kmp_uint64)(v), \
+ __ATOMIC_SEQ_CST)
+#else
#define KMP_TEST_THEN_OR64(p, v) \
__sync_fetch_and_or((volatile kmp_uint64 *)(p), (kmp_uint64)(v))
#define KMP_TEST_THEN_AND64(p, v) \
__sync_fetch_and_and((volatile kmp_uint64 *)(p), (kmp_uint64)(v))
+#endif
#define KMP_COMPARE_AND_STORE_ACQ8(p, cv, sv) \
__sync_bool_compare_and_swap((volatile kmp_uint8 *)(p), (kmp_uint8)(cv), \
@@ -570,12 +624,6 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v);
#define KMP_COMPARE_AND_STORE_REL32(p, cv, sv) \
__sync_bool_compare_and_swap((volatile kmp_uint32 *)(p), (kmp_uint32)(cv), \
(kmp_uint32)(sv))
-#define KMP_COMPARE_AND_STORE_ACQ64(p, cv, sv) \
- __sync_bool_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv), \
- (kmp_uint64)(sv))
-#define KMP_COMPARE_AND_STORE_REL64(p, cv, sv) \
- __sync_bool_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv), \
- (kmp_uint64)(sv))
#define KMP_COMPARE_AND_STORE_PTR(p, cv, sv) \
__sync_bool_compare_and_swap((void *volatile *)(p), (void *)(cv), \
(void *)(sv))
@@ -589,9 +637,38 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real64 *p, kmp_real64 v);
#define KMP_COMPARE_AND_STORE_RET32(p, cv, sv) \
__sync_val_compare_and_swap((volatile kmp_uint32 *)(p), (kmp_uint32)(cv), \
(kmp_uint32)(sv))
+#if KMP_ARCH_MIPS
+static inline bool mips_sync_bool_compare_and_swap(
+ volatile kmp_uint64 *p, kmp_uint64 cv, kmp_uint64 sv) {
+ return __atomic_compare_exchange(p, &cv, &sv, false, __ATOMIC_SEQ_CST,
+ __ATOMIC_SEQ_CST);
+}
+static inline bool mips_sync_val_compare_and_swap(
+ volatile kmp_uint64 *p, kmp_uint64 cv, kmp_uint64 sv) {
+ __atomic_compare_exchange(p, &cv, &sv, false, __ATOMIC_SEQ_CST,
+ __ATOMIC_SEQ_CST);
+ return cv;
+}
+#define KMP_COMPARE_AND_STORE_ACQ64(p, cv, sv) \
+ mips_sync_bool_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv),\
+ (kmp_uint64)(sv))
+#define KMP_COMPARE_AND_STORE_REL64(p, cv, sv) \
+ mips_sync_bool_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv),\
+ (kmp_uint64)(sv))
+#define KMP_COMPARE_AND_STORE_RET64(p, cv, sv) \
+ mips_sync_val_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv), \
+ (kmp_uint64)(sv))
+#else
+#define KMP_COMPARE_AND_STORE_ACQ64(p, cv, sv) \
+ __sync_bool_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv), \
+ (kmp_uint64)(sv))
+#define KMP_COMPARE_AND_STORE_REL64(p, cv, sv) \
+ __sync_bool_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv), \
+ (kmp_uint64)(sv))
#define KMP_COMPARE_AND_STORE_RET64(p, cv, sv) \
__sync_val_compare_and_swap((volatile kmp_uint64 *)(p), (kmp_uint64)(cv), \
(kmp_uint64)(sv))
+#endif
#define KMP_XCHG_FIXED8(p, v) \
__sync_lock_test_and_set((volatile kmp_uint8 *)(p), (kmp_uint8)(v))
@@ -861,8 +938,8 @@ typedef void (*microtask_t)(int *gtid, int *npr, ...);
#define VOLATILE_CAST(x) (x)
#endif
-#define KMP_WAIT_YIELD __kmp_wait_yield_4
-#define KMP_WAIT_YIELD_PTR __kmp_wait_yield_4_ptr
+#define KMP_WAIT __kmp_wait_4
+#define KMP_WAIT_PTR __kmp_wait_4_ptr
#define KMP_EQ __kmp_eq_4
#define KMP_NEQ __kmp_neq_4
#define KMP_LT __kmp_lt_4
@@ -888,9 +965,7 @@ typedef void (*microtask_t)(int *gtid, int *npr, ...);
#endif
// Enable dynamic user lock
-#if OMP_45_ENABLED
#define KMP_USE_DYNAMIC_LOCK 1
-#endif
// Enable Intel(R) Transactional Synchronization Extensions (Intel(R) TSX) if
// dynamic user lock is turned on
diff --git a/runtime/src/kmp_platform.h b/runtime/src/kmp_platform.h
index bb23de03d841..e4f2e06b962c 100644
--- a/runtime/src/kmp_platform.h
+++ b/runtime/src/kmp_platform.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_runtime.cpp b/runtime/src/kmp_runtime.cpp
index 0db376159fc7..7f6c149c792e 100644
--- a/runtime/src/kmp_runtime.cpp
+++ b/runtime/src/kmp_runtime.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -47,16 +46,8 @@ char const __kmp_version_alt_comp[] =
KMP_VERSION_PREFIX "alternative compiler support: yes";
#endif /* defined(KMP_GOMP_COMPAT) */
-char const __kmp_version_omp_api[] = KMP_VERSION_PREFIX "API version: "
-#if OMP_50_ENABLED
- "5.0 (201611)";
-#elif OMP_45_ENABLED
- "4.5 (201511)";
-#elif OMP_40_ENABLED
- "4.0 (201307)";
-#else
- "3.1 (201107)";
-#endif
+char const __kmp_version_omp_api[] =
+ KMP_VERSION_PREFIX "API version: 5.0 (201611)";
#ifdef KMP_DEBUG
char const __kmp_version_lock[] =
@@ -80,7 +71,7 @@ static void __kmp_initialize_info(kmp_info_t *, kmp_team_t *, int tid,
static void __kmp_initialize_team(kmp_team_t *team, int new_nproc,
kmp_internal_control_t *new_icvs,
ident_t *loc);
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
+#if KMP_AFFINITY_SUPPORTED
static void __kmp_partition_places(kmp_team_t *team,
int update_master_only = 0);
#endif
@@ -328,7 +319,7 @@ void __kmp_infinite_loop(void) {
static int done = FALSE;
while (!done) {
- KMP_YIELD(1);
+ KMP_YIELD(TRUE);
}
}
@@ -533,22 +524,10 @@ static void __kmp_print_team_storage_map(const char *header, kmp_team_t *team,
&team->t.t_disp_buffer[num_disp_buff],
sizeof(dispatch_shared_info_t) * num_disp_buff,
"%s_%d.t_disp_buffer", header, team_id);
-
- __kmp_print_storage_map_gtid(-1, &team->t.t_taskq, &team->t.t_copypriv_data,
- sizeof(kmp_taskq_t), "%s_%d.t_taskq", header,
- team_id);
}
-static void __kmp_init_allocator() {
-#if OMP_50_ENABLED
- __kmp_init_memkind();
-#endif
-}
-static void __kmp_fini_allocator() {
-#if OMP_50_ENABLED
- __kmp_fini_memkind();
-#endif
-}
+static void __kmp_init_allocator() { __kmp_init_memkind(); }
+static void __kmp_fini_allocator() { __kmp_fini_memkind(); }
/* ------------------------------------------------------------------------ */
@@ -673,24 +652,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) {
#endif /* KMP_OS_WINDOWS */
#endif /* KMP_DYNAMIC_LIB */
-/* Change the library type to "status" and return the old type */
-/* called from within initialization routines where __kmp_initz_lock is held */
-int __kmp_change_library(int status) {
- int old_status;
-
- old_status = __kmp_yield_init &
- 1; // check whether KMP_LIBRARY=throughput (even init count)
-
- if (status) {
- __kmp_yield_init |= 1; // throughput => turnaround (odd init count)
- } else {
- __kmp_yield_init &= ~1; // turnaround => throughput (even init count)
- }
-
- return old_status; // return previous setting of whether
- // KMP_LIBRARY=throughput
-}
-
/* __kmp_parallel_deo -- Wait until it's our turn. */
void __kmp_parallel_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
int gtid = *gtid_ref;
@@ -709,8 +670,8 @@ void __kmp_parallel_deo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
#ifdef BUILD_PARALLEL_ORDERED
if (!team->t.t_serialized) {
KMP_MB();
- KMP_WAIT_YIELD(&team->t.t_ordered.dt.t_value, __kmp_tid_from_gtid(gtid),
- KMP_EQ, NULL);
+ KMP_WAIT(&team->t.t_ordered.dt.t_value, __kmp_tid_from_gtid(gtid), KMP_EQ,
+ NULL);
KMP_MB();
}
#endif /* BUILD_PARALLEL_ORDERED */
@@ -751,6 +712,7 @@ int __kmp_enter_single(int gtid, ident_t *id_ref, int push_ws) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
th = __kmp_threads[gtid];
team = th->th.th_team;
@@ -773,10 +735,7 @@ int __kmp_enter_single(int gtid, ident_t *id_ref, int push_ws) {
}
#if USE_ITT_BUILD
if (__itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 &&
- KMP_MASTER_GTID(gtid) &&
-#if OMP_40_ENABLED
- th->th.th_teams_microtask == NULL &&
-#endif
+ KMP_MASTER_GTID(gtid) && th->th.th_teams_microtask == NULL &&
team->t.t_active_level ==
1) { // Only report metadata by master of active team at level 1
__kmp_itt_metadata_single(id_ref);
@@ -814,16 +773,13 @@ void __kmp_exit_single(int gtid) {
* otherwise the number of threads to use
* The forkjoin lock is held by the caller. */
static int __kmp_reserve_threads(kmp_root_t *root, kmp_team_t *parent_team,
- int master_tid, int set_nthreads
-#if OMP_40_ENABLED
- ,
- int enter_teams
-#endif /* OMP_40_ENABLED */
- ) {
+ int master_tid, int set_nthreads,
+ int enter_teams) {
int capacity;
int new_nthreads;
KMP_DEBUG_ASSERT(__kmp_init_serial);
KMP_DEBUG_ASSERT(root && parent_team);
+ kmp_info_t *this_thr = parent_team->t.t_threads[master_tid];
// If dyn-var is set, dynamically adjust the number of desired threads,
// according to the method specified by dynamic_mode.
@@ -913,10 +869,12 @@ static int __kmp_reserve_threads(kmp_root_t *root, kmp_team_t *parent_team,
}
// Respect OMP_THREAD_LIMIT
- if (root->r.r_cg_nthreads + new_nthreads -
+ int cg_nthreads = this_thr->th.th_cg_roots->cg_nthreads;
+ int max_cg_threads = this_thr->th.th_cg_roots->cg_thread_limit;
+ if (cg_nthreads + new_nthreads -
(root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc) >
- __kmp_cg_max_nth) {
- int tl_nthreads = __kmp_cg_max_nth - root->r.r_cg_nthreads +
+ max_cg_threads) {
+ int tl_nthreads = max_cg_threads - cg_nthreads +
(root->r.r_active ? 1 : root->r.r_hot_team->t.t_nproc);
if (tl_nthreads <= 0) {
tl_nthreads = 1;
@@ -1069,11 +1027,9 @@ static void __kmp_fork_team_threads(kmp_root_t *root, kmp_team_t *team,
__kmp_gtid_from_tid(i, team), team->t.t_id, i,
team->t.t_bar[bs_forkjoin_barrier].b_arrived,
team->t.t_bar[bs_plain_barrier].b_arrived));
-#if OMP_40_ENABLED
thr->th.th_teams_microtask = master_th->th.th_teams_microtask;
thr->th.th_teams_level = master_th->th.th_teams_level;
thr->th.th_teams_size = master_th->th.th_teams_size;
-#endif
{ // Initialize threads' barrier data.
int b;
kmp_balign_t *balign = team->t.t_threads[i]->th.th_bar;
@@ -1087,12 +1043,11 @@ static void __kmp_fork_team_threads(kmp_root_t *root, kmp_team_t *team,
}
}
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
+#if KMP_AFFINITY_SUPPORTED
__kmp_partition_places(team);
#endif
}
-#if OMP_50_ENABLED
if (__kmp_display_affinity && team->t.t_display_affinity != 1) {
for (i = 0; i < team->t.t_nproc; i++) {
kmp_info_t *thr = team->t.t_threads[i];
@@ -1103,7 +1058,6 @@ static void __kmp_fork_team_threads(kmp_root_t *root, kmp_team_t *team,
}
}
}
-#endif
KMP_MB();
}
@@ -1188,6 +1142,7 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
this_thr = __kmp_threads[global_tid];
serial_team = this_thr->th.th_serial_team;
@@ -1208,7 +1163,6 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
this_thr->th.th_task_team = NULL;
}
-#if OMP_40_ENABLED
kmp_proc_bind_t proc_bind = this_thr->th.th_set_proc_bind;
if (this_thr->th.th_current_task->td_icvs.proc_bind == proc_bind_false) {
proc_bind = proc_bind_false;
@@ -1219,7 +1173,6 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
}
// Reset for next parallel region
this_thr->th.th_set_proc_bind = proc_bind_default;
-#endif /* OMP_40_ENABLED */
#if OMPT_SUPPORT
ompt_data_t ompt_parallel_data = ompt_data_none;
@@ -1254,15 +1207,13 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
__kmp_acquire_bootstrap_lock(&__kmp_forkjoin_lock);
- new_team = __kmp_allocate_team(this_thr->th.th_root, 1, 1,
+ new_team =
+ __kmp_allocate_team(this_thr->th.th_root, 1, 1,
#if OMPT_SUPPORT
- ompt_parallel_data,
+ ompt_parallel_data,
#endif
-#if OMP_40_ENABLED
- proc_bind,
-#endif
- &this_thr->th.th_current_task->td_icvs,
- 0 USE_NESTED_HOT_ARG(NULL));
+ proc_bind, &this_thr->th.th_current_task->td_icvs,
+ 0 USE_NESTED_HOT_ARG(NULL));
__kmp_release_bootstrap_lock(&__kmp_forkjoin_lock);
KMP_ASSERT(new_team);
@@ -1319,13 +1270,11 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
__kmp_nested_nth.nth[level + 1];
}
-#if OMP_40_ENABLED
if (__kmp_nested_proc_bind.used &&
(level + 1 < __kmp_nested_proc_bind.used)) {
this_thr->th.th_current_task->td_icvs.proc_bind =
__kmp_nested_proc_bind.bind_types[level + 1];
}
-#endif /* OMP_40_ENABLED */
#if USE_DEBUGGER
serial_team->t.t_pkfn = (microtask_t)(~0); // For the debugger.
@@ -1339,9 +1288,7 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
serial_team->t.t_level = serial_team->t.t_parent->t.t_level + 1;
serial_team->t.t_active_level = serial_team->t.t_parent->t.t_active_level;
-#if OMP_50_ENABLED
serial_team->t.t_def_allocator = this_thr->th.th_def_allocator; // save
-#endif
propagateFPControl(serial_team);
@@ -1391,11 +1338,8 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
KMP_MB();
}
-#if OMP_40_ENABLED
KMP_CHECK_UPDATE(serial_team->t.t_cancel_request, cancel_noreq);
-#endif
-#if OMP_50_ENABLED
// Perform the display affinity functionality for
// serialized parallel regions
if (__kmp_display_affinity) {
@@ -1407,7 +1351,6 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) {
this_thr->th.th_prev_num_threads = 1;
}
}
-#endif
if (__kmp_env_consistency_check)
__kmp_push_parallel(global_tid, NULL);
@@ -1465,10 +1408,8 @@ int __kmp_fork_call(ident_t *loc, int gtid,
int master_active;
int master_set_numthreads;
int level;
-#if OMP_40_ENABLED
int active_level;
int teams_level;
-#endif
#if KMP_NESTED_HOT_TEAMS
kmp_hot_team_ptr_t **p_hot_teams;
#endif
@@ -1491,6 +1432,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
__kmp_init_serial); // AC: potentially unsafe, not in sync with shutdown
if (!TCR_4(__kmp_init_parallel))
__kmp_parallel_initialize();
+ __kmp_resume_if_soft_paused();
/* setup current data */
master_th = __kmp_threads[gtid]; // AC: potentially unsafe, not in sync with
@@ -1520,10 +1462,8 @@ int __kmp_fork_call(ident_t *loc, int gtid,
level = parent_team->t.t_level;
// used to launch non-serial teams even if nested is not allowed
active_level = parent_team->t.t_active_level;
-#if OMP_40_ENABLED
// needed to check nesting inside the teams
teams_level = master_th->th.th_teams_level;
-#endif
#if KMP_NESTED_HOT_TEAMS
p_hot_teams = &master_th->th.th_hot_teams;
if (*p_hot_teams == NULL && __kmp_hot_teams_max_level > 0) {
@@ -1551,7 +1491,6 @@ int __kmp_fork_call(ident_t *loc, int gtid,
master_th->th.th_ident = loc;
-#if OMP_40_ENABLED
if (master_th->th.th_teams_microtask && ap &&
microtask != (microtask_t)__kmp_teams_master && level == teams_level) {
// AC: This is start of parallel that is nested inside teams construct.
@@ -1645,9 +1584,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
KMP_ATOMIC_INC(&root->r.r_in_parallel);
parent_team->t.t_active_level++;
parent_team->t.t_level++;
-#if OMP_50_ENABLED
parent_team->t.t_def_allocator = master_th->th.th_def_allocator; // save
-#endif
/* Change number of threads in the team if requested */
if (master_set_numthreads) { // The parallel has num_threads clause
@@ -1695,7 +1632,6 @@ int __kmp_fork_call(ident_t *loc, int gtid,
return TRUE;
} // Parallel closely nested in teams construct
-#endif /* OMP_40_ENABLED */
#if KMP_DEBUG
if (__kmp_tasking_mode != tskm_immediate_exec) {
@@ -1708,10 +1644,8 @@ int __kmp_fork_call(ident_t *loc, int gtid,
master_th->th.th_current_task->td_icvs.max_active_levels) {
nthreads = 1;
} else {
-#if OMP_40_ENABLED
int enter_teams = ((ap == NULL && active_level == 0) ||
(ap && teams_level > 0 && teams_level == level));
-#endif
nthreads =
master_set_numthreads
? master_set_numthreads
@@ -1723,11 +1657,8 @@ int __kmp_fork_call(ident_t *loc, int gtid,
// parallel out of teams construct). This code moved here from
// __kmp_reserve_threads() to speedup nested serialized parallels.
if (nthreads > 1) {
- if ((!get__nested(master_th) && (root->r.r_in_parallel
-#if OMP_40_ENABLED
- && !enter_teams
-#endif /* OMP_40_ENABLED */
- )) ||
+ if ((get__max_active_levels(master_th) == 1 &&
+ (root->r.r_in_parallel && !enter_teams)) ||
(__kmp_library == library_serial)) {
KC_TRACE(10, ("__kmp_fork_call: T#%d serializing team; requested %d"
" threads\n",
@@ -1738,18 +1669,12 @@ int __kmp_fork_call(ident_t *loc, int gtid,
if (nthreads > 1) {
/* determine how many new threads we can use */
__kmp_acquire_bootstrap_lock(&__kmp_forkjoin_lock);
- nthreads = __kmp_reserve_threads(
- root, parent_team, master_tid, nthreads
-#if OMP_40_ENABLED
- /* AC: If we execute teams from parallel region (on host), then
- teams should be created but each can only have 1 thread if
- nesting is disabled. If teams called from serial region, then
- teams and their threads should be created regardless of the
- nesting setting. */
- ,
- enter_teams
-#endif /* OMP_40_ENABLED */
- );
+ /* AC: If we execute teams from parallel region (on host), then teams
+ should be created but each can only have 1 thread if nesting is
+ disabled. If teams called from serial region, then teams and their
+ threads should be created regardless of the nesting setting. */
+ nthreads = __kmp_reserve_threads(root, parent_team, master_tid,
+ nthreads, enter_teams);
if (nthreads == 1) {
// Free lock for single thread execution here; for multi-thread
// execution it will be freed later after team of threads created
@@ -1782,7 +1707,6 @@ int __kmp_fork_call(ident_t *loc, int gtid,
if (call_context == fork_context_intel) {
/* TODO this sucks, use the compiler itself to pass args! :) */
master_th->th.th_serial_team->t.t_ident = loc;
-#if OMP_40_ENABLED
if (!ap) {
// revert change made in __kmpc_serialized_parallel()
master_th->th.th_serial_team->t.t_level--;
@@ -1877,14 +1801,13 @@ int __kmp_fork_call(ident_t *loc, int gtid,
// AC: call special invoker for outer "parallel" of teams construct
invoker(gtid);
} else {
-#endif /* OMP_40_ENABLED */
argv = args;
for (i = argc - 1; i >= 0; --i)
// TODO: revert workaround for Intel(R) 64 tracker #96
#if (KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64) && KMP_OS_LINUX
*argv++ = va_arg(*ap, void *);
#else
- *argv++ = va_arg(ap, void *);
+ *argv++ = va_arg(ap, void *);
#endif
KMP_MB();
@@ -1950,9 +1873,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
master_th->th.ompt_thread_info.state = ompt_state_overhead;
}
#endif
-#if OMP_40_ENABLED
}
-#endif /* OMP_40_ENABLED */
} else if (call_context == fork_context_gnu) {
#if OMPT_SUPPORT
ompt_lw_taskteam_t lwt;
@@ -1989,10 +1910,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
// KMP_ASSERT( master_th->th.th_current_task->td_flags.executing == 1 );
master_th->th.th_current_task->td_flags.executing = 0;
-#if OMP_40_ENABLED
- if (!master_th->th.th_teams_microtask || level > teams_level)
-#endif /* OMP_40_ENABLED */
- {
+ if (!master_th->th.th_teams_microtask || level > teams_level) {
/* Increment our nested depth level */
KMP_ATOMIC_INC(&root->r.r_in_parallel);
}
@@ -2006,7 +1924,6 @@ int __kmp_fork_call(ident_t *loc, int gtid,
nthreads_icv = 0; // don't update
}
-#if OMP_40_ENABLED
// Figure out the proc_bind_policy for the new team.
kmp_proc_bind_t proc_bind = master_th->th.th_set_proc_bind;
kmp_proc_bind_t proc_bind_icv =
@@ -2032,25 +1949,17 @@ int __kmp_fork_call(ident_t *loc, int gtid,
// Reset for next parallel region
master_th->th.th_set_proc_bind = proc_bind_default;
-#endif /* OMP_40_ENABLED */
- if ((nthreads_icv > 0)
-#if OMP_40_ENABLED
- || (proc_bind_icv != proc_bind_default)
-#endif /* OMP_40_ENABLED */
- ) {
+ if ((nthreads_icv > 0) || (proc_bind_icv != proc_bind_default)) {
kmp_internal_control_t new_icvs;
copy_icvs(&new_icvs, &master_th->th.th_current_task->td_icvs);
new_icvs.next = NULL;
if (nthreads_icv > 0) {
new_icvs.nproc = nthreads_icv;
}
-
-#if OMP_40_ENABLED
if (proc_bind_icv != proc_bind_default) {
new_icvs.proc_bind = proc_bind_icv;
}
-#endif /* OMP_40_ENABLED */
/* allocate a new parallel team */
KF_TRACE(10, ("__kmp_fork_call: before __kmp_allocate_team\n"));
@@ -2058,10 +1967,8 @@ int __kmp_fork_call(ident_t *loc, int gtid,
#if OMPT_SUPPORT
ompt_parallel_data,
#endif
-#if OMP_40_ENABLED
- proc_bind,
-#endif
- &new_icvs, argc USE_NESTED_HOT_ARG(master_th));
+ proc_bind, &new_icvs,
+ argc USE_NESTED_HOT_ARG(master_th));
} else {
/* allocate a new parallel team */
KF_TRACE(10, ("__kmp_fork_call: before __kmp_allocate_team\n"));
@@ -2069,9 +1976,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
#if OMPT_SUPPORT
ompt_parallel_data,
#endif
-#if OMP_40_ENABLED
proc_bind,
-#endif
&master_th->th.th_current_task->td_icvs,
argc USE_NESTED_HOT_ARG(master_th));
}
@@ -2089,15 +1994,12 @@ int __kmp_fork_call(ident_t *loc, int gtid,
return_address);
#endif
KMP_CHECK_UPDATE(team->t.t_invoke, invoker); // TODO move to root, maybe
-// TODO: parent_team->t.t_level == INT_MAX ???
-#if OMP_40_ENABLED
+ // TODO: parent_team->t.t_level == INT_MAX ???
if (!master_th->th.th_teams_microtask || level > teams_level) {
-#endif /* OMP_40_ENABLED */
int new_level = parent_team->t.t_level + 1;
KMP_CHECK_UPDATE(team->t.t_level, new_level);
new_level = parent_team->t.t_active_level + 1;
KMP_CHECK_UPDATE(team->t.t_active_level, new_level);
-#if OMP_40_ENABLED
} else {
// AC: Do not increase parallel level at start of the teams construct
int new_level = parent_team->t.t_level;
@@ -2105,17 +2007,12 @@ int __kmp_fork_call(ident_t *loc, int gtid,
new_level = parent_team->t.t_active_level;
KMP_CHECK_UPDATE(team->t.t_active_level, new_level);
}
-#endif /* OMP_40_ENABLED */
kmp_r_sched_t new_sched = get__sched_2(parent_team, master_tid);
// set master's schedule as new run-time schedule
KMP_CHECK_UPDATE(team->t.t_sched.sched, new_sched.sched);
-#if OMP_40_ENABLED
KMP_CHECK_UPDATE(team->t.t_cancel_request, cancel_noreq);
-#endif
-#if OMP_50_ENABLED
KMP_CHECK_UPDATE(team->t.t_def_allocator, master_th->th.th_def_allocator);
-#endif
// Update the floating point rounding in the team if required.
propagateFPControl(team);
@@ -2191,27 +2088,23 @@ int __kmp_fork_call(ident_t *loc, int gtid,
/* now, setup the arguments */
argv = (void **)team->t.t_argv;
-#if OMP_40_ENABLED
if (ap) {
-#endif /* OMP_40_ENABLED */
for (i = argc - 1; i >= 0; --i) {
// TODO: revert workaround for Intel(R) 64 tracker #96
#if (KMP_ARCH_X86_64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64) && KMP_OS_LINUX
void *new_argv = va_arg(*ap, void *);
#else
- void *new_argv = va_arg(ap, void *);
+ void *new_argv = va_arg(ap, void *);
#endif
KMP_CHECK_UPDATE(*argv, new_argv);
argv++;
}
-#if OMP_40_ENABLED
} else {
for (i = 0; i < argc; ++i) {
// Get args from parent team for teams construct
KMP_CHECK_UPDATE(argv[i], team->t.t_parent->t.t_argv[i]);
}
}
-#endif /* OMP_40_ENABLED */
/* now actually fork the threads */
KMP_CHECK_UPDATE(team->t.t_master_active, master_active);
@@ -2230,10 +2123,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
#if USE_ITT_BUILD
if (team->t.t_active_level == 1 // only report frames at level 1
-#if OMP_40_ENABLED
- && !master_th->th.th_teams_microtask // not in teams construct
-#endif /* OMP_40_ENABLED */
- ) {
+ && !master_th->th.th_teams_microtask) { // not in teams construct
#if USE_ITT_NOTIFY
if ((__itt_frame_submit_v3_ptr || KMP_ITT_DEBUG) &&
(__kmp_forkjoin_frames_mode == 3 ||
@@ -2271,12 +2161,9 @@ int __kmp_fork_call(ident_t *loc, int gtid,
}
#endif /* USE_ITT_BUILD */
-#if OMP_40_ENABLED
// AC: skip __kmp_internal_fork at teams construct, let only master
// threads execute
- if (ap)
-#endif /* OMP_40_ENABLED */
- {
+ if (ap) {
__kmp_internal_fork(loc, gtid, team);
KF_TRACE(10, ("__kmp_internal_fork : after : root=%p, team=%p, "
"master_th=%p, gtid=%d\n",
@@ -2293,9 +2180,25 @@ int __kmp_fork_call(ident_t *loc, int gtid,
team->t.t_id, team->t.t_pkfn));
} // END of timer KMP_fork_call block
+#if KMP_STATS_ENABLED
+ // If beginning a teams construct, then change thread state
+ stats_state_e previous_state = KMP_GET_THREAD_STATE();
+ if (!ap) {
+ KMP_SET_THREAD_STATE(stats_state_e::TEAMS_REGION);
+ }
+#endif
+
if (!team->t.t_invoke(gtid)) {
KMP_ASSERT2(0, "cannot invoke microtask for MASTER thread");
}
+
+#if KMP_STATS_ENABLED
+ // If was beginning of a teams construct, then reset thread state
+ if (!ap) {
+ KMP_SET_THREAD_STATE(previous_state);
+ }
+#endif
+
KA_TRACE(20, ("__kmp_fork_call: T#%d(%d:0) done microtask = %p\n", gtid,
team->t.t_id, team->t.t_pkfn));
KMP_MB(); /* Flush all pending memory write invalidates. */
@@ -2340,18 +2243,14 @@ void __kmp_join_call(ident_t *loc, int gtid
,
enum fork_context_e fork_context
#endif
-#if OMP_40_ENABLED
,
- int exit_teams
-#endif /* OMP_40_ENABLED */
- ) {
+ int exit_teams) {
KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(KMP_join_call);
kmp_team_t *team;
kmp_team_t *parent_team;
kmp_info_t *master_th;
kmp_root_t *root;
int master_active;
- int i;
KA_TRACE(20, ("__kmp_join_call: enter T#%d\n", gtid));
@@ -2382,7 +2281,6 @@ void __kmp_join_call(ident_t *loc, int gtid
#endif
if (team->t.t_serialized) {
-#if OMP_40_ENABLED
if (master_th->th.th_teams_microtask) {
// We are in teams construct
int level = team->t.t_level;
@@ -2398,7 +2296,6 @@ void __kmp_join_call(ident_t *loc, int gtid
team->t.t_serialized++;
}
}
-#endif /* OMP_40_ENABLED */
__kmpc_end_serialized_parallel(loc, gtid);
#if OMPT_SUPPORT
@@ -2412,20 +2309,14 @@ void __kmp_join_call(ident_t *loc, int gtid
master_active = team->t.t_master_active;
-#if OMP_40_ENABLED
- if (!exit_teams)
-#endif /* OMP_40_ENABLED */
- {
+ if (!exit_teams) {
// AC: No barrier for internal teams at exit from teams construct.
// But there is barrier for external team (league).
__kmp_internal_join(loc, gtid, team);
- }
-#if OMP_40_ENABLED
- else {
+ } else {
master_th->th.th_task_state =
0; // AC: no tasking in teams (out of any parallel)
}
-#endif /* OMP_40_ENABLED */
KMP_MB();
@@ -2442,11 +2333,8 @@ void __kmp_join_call(ident_t *loc, int gtid
}
// Mark end of "parallel" region for Intel(R) VTune(TM) analyzer.
- if (team->t.t_active_level == 1
-#if OMP_40_ENABLED
- && !master_th->th.th_teams_microtask /* not in teams construct */
-#endif /* OMP_40_ENABLED */
- ) {
+ if (team->t.t_active_level == 1 &&
+ !master_th->th.th_teams_microtask) { /* not in teams construct */
master_th->th.th_ident = loc;
// only one notification scheme (either "submit" or "forking/joined", not
// both)
@@ -2461,7 +2349,6 @@ void __kmp_join_call(ident_t *loc, int gtid
} // active_level == 1
#endif /* USE_ITT_BUILD */
-#if OMP_40_ENABLED
if (master_th->th.th_teams_microtask && !exit_teams &&
team->t.t_pkfn != (microtask_t)__kmp_teams_master &&
team->t.t_level == master_th->th.th_teams_level + 1) {
@@ -2474,21 +2361,24 @@ void __kmp_join_call(ident_t *loc, int gtid
team->t.t_active_level--;
KMP_ATOMIC_DEC(&root->r.r_in_parallel);
- /* Restore number of threads in the team if needed */
+ // Restore number of threads in the team if needed. This code relies on
+ // the proper adjustment of th_teams_size.nth after the fork in
+ // __kmp_teams_master on each teams master in the case that
+ // __kmp_reserve_threads reduced it.
if (master_th->th.th_team_nproc < master_th->th.th_teams_size.nth) {
int old_num = master_th->th.th_team_nproc;
int new_num = master_th->th.th_teams_size.nth;
kmp_info_t **other_threads = team->t.t_threads;
team->t.t_nproc = new_num;
- for (i = 0; i < old_num; ++i) {
+ for (int i = 0; i < old_num; ++i) {
other_threads[i]->th.th_team_nproc = new_num;
}
// Adjust states of non-used threads of the team
- for (i = old_num; i < new_num; ++i) {
+ for (int i = old_num; i < new_num; ++i) {
// Re-initialize thread's barrier data.
- int b;
+ KMP_DEBUG_ASSERT(other_threads[i]);
kmp_balign_t *balign = other_threads[i]->th.th_bar;
- for (b = 0; b < bs_last_barrier; ++b) {
+ for (int b = 0; b < bs_last_barrier; ++b) {
balign[b].bb.b_arrived = team->t.t_bar[b].b_arrived;
KMP_DEBUG_ASSERT(balign[b].bb.wait_flag != KMP_BARRIER_PARENT_FLAG);
#if USE_DEBUGGER
@@ -2511,7 +2401,6 @@ void __kmp_join_call(ident_t *loc, int gtid
return;
}
-#endif /* OMP_40_ENABLED */
/* do cleanup and restore the parent team */
master_th->th.th_info.ds.ds_tid = team->t.t_master_tid;
@@ -2524,11 +2413,8 @@ void __kmp_join_call(ident_t *loc, int gtid
from the serial user code called after this function returns. */
__kmp_acquire_bootstrap_lock(&__kmp_forkjoin_lock);
-#if OMP_40_ENABLED
if (!master_th->th.th_teams_microtask ||
- team->t.t_level > master_th->th.th_teams_level)
-#endif /* OMP_40_ENABLED */
- {
+ team->t.t_level > master_th->th.th_teams_level) {
/* Decrement our nested depth level */
KMP_ATOMIC_DEC(&root->r.r_in_parallel);
}
@@ -2553,14 +2439,12 @@ void __kmp_join_call(ident_t *loc, int gtid
master_th, team));
__kmp_pop_current_task_from_thread(master_th);
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
+#if KMP_AFFINITY_SUPPORTED
// Restore master thread's partition.
master_th->th.th_first_place = team->t.t_first_place;
master_th->th.th_last_place = team->t.t_last_place;
-#endif /* OMP_40_ENABLED */
-#if OMP_50_ENABLED
+#endif // KMP_AFFINITY_SUPPORTED
master_th->th.th_def_allocator = team->t.t_def_allocator;
-#endif
updateHWFPControl(team);
@@ -2791,9 +2675,13 @@ int __kmp_get_max_active_levels(int gtid) {
return thread->th.th_current_task->td_icvs.max_active_levels;
}
+KMP_BUILD_ASSERT(sizeof(kmp_sched_t) == sizeof(int));
+KMP_BUILD_ASSERT(sizeof(enum sched_type) == sizeof(int));
+
/* Changes def_sched_var ICV values (run-time schedule kind and chunk) */
void __kmp_set_schedule(int gtid, kmp_sched_t kind, int chunk) {
kmp_info_t *thread;
+ kmp_sched_t orig_kind;
// kmp_team_t *team;
KF_TRACE(10, ("__kmp_set_schedule: new schedule for thread %d = (%d, %d)\n",
@@ -2804,6 +2692,9 @@ void __kmp_set_schedule(int gtid, kmp_sched_t kind, int chunk) {
// Valid parameters should fit in one of two intervals - standard or extended:
// <lower>, <valid>, <upper_std>, <lower_ext>, <valid>, <upper>
// 2008-01-25: 0, 1 - 4, 5, 100, 101 - 102, 103
+ orig_kind = kind;
+ kind = __kmp_sched_without_mods(kind);
+
if (kind <= kmp_sched_lower || kind >= kmp_sched_upper ||
(kind <= kmp_sched_lower_ext && kind >= kmp_sched_upper_std)) {
// TODO: Hint needs attention in case we change the default schedule.
@@ -2834,6 +2725,8 @@ void __kmp_set_schedule(int gtid, kmp_sched_t kind, int chunk) {
__kmp_sch_map[kind - kmp_sched_lower_ext + kmp_sched_upper_std -
kmp_sched_lower - 2];
}
+ __kmp_sched_apply_mods_intkind(
+ orig_kind, &(thread->th.th_current_task->td_icvs.sched.r_sched_type));
if (kind == kmp_sched_auto || chunk < 1) {
// ignore parameter chunk for schedule auto
thread->th.th_current_task->td_icvs.sched.chunk = KMP_DEFAULT_CHUNK;
@@ -2853,12 +2746,12 @@ void __kmp_get_schedule(int gtid, kmp_sched_t *kind, int *chunk) {
thread = __kmp_threads[gtid];
th_type = thread->th.th_current_task->td_icvs.sched.r_sched_type;
-
- switch (th_type) {
+ switch (SCHEDULE_WITHOUT_MODIFIERS(th_type)) {
case kmp_sch_static:
case kmp_sch_static_greedy:
case kmp_sch_static_balanced:
*kind = kmp_sched_static;
+ __kmp_sched_apply_mods_stdkind(kind, th_type);
*chunk = 0; // chunk was not set, try to show this fact via zero value
return;
case kmp_sch_static_chunked:
@@ -2887,6 +2780,7 @@ void __kmp_get_schedule(int gtid, kmp_sched_t *kind, int *chunk) {
KMP_FATAL(UnknownSchedulingType, th_type);
}
+ __kmp_sched_apply_mods_stdkind(kind, th_type);
*chunk = thread->th.th_current_task->td_icvs.sched.chunk;
}
@@ -2910,7 +2804,6 @@ int __kmp_get_ancestor_thread_num(int gtid, int level) {
if (level > ii)
return -1;
-#if OMP_40_ENABLED
if (thr->th.th_teams_microtask) {
// AC: we are in teams region where multiple nested teams have same level
int tlevel = thr->th.th_teams_level; // the level of the teams construct
@@ -2926,7 +2819,6 @@ int __kmp_get_ancestor_thread_num(int gtid, int level) {
}
}
}
-#endif
if (ii == level)
return __kmp_tid_from_gtid(gtid);
@@ -2970,7 +2862,6 @@ int __kmp_get_team_size(int gtid, int level) {
if (level > ii)
return -1;
-#if OMP_40_ENABLED
if (thr->th.th_teams_microtask) {
// AC: we are in teams region where multiple nested teams have same level
int tlevel = thr->th.th_teams_level; // the level of the teams construct
@@ -2986,7 +2877,6 @@ int __kmp_get_team_size(int gtid, int level) {
}
}
}
-#endif
while (ii > level) {
for (dd = team->t.t_serialized; (dd > 0) && (ii > level); dd--, ii--) {
@@ -3015,15 +2905,18 @@ kmp_r_sched_t __kmp_get_schedule_global() {
// __kmp_guided. __kmp_sched should keep original value, so that user can set
// KMP_SCHEDULE multiple times, and thus have different run-time schedules in
// different roots (even in OMP 2.5)
- if (__kmp_sched == kmp_sch_static) {
+ enum sched_type s = SCHEDULE_WITHOUT_MODIFIERS(__kmp_sched);
+ enum sched_type sched_modifiers = SCHEDULE_GET_MODIFIERS(__kmp_sched);
+ if (s == kmp_sch_static) {
// replace STATIC with more detailed schedule (balanced or greedy)
r_sched.r_sched_type = __kmp_static;
- } else if (__kmp_sched == kmp_sch_guided_chunked) {
+ } else if (s == kmp_sch_guided_chunked) {
// replace GUIDED with more detailed schedule (iterative or analytical)
r_sched.r_sched_type = __kmp_guided;
} else { // (STATIC_CHUNKED), or (DYNAMIC_CHUNKED), or other
r_sched.r_sched_type = __kmp_sched;
}
+ SCHEDULE_SET_MODIFIERS(r_sched.r_sched_type, sched_modifiers);
if (__kmp_chunk < KMP_DEFAULT_CHUNK) {
// __kmp_chunk may be wrong here (if it was not ever set)
@@ -3099,9 +2992,7 @@ static void __kmp_allocate_team_arrays(kmp_team_t *team, int max_nth) {
/* setup dispatch buffers */
for (i = 0; i < num_disp_buff; ++i) {
team->t.t_disp_buffer[i].buffer_index = i;
-#if OMP_45_ENABLED
team->t.t_disp_buffer[i].doacross_buf_idx = i;
-#endif
}
}
@@ -3146,14 +3037,10 @@ static kmp_internal_control_t __kmp_get_global_icvs(void) {
kmp_r_sched_t r_sched =
__kmp_get_schedule_global(); // get current state of scheduling globals
-#if OMP_40_ENABLED
KMP_DEBUG_ASSERT(__kmp_nested_proc_bind.used > 0);
-#endif /* OMP_40_ENABLED */
kmp_internal_control_t g_icvs = {
0, // int serial_nesting_level; //corresponds to value of th_team_serialized
- (kmp_int8)__kmp_dflt_nested, // int nested; //internal control
- // for nested parallelism (per thread)
(kmp_int8)__kmp_global.g.g_dynamic, // internal control for dynamic
// adjustment of threads (per thread)
(kmp_int8)__kmp_env_blocktime, // int bt_set; //internal control for
@@ -3166,14 +3053,13 @@ static kmp_internal_control_t __kmp_get_global_icvs(void) {
__kmp_dflt_team_nth, // int nproc; //internal control for # of threads for
// next parallel region (per thread)
// (use a max ub on value if __kmp_parallel_initialize not called yet)
+ __kmp_cg_max_nth, // int thread_limit;
__kmp_dflt_max_active_levels, // int max_active_levels; //internal control
// for max_active_levels
r_sched, // kmp_r_sched_t sched; //internal control for runtime schedule
-// {sched,chunk} pair
-#if OMP_40_ENABLED
+ // {sched,chunk} pair
__kmp_nested_proc_bind.bind_types[0],
__kmp_default_device,
-#endif /* OMP_40_ENABLED */
NULL // struct kmp_internal_control *next;
};
@@ -3208,8 +3094,6 @@ static void __kmp_initialize_root(kmp_root_t *root) {
root->r.r_active = FALSE;
root->r.r_in_parallel = 0;
root->r.r_blocktime = __kmp_dflt_blocktime;
- root->r.r_nested = __kmp_dflt_nested;
- root->r.r_cg_nthreads = 1;
/* setup the root team for this task */
/* allocate the root team structure */
@@ -3222,10 +3106,7 @@ static void __kmp_initialize_root(kmp_root_t *root) {
#if OMPT_SUPPORT
ompt_data_none, // root parallel id
#endif
-#if OMP_40_ENABLED
- __kmp_nested_proc_bind.bind_types[0],
-#endif
- &r_icvs,
+ __kmp_nested_proc_bind.bind_types[0], &r_icvs,
0 // argc
USE_NESTED_HOT_ARG(NULL) // master thread is unknown
);
@@ -3262,10 +3143,7 @@ static void __kmp_initialize_root(kmp_root_t *root) {
#if OMPT_SUPPORT
ompt_data_none, // root parallel id
#endif
-#if OMP_40_ENABLED
- __kmp_nested_proc_bind.bind_types[0],
-#endif
- &r_icvs,
+ __kmp_nested_proc_bind.bind_types[0], &r_icvs,
0 // argc
USE_NESTED_HOT_ARG(NULL) // master thread is unknown
);
@@ -3406,9 +3284,7 @@ void __kmp_print_structure(void) {
thread->th.th_team_master);
__kmp_printf(" Serialized?: %2d\n", thread->th.th_team_serialized);
__kmp_printf(" Set NProc: %2d\n", thread->th.th_set_nproc);
-#if OMP_40_ENABLED
__kmp_printf(" Set Proc Bind: %2d\n", thread->th.th_set_proc_bind);
-#endif
__kmp_print_structure_thread(" Next in pool: ",
thread->th.th_next_pool);
__kmp_printf("\n");
@@ -3434,7 +3310,6 @@ void __kmp_print_structure(void) {
__kmp_print_structure_thread(" Uber Thread: ",
root->r.r_uber_thread);
__kmp_printf(" Active?: %2d\n", root->r.r_active);
- __kmp_printf(" Nested?: %2d\n", root->r.r_nested);
__kmp_printf(" In Parallel: %2d\n",
KMP_ATOMIC_LD_RLX(&root->r.r_in_parallel));
__kmp_printf("\n");
@@ -3775,15 +3650,12 @@ int __kmp_register_root(int initial_thread) {
if (!root_thread->th.th_serial_team) {
kmp_internal_control_t r_icvs = __kmp_get_global_icvs();
KF_TRACE(10, ("__kmp_register_root: before serial_team\n"));
- root_thread->th.th_serial_team =
- __kmp_allocate_team(root, 1, 1,
+ root_thread->th.th_serial_team = __kmp_allocate_team(
+ root, 1, 1,
#if OMPT_SUPPORT
- ompt_data_none, // root parallel id
-#endif
-#if OMP_40_ENABLED
- proc_bind_default,
+ ompt_data_none, // root parallel id
#endif
- &r_icvs, 0 USE_NESTED_HOT_ARG(NULL));
+ proc_bind_default, &r_icvs, 0 USE_NESTED_HOT_ARG(NULL));
}
KMP_ASSERT(root_thread->th.th_serial_team);
KF_TRACE(10, ("__kmp_register_root: after serial_team = %p\n",
@@ -3834,21 +3706,27 @@ int __kmp_register_root(int initial_thread) {
KMP_INIT_BARRIER_STATE);
#if KMP_AFFINITY_SUPPORTED
-#if OMP_40_ENABLED
root_thread->th.th_current_place = KMP_PLACE_UNDEFINED;
root_thread->th.th_new_place = KMP_PLACE_UNDEFINED;
root_thread->th.th_first_place = KMP_PLACE_UNDEFINED;
root_thread->th.th_last_place = KMP_PLACE_UNDEFINED;
-#endif
if (TCR_4(__kmp_init_middle)) {
__kmp_affinity_set_init_mask(gtid, TRUE);
}
#endif /* KMP_AFFINITY_SUPPORTED */
-#if OMP_50_ENABLED
root_thread->th.th_def_allocator = __kmp_def_allocator;
root_thread->th.th_prev_level = 0;
root_thread->th.th_prev_num_threads = 1;
-#endif
+
+ kmp_cg_root_t *tmp = (kmp_cg_root_t *)__kmp_allocate(sizeof(kmp_cg_root_t));
+ tmp->cg_root = root_thread;
+ tmp->cg_thread_limit = __kmp_cg_max_nth;
+ tmp->cg_nthreads = 1;
+ KA_TRACE(100, ("__kmp_register_root: Thread %p created node %p with"
+ " cg_nthreads init to 1\n",
+ root_thread, tmp));
+ tmp->up = NULL;
+ root_thread->th.th_cg_roots = tmp;
__kmp_root_counter++;
@@ -3864,11 +3742,11 @@ int __kmp_register_root(int initial_thread) {
ompt_thread_initial, __ompt_get_thread_data_internal());
}
ompt_data_t *task_data;
- __ompt_get_task_info_internal(0, NULL, &task_data, NULL, NULL, NULL);
- if (ompt_enabled.ompt_callback_task_create) {
- ompt_callbacks.ompt_callback(ompt_callback_task_create)(
- NULL, NULL, task_data, ompt_task_initial, 0, NULL);
- // initial task has nothing to return to
+ ompt_data_t *parallel_data;
+ __ompt_get_task_info_internal(0, NULL, &task_data, NULL, &parallel_data, NULL);
+ if (ompt_enabled.ompt_callback_implicit_task) {
+ ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
+ ompt_scope_begin, parallel_data, task_data, 1, 1, ompt_task_initial);
}
ompt_set_thread_state(root_thread, ompt_state_work_serial);
@@ -3958,6 +3836,13 @@ static int __kmp_reset_root(int gtid, kmp_root_t *root) {
#endif /* KMP_OS_WINDOWS */
#if OMPT_SUPPORT
+ ompt_data_t *task_data;
+ ompt_data_t *parallel_data;
+ __ompt_get_task_info_internal(0, NULL, &task_data, NULL, &parallel_data, NULL);
+ if (ompt_enabled.ompt_callback_implicit_task) {
+ ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
+ ompt_scope_end, parallel_data, task_data, 0, 1, ompt_task_initial);
+ }
if (ompt_enabled.ompt_callback_thread_end) {
ompt_callbacks.ompt_callback(ompt_callback_thread_end)(
&(root->r.r_uber_thread->th.ompt_thread_info.thread_data));
@@ -3966,8 +3851,19 @@ static int __kmp_reset_root(int gtid, kmp_root_t *root) {
TCW_4(__kmp_nth,
__kmp_nth - 1); // __kmp_reap_thread will decrement __kmp_all_nth.
- root->r.r_cg_nthreads--;
-
+ i = root->r.r_uber_thread->th.th_cg_roots->cg_nthreads--;
+ KA_TRACE(100, ("__kmp_reset_root: Thread %p decrement cg_nthreads on node %p"
+ " to %d\n",
+ root->r.r_uber_thread, root->r.r_uber_thread->th.th_cg_roots,
+ root->r.r_uber_thread->th.th_cg_roots->cg_nthreads));
+ if (i == 1) {
+ // need to free contention group structure
+ KMP_DEBUG_ASSERT(root->r.r_uber_thread ==
+ root->r.r_uber_thread->th.th_cg_roots->cg_root);
+ KMP_DEBUG_ASSERT(root->r.r_uber_thread->th.th_cg_roots->up == NULL);
+ __kmp_free(root->r.r_uber_thread->th.th_cg_roots);
+ root->r.r_uber_thread->th.th_cg_roots = NULL;
+ }
__kmp_reap_thread(root->r.r_uber_thread, 1);
// We canot put root thread to __kmp_thread_pool, so we have to reap it istead
@@ -4001,7 +3897,6 @@ void __kmp_unregister_root_current_thread(int gtid) {
KMP_MB();
-#if OMP_45_ENABLED
kmp_info_t *thread = __kmp_threads[gtid];
kmp_team_t *team = thread->th.th_team;
kmp_task_team_t *task_team = thread->th.th_task_team;
@@ -4014,7 +3909,6 @@ void __kmp_unregister_root_current_thread(int gtid) {
#endif
__kmp_task_team_wait(thread, team USE_ITT_BUILD_ARG(NULL));
}
-#endif
__kmp_reset_root(gtid, root);
@@ -4098,12 +3992,10 @@ static void __kmp_initialize_info(kmp_info_t *this_thr, kmp_team_t *team,
this_thr->th.th_reap_state = KMP_NOT_SAFE_TO_REAP;
else // no tasking --> always safe to reap
this_thr->th.th_reap_state = KMP_SAFE_TO_REAP;
-#if OMP_40_ENABLED
this_thr->th.th_set_proc_bind = proc_bind_default;
#if KMP_AFFINITY_SUPPORTED
this_thr->th.th_new_place = this_thr->th.th_current_place;
#endif
-#endif
this_thr->th.th_root = master->th.th_root;
/* setup the thread's cache of the team structure */
@@ -4141,6 +4033,33 @@ static void __kmp_initialize_info(kmp_info_t *this_thr, kmp_team_t *team,
this_thr->th.th_pri_head = NULL;
}
+ if (this_thr != master && // Master's CG root is initialized elsewhere
+ this_thr->th.th_cg_roots != master->th.th_cg_roots) { // CG root not set
+ // Make new thread's CG root same as master's
+ KMP_DEBUG_ASSERT(master->th.th_cg_roots);
+ kmp_cg_root_t *tmp = this_thr->th.th_cg_roots;
+ if (tmp) {
+ // worker changes CG, need to check if old CG should be freed
+ int i = tmp->cg_nthreads--;
+ KA_TRACE(100, ("__kmp_initialize_info: Thread %p decrement cg_nthreads"
+ " on node %p of thread %p to %d\n",
+ this_thr, tmp, tmp->cg_root, tmp->cg_nthreads));
+ if (i == 1) {
+ __kmp_free(tmp); // last thread left CG --> free it
+ }
+ }
+ this_thr->th.th_cg_roots = master->th.th_cg_roots;
+ // Increment new thread's CG root's counter to add the new thread
+ this_thr->th.th_cg_roots->cg_nthreads++;
+ KA_TRACE(100, ("__kmp_initialize_info: Thread %p increment cg_nthreads on"
+ " node %p of thread %p to %d\n",
+ this_thr, this_thr->th.th_cg_roots,
+ this_thr->th.th_cg_roots->cg_root,
+ this_thr->th.th_cg_roots->cg_nthreads));
+ this_thr->th.th_current_task->td_icvs.thread_limit =
+ this_thr->th.th_cg_roots->cg_thread_limit;
+ }
+
/* Initialize dynamic dispatch */
{
volatile kmp_disp_t *dispatch = this_thr->th.th_dispatch;
@@ -4155,9 +4074,7 @@ static void __kmp_initialize_info(kmp_info_t *this_thr, kmp_team_t *team,
KMP_DEBUG_ASSERT(dispatch == &team->t.t_dispatch[tid]);
dispatch->th_disp_index = 0;
-#if OMP_45_ENABLED
dispatch->th_doacross_buf_idx = 0;
-#endif
if (!dispatch->th_disp_buffer) {
dispatch->th_disp_buffer =
(dispatch_private_info_t *)__kmp_allocate(disp_size);
@@ -4222,22 +4139,25 @@ kmp_info_t *__kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team,
/* first, try to get one from the thread pool */
if (__kmp_thread_pool) {
-
new_thr = CCAST(kmp_info_t *, __kmp_thread_pool);
__kmp_thread_pool = (volatile kmp_info_t *)new_thr->th.th_next_pool;
if (new_thr == __kmp_thread_pool_insert_pt) {
__kmp_thread_pool_insert_pt = NULL;
}
TCW_4(new_thr->th.th_in_pool, FALSE);
- // Don't touch th_active_in_pool or th_active.
- // The worker thread adjusts those flags as it sleeps/awakens.
- __kmp_thread_pool_nth--;
+ __kmp_suspend_initialize_thread(new_thr);
+ __kmp_lock_suspend_mx(new_thr);
+ if (new_thr->th.th_active_in_pool == TRUE) {
+ KMP_DEBUG_ASSERT(new_thr->th.th_active == TRUE);
+ KMP_ATOMIC_DEC(&__kmp_thread_pool_active_nth);
+ new_thr->th.th_active_in_pool = FALSE;
+ }
+ __kmp_unlock_suspend_mx(new_thr);
KA_TRACE(20, ("__kmp_allocate_thread: T#%d using thread T#%d\n",
__kmp_get_gtid(), new_thr->th.th_info.ds.ds_gtid));
KMP_ASSERT(!new_thr->th.th_team);
KMP_DEBUG_ASSERT(__kmp_nth < __kmp_threads_capacity);
- KMP_DEBUG_ASSERT(__kmp_thread_pool_nth >= 0);
/* setup the thread structure */
__kmp_initialize_info(new_thr, team, new_tid,
@@ -4245,7 +4165,6 @@ kmp_info_t *__kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team,
KMP_DEBUG_ASSERT(new_thr->th.th_serial_team);
TCW_4(__kmp_nth, __kmp_nth + 1);
- root->r.r_cg_nthreads++;
new_thr->th.th_task_state = 0;
new_thr->th.th_task_state_top = 0;
@@ -4334,10 +4253,8 @@ kmp_info_t *__kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team,
#if OMPT_SUPPORT
ompt_data_none, // root parallel id
#endif
-#if OMP_40_ENABLED
- proc_bind_default,
-#endif
- &r_icvs, 0 USE_NESTED_HOT_ARG(NULL));
+ proc_bind_default, &r_icvs,
+ 0 USE_NESTED_HOT_ARG(NULL));
}
KMP_ASSERT(serial_team);
serial_team->t.t_serialized = 0; // AC: the team created in reserve, not for
@@ -4381,17 +4298,15 @@ kmp_info_t *__kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team,
new_thr->th.th_blocking = false;
#endif
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
+#if KMP_AFFINITY_SUPPORTED
new_thr->th.th_current_place = KMP_PLACE_UNDEFINED;
new_thr->th.th_new_place = KMP_PLACE_UNDEFINED;
new_thr->th.th_first_place = KMP_PLACE_UNDEFINED;
new_thr->th.th_last_place = KMP_PLACE_UNDEFINED;
#endif
-#if OMP_50_ENABLED
new_thr->th.th_def_allocator = __kmp_def_allocator;
new_thr->th.th_prev_level = 0;
new_thr->th.th_prev_num_threads = 1;
-#endif
TCW_4(new_thr->th.th_in_pool, FALSE);
new_thr->th.th_active_in_pool = FALSE;
@@ -4401,8 +4316,6 @@ kmp_info_t *__kmp_allocate_thread(kmp_root_t *root, kmp_team_t *team,
__kmp_all_nth++;
__kmp_nth++;
- root->r.r_cg_nthreads++;
-
// if __kmp_adjust_gtid_mode is set, then we use method #1 (sp search) for low
// numbers of procs, and method #2 (keyed API call) for higher numbers.
if (__kmp_adjust_gtid_mode) {
@@ -4504,8 +4417,6 @@ static void __kmp_initialize_team(kmp_team_t *team, int new_nproc,
team->t.t_ordered.dt.t_value = 0;
team->t.t_master_active = FALSE;
- memset(&team->t.t_taskq, '\0', sizeof(kmp_taskq_t));
-
#ifdef KMP_DEBUG
team->t.t_copypriv_data = NULL; /* not necessary, but nice for debugging */
#endif
@@ -4540,7 +4451,7 @@ __kmp_set_thread_affinity_mask_full_tmp(kmp_affin_mask_t *old_mask) {
}
#endif
-#if OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED
+#if KMP_AFFINITY_SUPPORTED
// __kmp_partition_places() is the heart of the OpenMP 4.0 affinity mechanism.
// It calculats the worker + master thread's partition based upon the parent
@@ -4579,12 +4490,10 @@ static void __kmp_partition_places(kmp_team_t *team, int update_master_only) {
th->th.th_first_place = first_place;
th->th.th_last_place = last_place;
th->th.th_new_place = masters_place;
-#if OMP_50_ENABLED
if (__kmp_display_affinity && masters_place != th->th.th_current_place &&
team->t.t_display_affinity != 1) {
team->t.t_display_affinity = 1;
}
-#endif
KA_TRACE(100, ("__kmp_partition_places: master: T#%d(%d:%d) place %d "
"partition = [%d,%d]\n",
@@ -4618,12 +4527,10 @@ static void __kmp_partition_places(kmp_team_t *team, int update_master_only) {
th->th.th_first_place = first_place;
th->th.th_last_place = last_place;
th->th.th_new_place = place;
-#if OMP_50_ENABLED
if (__kmp_display_affinity && place != th->th.th_current_place &&
team->t.t_display_affinity != 1) {
team->t.t_display_affinity = 1;
}
-#endif
KA_TRACE(100, ("__kmp_partition_places: close: T#%d(%d:%d) place %d "
"partition = [%d,%d]\n",
@@ -4645,12 +4552,10 @@ static void __kmp_partition_places(kmp_team_t *team, int update_master_only) {
th->th.th_first_place = first_place;
th->th.th_last_place = last_place;
th->th.th_new_place = place;
-#if OMP_50_ENABLED
if (__kmp_display_affinity && place != th->th.th_current_place &&
team->t.t_display_affinity != 1) {
team->t.t_display_affinity = 1;
}
-#endif
s_count++;
if ((s_count == S) && rem && (gap_ct == gap)) {
@@ -4719,12 +4624,10 @@ static void __kmp_partition_places(kmp_team_t *team, int update_master_only) {
th->th.th_first_place = place;
th->th.th_new_place = place;
-#if OMP_50_ENABLED
if (__kmp_display_affinity && place != th->th.th_current_place &&
team->t.t_display_affinity != 1) {
team->t.t_display_affinity = 1;
}
-#endif
s_count = 1;
while (s_count < S) {
if (place == last_place) {
@@ -4816,12 +4719,10 @@ static void __kmp_partition_places(kmp_team_t *team, int update_master_only) {
th->th.th_first_place = first;
th->th.th_new_place = place;
th->th.th_last_place = last;
-#if OMP_50_ENABLED
if (__kmp_display_affinity && place != th->th.th_current_place &&
team->t.t_display_affinity != 1) {
team->t.t_display_affinity = 1;
}
-#endif
KA_TRACE(100,
("__kmp_partition_places: spread: T#%d(%d:%d) place %d "
"partition = [%d,%d], spacing = %.4f\n",
@@ -4850,12 +4751,10 @@ static void __kmp_partition_places(kmp_team_t *team, int update_master_only) {
th->th.th_first_place = place;
th->th.th_last_place = place;
th->th.th_new_place = place;
-#if OMP_50_ENABLED
if (__kmp_display_affinity && place != th->th.th_current_place &&
team->t.t_display_affinity != 1) {
team->t.t_display_affinity = 1;
}
-#endif
s_count++;
if ((s_count == S) && rem && (gap_ct == gap)) {
@@ -4901,7 +4800,7 @@ static void __kmp_partition_places(kmp_team_t *team, int update_master_only) {
KA_TRACE(20, ("__kmp_partition_places: exit T#%d\n", team->t.t_id));
}
-#endif /* OMP_40_ENABLED && KMP_AFFINITY_SUPPORTED */
+#endif // KMP_AFFINITY_SUPPORTED
/* allocate a new team data structure to use. take one off of the free pool if
available */
@@ -4910,9 +4809,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
#if OMPT_SUPPORT
ompt_data_t ompt_parallel_data,
#endif
-#if OMP_40_ENABLED
kmp_proc_bind_t new_proc_bind,
-#endif
kmp_internal_control_t *new_icvs,
int argc USE_NESTED_HOT_ARG(kmp_info_t *master)) {
KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(KMP_allocate_team);
@@ -4954,7 +4851,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
#endif
// Optimization to use a "hot" team
if (use_hot_team && new_nproc > 1) {
- KMP_DEBUG_ASSERT(new_nproc == max_nproc);
+ KMP_DEBUG_ASSERT(new_nproc <= max_nproc);
#if KMP_NESTED_HOT_TEAMS
team = hot_teams[level].hot_team;
#else
@@ -4993,7 +4890,6 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
team->t.t_threads[0], team));
__kmp_push_current_task_to_thread(team->t.t_threads[0], team, 0);
-#if OMP_40_ENABLED
#if KMP_AFFINITY_SUPPORTED
if ((team->t.t_size_changed == 0) &&
(team->t.t_proc_bind == new_proc_bind)) {
@@ -5012,7 +4908,6 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
#else
KMP_CHECK_UPDATE(team->t.t_proc_bind, new_proc_bind);
#endif /* KMP_AFFINITY_SUPPORTED */
-#endif /* OMP_40_ENABLED */
} else if (team->t.t_nproc > new_nproc) {
KA_TRACE(20,
("__kmp_allocate_team: decreasing hot team thread count to %d\n",
@@ -5060,10 +4955,11 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
__kmp_reinitialize_team(team, new_icvs,
root->r.r_uber_thread->th.th_ident);
- /* update the remaining threads */
+ // Update remaining threads
for (f = 0; f < new_nproc; ++f) {
team->t.t_threads[f]->th.th_team_nproc = new_nproc;
}
+
// restore the current task state of the master thread: should be the
// implicit task
KF_TRACE(10, ("__kmp_allocate_team: T#%d, this_thread=%p team=%p\n", 0,
@@ -5079,12 +4975,10 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
}
#endif
-#if OMP_40_ENABLED
KMP_CHECK_UPDATE(team->t.t_proc_bind, new_proc_bind);
#if KMP_AFFINITY_SUPPORTED
__kmp_partition_places(team);
#endif
-#endif
} else { // team->t.t_nproc < new_nproc
#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED
kmp_affin_mask_t *old_mask;
@@ -5191,6 +5085,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
for (f = 0; f < team->t.t_nproc; ++f)
__kmp_initialize_info(team->t.t_threads[f], team, f,
__kmp_gtid_from_tid(f, team));
+
if (level) { // set th_task_state for new threads in nested hot team
// __kmp_initialize_info() no longer zeroes th_task_state, so we should
// only need to set the th_task_state for the new threads. th_task_state
@@ -5215,15 +5110,12 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
}
#endif
-#if OMP_40_ENABLED
KMP_CHECK_UPDATE(team->t.t_proc_bind, new_proc_bind);
#if KMP_AFFINITY_SUPPORTED
__kmp_partition_places(team);
#endif
-#endif
} // Check changes in number of threads
-#if OMP_40_ENABLED
kmp_info_t *master = team->t.t_threads[0];
if (master->th.th_teams_microtask) {
for (f = 1; f < new_nproc; ++f) {
@@ -5234,7 +5126,6 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
thr->th.th_teams_size = master->th.th_teams_size;
}
}
-#endif /* OMP_40_ENABLED */
#if KMP_NESTED_HOT_TEAMS
if (level) {
// Sync barrier state for nested hot teams, not needed for outermost hot
@@ -5315,9 +5206,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
}
}
-#if OMP_40_ENABLED
team->t.t_proc_bind = new_proc_bind;
-#endif
KA_TRACE(20, ("__kmp_allocate_team: using team from pool %d.\n",
team->t.t_id));
@@ -5382,9 +5271,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, int max_nproc,
}
}
-#if OMP_40_ENABLED
team->t.t_proc_bind = new_proc_bind;
-#endif
#if OMPT_SUPPORT
__ompt_team_assign_id(team, ompt_parallel_data);
@@ -5479,8 +5366,8 @@ void __kmp_free_team(kmp_root_t *root,
for (tt_idx = 0; tt_idx < 2; ++tt_idx) {
kmp_task_team_t *task_team = team->t.t_task_team[tt_idx];
if (task_team != NULL) {
- for (f = 0; f < team->t.t_nproc;
- ++f) { // Have all threads unref task teams
+ for (f = 0; f < team->t.t_nproc; ++f) { // threads unref task teams
+ KMP_DEBUG_ASSERT(team->t.t_threads[f]);
team->t.t_threads[f]->th.th_task_team = NULL;
}
KA_TRACE(
@@ -5511,6 +5398,32 @@ void __kmp_free_team(kmp_root_t *root,
/* TODO limit size of team pool, call reap_team if pool too large */
team->t.t_next_pool = CCAST(kmp_team_t *, __kmp_team_pool);
__kmp_team_pool = (volatile kmp_team_t *)team;
+ } else { // Check if team was created for the masters in a teams construct
+ // See if first worker is a CG root
+ KMP_DEBUG_ASSERT(team->t.t_threads[1] &&
+ team->t.t_threads[1]->th.th_cg_roots);
+ if (team->t.t_threads[1]->th.th_cg_roots->cg_root == team->t.t_threads[1]) {
+ // Clean up the CG root nodes on workers so that this team can be re-used
+ for (f = 1; f < team->t.t_nproc; ++f) {
+ kmp_info_t *thr = team->t.t_threads[f];
+ KMP_DEBUG_ASSERT(thr && thr->th.th_cg_roots &&
+ thr->th.th_cg_roots->cg_root == thr);
+ // Pop current CG root off list
+ kmp_cg_root_t *tmp = thr->th.th_cg_roots;
+ thr->th.th_cg_roots = tmp->up;
+ KA_TRACE(100, ("__kmp_free_team: Thread %p popping node %p and moving"
+ " up to node %p. cg_nthreads was %d\n",
+ thr, tmp, thr->th.th_cg_roots, tmp->cg_nthreads));
+ int i = tmp->cg_nthreads--;
+ if (i == 1) {
+ __kmp_free(tmp); // free CG if we are the last thread in it
+ }
+ // Restore current task's thread_limit from CG root
+ if (thr->th.th_cg_roots)
+ thr->th.th_current_task->td_icvs.thread_limit =
+ thr->th.th_cg_roots->cg_thread_limit;
+ }
+ }
}
KMP_MB();
@@ -5566,7 +5479,6 @@ kmp_team_t *__kmp_reap_team(kmp_team_t *team) {
void __kmp_free_thread(kmp_info_t *this_th) {
int gtid;
kmp_info_t **scan;
- kmp_root_t *root = this_th->th.th_root;
KA_TRACE(20, ("__kmp_free_thread: T#%d putting T#%d back on free pool.\n",
__kmp_get_gtid(), this_th->th.th_info.ds.ds_gtid));
@@ -5591,6 +5503,29 @@ void __kmp_free_thread(kmp_info_t *this_th) {
TCW_PTR(this_th->th.th_root, NULL);
TCW_PTR(this_th->th.th_dispatch, NULL); /* NOT NEEDED */
+ while (this_th->th.th_cg_roots) {
+ this_th->th.th_cg_roots->cg_nthreads--;
+ KA_TRACE(100, ("__kmp_free_thread: Thread %p decrement cg_nthreads on node"
+ " %p of thread %p to %d\n",
+ this_th, this_th->th.th_cg_roots,
+ this_th->th.th_cg_roots->cg_root,
+ this_th->th.th_cg_roots->cg_nthreads));
+ kmp_cg_root_t *tmp = this_th->th.th_cg_roots;
+ if (tmp->cg_root == this_th) { // Thread is a cg_root
+ KMP_DEBUG_ASSERT(tmp->cg_nthreads == 0);
+ KA_TRACE(
+ 5, ("__kmp_free_thread: Thread %p freeing node %p\n", this_th, tmp));
+ this_th->th.th_cg_roots = tmp->up;
+ __kmp_free(tmp);
+ } else { // Worker thread
+ if (tmp->cg_nthreads == 0) { // last thread leaves contention group
+ __kmp_free(tmp);
+ }
+ this_th->th.th_cg_roots = NULL;
+ break;
+ }
+ }
+
/* If the implicit task assigned to this thread can be used by other threads
* -> multiple threads can share the data and try to free the task at
* __kmp_reap_thread at exit. This duplicate use of the task data can happen
@@ -5631,10 +5566,20 @@ void __kmp_free_thread(kmp_info_t *this_th) {
(this_th->th.th_info.ds.ds_gtid <
this_th->th.th_next_pool->th.th_info.ds.ds_gtid));
TCW_4(this_th->th.th_in_pool, TRUE);
- __kmp_thread_pool_nth++;
+ __kmp_suspend_initialize_thread(this_th);
+ __kmp_lock_suspend_mx(this_th);
+ if (this_th->th.th_active == TRUE) {
+ KMP_ATOMIC_INC(&__kmp_thread_pool_active_nth);
+ this_th->th.th_active_in_pool = TRUE;
+ }
+#if KMP_DEBUG
+ else {
+ KMP_DEBUG_ASSERT(this_th->th.th_active_in_pool == FALSE);
+ }
+#endif
+ __kmp_unlock_suspend_mx(this_th);
TCW_4(__kmp_nth, __kmp_nth - 1);
- root->r.r_cg_nthreads--;
#ifdef KMP_ADJUST_BLOCKTIME
/* Adjust blocktime back to user setting or default if necessary */
@@ -5851,7 +5796,6 @@ static void __kmp_reap_thread(kmp_info_t *thread, int is_root) {
gtid = thread->th.th_info.ds.ds_gtid;
if (!is_root) {
-
if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME) {
/* Assume the threads are at the fork barrier here */
KA_TRACE(
@@ -5882,10 +5826,6 @@ static void __kmp_reap_thread(kmp_info_t *thread, int is_root) {
KMP_ATOMIC_DEC(&__kmp_thread_pool_active_nth);
KMP_DEBUG_ASSERT(__kmp_thread_pool_active_nth >= 0);
}
-
- // Decrement # of [worker] threads in the pool.
- KMP_DEBUG_ASSERT(__kmp_thread_pool_nth > 0);
- --__kmp_thread_pool_nth;
}
__kmp_free_implicit_task(thread);
@@ -6264,16 +6204,13 @@ void __kmp_internal_end_thread(int gtid_req) {
}
}
#if KMP_DYNAMIC_LIB
- // AC: lets not shutdown the Linux* OS dynamic library at the exit of uber
- // thread, because we will better shutdown later in the library destructor.
- // The reason of this change is performance problem when non-openmp thread in
- // a loop forks and joins many openmp threads. We can save a lot of time
- // keeping worker threads alive until the program shutdown.
- // OM: Removed Linux* OS restriction to fix the crash on OS X* (DPD200239966)
- // and Windows(DPD200287443) that occurs when using critical sections from
- // foreign threads.
- KA_TRACE(10, ("__kmp_internal_end_thread: exiting T#%d\n", gtid_req));
- return;
+ if (__kmp_pause_status != kmp_hard_paused)
+ // AC: lets not shutdown the dynamic library at the exit of uber thread,
+ // because we will better shutdown later in the library destructor.
+ {
+ KA_TRACE(10, ("__kmp_internal_end_thread: exiting T#%d\n", gtid_req));
+ return;
+ }
#endif
/* synchronize the termination process */
__kmp_acquire_bootstrap_lock(&__kmp_initz_lock);
@@ -6409,6 +6346,7 @@ void __kmp_register_library_startup(void) {
// library. Assume the other library is alive.
// WARN( ... ); // TODO: Issue a warning.
file_name = "unknown library";
+ KMP_FALLTHROUGH();
// Attention! Falling to the next case. That's intentional.
case 1: { // Neighbor is alive.
// Check it is allowed.
@@ -6747,11 +6685,9 @@ static void __kmp_do_serial_initialize(void) {
__kmp_env_print();
}
-#if OMP_40_ENABLED
if (__kmp_display_env || __kmp_display_env_verbose) {
__kmp_env_print_2();
}
-#endif // OMP_40_ENABLED
#if OMPT_SUPPORT
ompt_post_init();
@@ -6919,6 +6855,7 @@ void __kmp_parallel_initialize(void) {
if (!__kmp_init_middle) {
__kmp_do_middle_initialize();
}
+ __kmp_resume_if_hard_paused();
/* begin initialization */
KA_TRACE(10, ("__kmp_parallel_initialize: enter\n"));
@@ -6984,10 +6921,7 @@ void __kmp_run_before_invoked_task(int gtid, int tid, kmp_info_t *this_thr,
// this_thr->th.th_info.ds.ds_tid ] );
dispatch->th_disp_index = 0; /* reset the dispatch buffer counter */
-#if OMP_45_ENABLED
- dispatch->th_doacross_buf_idx =
- 0; /* reset the doacross dispatch buffer counter */
-#endif
+ dispatch->th_doacross_buf_idx = 0; // reset doacross dispatch buffer counter
if (__kmp_env_consistency_check)
__kmp_push_parallel(gtid, team->t.t_ident);
@@ -7046,21 +6980,33 @@ int __kmp_invoke_task_func(int gtid) {
}
#endif
- {
- KMP_TIME_PARTITIONED_BLOCK(OMP_parallel);
- KMP_SET_THREAD_STATE_BLOCK(IMPLICIT_TASK);
- rc =
- __kmp_invoke_microtask((microtask_t)TCR_SYNC_PTR(team->t.t_pkfn), gtid,
- tid, (int)team->t.t_argc, (void **)team->t.t_argv
+#if KMP_STATS_ENABLED
+ stats_state_e previous_state = KMP_GET_THREAD_STATE();
+ if (previous_state == stats_state_e::TEAMS_REGION) {
+ KMP_PUSH_PARTITIONED_TIMER(OMP_teams);
+ } else {
+ KMP_PUSH_PARTITIONED_TIMER(OMP_parallel);
+ }
+ KMP_SET_THREAD_STATE(IMPLICIT_TASK);
+#endif
+
+ rc = __kmp_invoke_microtask((microtask_t)TCR_SYNC_PTR(team->t.t_pkfn), gtid,
+ tid, (int)team->t.t_argc, (void **)team->t.t_argv
#if OMPT_SUPPORT
- ,
- exit_runtime_p
+ ,
+ exit_runtime_p
#endif
- );
+ );
#if OMPT_SUPPORT
- *exit_runtime_p = NULL;
+ *exit_runtime_p = NULL;
#endif
+
+#if KMP_STATS_ENABLED
+ if (previous_state == stats_state_e::TEAMS_REGION) {
+ KMP_SET_THREAD_STATE(previous_state);
}
+ KMP_POP_PARTITIONED_TIMER();
+#endif
#if USE_ITT_BUILD
if (__itt_stack_caller_create_ptr) {
@@ -7074,7 +7020,6 @@ int __kmp_invoke_task_func(int gtid) {
return rc;
}
-#if OMP_40_ENABLED
void __kmp_teams_master(int gtid) {
// This routine is called by all master threads in teams construct
kmp_info_t *thr = __kmp_threads[gtid];
@@ -7085,6 +7030,19 @@ void __kmp_teams_master(int gtid) {
KMP_DEBUG_ASSERT(thr->th.th_set_nproc);
KA_TRACE(20, ("__kmp_teams_master: T#%d, Tid %d, microtask %p\n", gtid,
__kmp_tid_from_gtid(gtid), thr->th.th_teams_microtask));
+
+ // This thread is a new CG root. Set up the proper variables.
+ kmp_cg_root_t *tmp = (kmp_cg_root_t *)__kmp_allocate(sizeof(kmp_cg_root_t));
+ tmp->cg_root = thr; // Make thr the CG root
+ // Init to thread limit that was stored when league masters were forked
+ tmp->cg_thread_limit = thr->th.th_current_task->td_icvs.thread_limit;
+ tmp->cg_nthreads = 1; // Init counter to one active thread, this one
+ KA_TRACE(100, ("__kmp_teams_master: Thread %p created node %p and init"
+ " cg_nthreads to 1\n",
+ thr, tmp));
+ tmp->up = thr->th.th_cg_roots;
+ thr->th.th_cg_roots = tmp;
+
// Launch league of teams now, but not let workers execute
// (they hang on fork barrier until next parallel)
#if INCLUDE_SSC_MARKS
@@ -7096,7 +7054,9 @@ void __kmp_teams_master(int gtid) {
#if INCLUDE_SSC_MARKS
SSC_MARK_JOINING();
#endif
-
+ // If the team size was reduced from the limit, set it to the new size
+ if (thr->th.th_team_nproc < thr->th.th_teams_size.nth)
+ thr->th.th_teams_size.nth = thr->th.th_team_nproc;
// AC: last parameter "1" eliminates join barrier which won't work because
// worker threads are in a fork barrier waiting for more parallel regions
__kmp_join_call(loc, gtid
@@ -7121,7 +7081,6 @@ int __kmp_invoke_teams_master(int gtid) {
__kmp_run_after_invoked_task(gtid, 0, this_thr, team);
return 1;
}
-#endif /* OMP_40_ENABLED */
/* this sets the requested number of threads for the next parallel region
encountered by this team. since this should be enclosed in the forkjoin
@@ -7135,8 +7094,6 @@ void __kmp_push_num_threads(ident_t *id, int gtid, int num_threads) {
thr->th.th_set_nproc = num_threads;
}
-#if OMP_40_ENABLED
-
/* this sets the requested number of teams for the teams region and/or
the number of threads for the next parallel region encountered */
void __kmp_push_num_teams(ident_t *id, int gtid, int num_teams,
@@ -7170,10 +7127,14 @@ void __kmp_push_num_teams(ident_t *id, int gtid, int num_teams,
num_threads = __kmp_teams_max_nth / num_teams;
}
} else {
+ // This thread will be the master of the league masters
+ // Store new thread limit; old limit is saved in th_cg_roots list
+ thr->th.th_current_task->td_icvs.thread_limit = num_threads;
+
if (num_teams * num_threads > __kmp_teams_max_nth) {
int new_threads = __kmp_teams_max_nth / num_teams;
if (!__kmp_reserve_warn) { // user asked for too many threads
- __kmp_reserve_warn = 1; // that conflicts with KMP_TEAMS_THREAD_LIMIT
+ __kmp_reserve_warn = 1; // conflicts with KMP_TEAMS_THREAD_LIMIT
__kmp_msg(kmp_ms_warning,
KMP_MSG(CantFormThrTeam, num_threads, new_threads),
KMP_HNT(Unset_ALL_THREADS), __kmp_msg_null);
@@ -7190,8 +7151,6 @@ void __kmp_push_proc_bind(ident_t *id, int gtid, kmp_proc_bind_t proc_bind) {
thr->th.th_set_proc_bind = proc_bind;
}
-#endif /* OMP_40_ENABLED */
-
/* Launch the worker threads into the microtask. */
void __kmp_internal_fork(ident_t *id, int gtid, kmp_team_t *team) {
@@ -7216,15 +7175,11 @@ void __kmp_internal_fork(ident_t *id, int gtid, kmp_team_t *team) {
int i;
for (i = 0; i < __kmp_dispatch_num_buffers; ++i) {
team->t.t_disp_buffer[i].buffer_index = i;
-#if OMP_45_ENABLED
team->t.t_disp_buffer[i].doacross_buf_idx = i;
-#endif
}
} else {
team->t.t_disp_buffer[0].buffer_index = 0;
-#if OMP_45_ENABLED
team->t.t_disp_buffer[0].doacross_buf_idx = 0;
-#endif
}
KMP_MB(); /* Flush all pending memory write invalidates. */
@@ -7282,11 +7237,13 @@ void __kmp_internal_join(ident_t *id, int gtid, kmp_team_t *team) {
if (ompt_enabled.ompt_callback_sync_region_wait) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
- ompt_sync_region_barrier, ompt_scope_end, NULL, task_data, codeptr);
+ ompt_sync_region_barrier_implicit, ompt_scope_end, NULL, task_data,
+ codeptr);
}
if (ompt_enabled.ompt_callback_sync_region) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
- ompt_sync_region_barrier, ompt_scope_end, NULL, task_data, codeptr);
+ ompt_sync_region_barrier_implicit, ompt_scope_end, NULL, task_data,
+ codeptr);
}
#endif
if (!KMP_MASTER_TID(ds_tid) && ompt_enabled.ompt_callback_implicit_task) {
@@ -7476,12 +7433,10 @@ void __kmp_cleanup(void) {
__kmp_nested_proc_bind.bind_types = NULL;
__kmp_nested_proc_bind.size = 0;
__kmp_nested_proc_bind.used = 0;
-#if OMP_50_ENABLED
if (__kmp_affinity_format) {
KMP_INTERNAL_FREE(__kmp_affinity_format);
__kmp_affinity_format = NULL;
}
-#endif
__kmp_i18n_catclose();
@@ -7625,13 +7580,14 @@ void __kmp_aux_set_library(enum library_type arg) {
switch (__kmp_library) {
case library_serial: {
KMP_INFORM(LibraryIsSerial);
- (void)__kmp_change_library(TRUE);
} break;
case library_turnaround:
- (void)__kmp_change_library(TRUE);
+ if (__kmp_use_yield == 1 && !__kmp_use_yield_exp_set)
+ __kmp_use_yield = 2; // only yield when oversubscribed
break;
case library_throughput:
- (void)__kmp_change_library(FALSE);
+ if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME)
+ __kmp_dflt_blocktime = 200;
break;
default:
KMP_FATAL(UnknownLibraryType, arg);
@@ -7696,7 +7652,6 @@ int __kmp_aux_get_num_teams() {
/* ------------------------------------------------------------------------ */
-#if OMP_50_ENABLED
/*
* Affinity Format Parser
*
@@ -7969,7 +7924,6 @@ void __kmp_aux_display_affinity(int gtid, const char *format) {
__kmp_fprintf(kmp_out, "%s" KMP_END_OF_LINE, buf.str);
__kmp_str_buf_free(&buf);
}
-#endif // OMP_50_ENABLED
/* ------------------------------------------------------------------------ */
@@ -8023,11 +7977,7 @@ void __kmp_aux_set_defaults(char const *str, int len) {
}
__kmp_env_initialize(str);
- if (__kmp_settings
-#if OMP_40_ENABLED
- || __kmp_display_env || __kmp_display_env_verbose
-#endif // OMP_40_ENABLED
- ) {
+ if (__kmp_settings || __kmp_display_env || __kmp_display_env_verbose) {
__kmp_env_print();
}
} // __kmp_aux_set_defaults
@@ -8104,7 +8054,7 @@ __kmp_determine_reduction_method(
#elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS
-#if KMP_OS_LINUX || KMP_OS_WINDOWS || KMP_OS_HURD
+#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_HURD
// basic tuning
@@ -8190,3 +8140,78 @@ __kmp_determine_reduction_method(
kmp_int32 __kmp_get_reduce_method(void) {
return ((__kmp_entry_thread()->th.th_local.packed_reduction_method) >> 8);
}
+
+// Soft pause sets up threads to ignore blocktime and just go to sleep.
+// Spin-wait code checks __kmp_pause_status and reacts accordingly.
+void __kmp_soft_pause() { __kmp_pause_status = kmp_soft_paused; }
+
+// Hard pause shuts down the runtime completely. Resume happens naturally when
+// OpenMP is used subsequently.
+void __kmp_hard_pause() {
+ __kmp_pause_status = kmp_hard_paused;
+ __kmp_internal_end_thread(-1);
+}
+
+// Soft resume sets __kmp_pause_status, and wakes up all threads.
+void __kmp_resume_if_soft_paused() {
+ if (__kmp_pause_status == kmp_soft_paused) {
+ __kmp_pause_status = kmp_not_paused;
+
+ for (int gtid = 1; gtid < __kmp_threads_capacity; ++gtid) {
+ kmp_info_t *thread = __kmp_threads[gtid];
+ if (thread) { // Wake it if sleeping
+ kmp_flag_64 fl(&thread->th.th_bar[bs_forkjoin_barrier].bb.b_go, thread);
+ if (fl.is_sleeping())
+ fl.resume(gtid);
+ else if (__kmp_try_suspend_mx(thread)) { // got suspend lock
+ __kmp_unlock_suspend_mx(thread); // unlock it; it won't sleep
+ } else { // thread holds the lock and may sleep soon
+ do { // until either the thread sleeps, or we can get the lock
+ if (fl.is_sleeping()) {
+ fl.resume(gtid);
+ break;
+ } else if (__kmp_try_suspend_mx(thread)) {
+ __kmp_unlock_suspend_mx(thread);
+ break;
+ }
+ } while (1);
+ }
+ }
+ }
+ }
+}
+
+// This function is called via __kmpc_pause_resource. Returns 0 if successful.
+// TODO: add warning messages
+int __kmp_pause_resource(kmp_pause_status_t level) {
+ if (level == kmp_not_paused) { // requesting resume
+ if (__kmp_pause_status == kmp_not_paused) {
+ // error message about runtime not being paused, so can't resume
+ return 1;
+ } else {
+ KMP_DEBUG_ASSERT(__kmp_pause_status == kmp_soft_paused ||
+ __kmp_pause_status == kmp_hard_paused);
+ __kmp_pause_status = kmp_not_paused;
+ return 0;
+ }
+ } else if (level == kmp_soft_paused) { // requesting soft pause
+ if (__kmp_pause_status != kmp_not_paused) {
+ // error message about already being paused
+ return 1;
+ } else {
+ __kmp_soft_pause();
+ return 0;
+ }
+ } else if (level == kmp_hard_paused) { // requesting hard pause
+ if (__kmp_pause_status != kmp_not_paused) {
+ // error message about already being paused
+ return 1;
+ } else {
+ __kmp_hard_pause();
+ return 0;
+ }
+ } else {
+ // error message about invalid level
+ return 1;
+ }
+}
diff --git a/runtime/src/kmp_safe_c_api.h b/runtime/src/kmp_safe_c_api.h
index d894fe3e026e..f839f734aa98 100644
--- a/runtime/src/kmp_safe_c_api.h
+++ b/runtime/src/kmp_safe_c_api.h
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_sched.cpp b/runtime/src/kmp_sched.cpp
index fc8000e65fdd..17c149806c89 100644
--- a/runtime/src/kmp_sched.cpp
+++ b/runtime/src/kmp_sched.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -39,6 +38,29 @@ char const *traits_t<long>::spec = "ld";
//-------------------------------------------------------------------------
#endif
+#if KMP_STATS_ENABLED
+#define KMP_STATS_LOOP_END(stat) \
+ { \
+ kmp_int64 t; \
+ kmp_int64 u = (kmp_int64)(*pupper); \
+ kmp_int64 l = (kmp_int64)(*plower); \
+ kmp_int64 i = (kmp_int64)incr; \
+ if (i == 1) { \
+ t = u - l + 1; \
+ } else if (i == -1) { \
+ t = l - u + 1; \
+ } else if (i > 0) { \
+ t = (u - l) / i + 1; \
+ } else { \
+ t = (l - u) / (-i) + 1; \
+ } \
+ KMP_COUNT_VALUE(stat, t); \
+ KMP_POP_PARTITIONED_TIMER(); \
+ }
+#else
+#define KMP_STATS_LOOP_END(stat) /* Nothing */
+#endif
+
template <typename T>
static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
kmp_int32 schedtype, kmp_int32 *plastiter,
@@ -152,10 +174,10 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
&(task_info->task_data), 0, codeptr);
}
#endif
+ KMP_STATS_LOOP_END(OMP_loop_static_iterations);
return;
}
-#if OMP_40_ENABLED
// Although there are schedule enumerations above kmp_ord_upper which are not
// schedules for "distribute", the only ones which are useful are dynamic, so
// cannot be seen here, since this codepath is only executed for static
@@ -166,9 +188,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
kmp_distribute_static; // AC: convert to usual schedule type
tid = th->th.th_team->t.t_master_tid;
team = th->th.th_team->t.t_parent;
- } else
-#endif
- {
+ } else {
tid = __kmp_tid_from_gtid(global_tid);
team = th->th.th_team;
}
@@ -203,6 +223,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
&(task_info->task_data), *pstride, codeptr);
}
#endif
+ KMP_STATS_LOOP_END(OMP_loop_static_iterations);
return;
}
nth = team->t.t_nproc;
@@ -232,6 +253,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
&(task_info->task_data), *pstride, codeptr);
}
#endif
+ KMP_STATS_LOOP_END(OMP_loop_static_iterations);
return;
}
@@ -247,6 +269,12 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
trip_count = (UT)(*plower - *pupper) / (-incr) + 1;
}
+#if KMP_STATS_ENABLED
+ if (KMP_MASTER_GTID(gtid)) {
+ KMP_COUNT_VALUE(OMP_loop_static_total_iterations, trip_count);
+ }
+#endif
+
if (__kmp_env_consistency_check) {
/* tripcount overflow? */
if (trip_count == 0 && *pupper != *plower) {
@@ -321,7 +349,6 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
*plastiter = (tid == ((trip_count - 1) / (UT)chunk) % nth);
break;
}
-#if OMP_45_ENABLED
case kmp_sch_static_balanced_chunked: {
T old_upper = *pupper;
// round up to make sure the chunk is enough to cover all iterations
@@ -343,7 +370,6 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
*plastiter = (tid == ((trip_count - 1) / (UT)chunk));
break;
}
-#endif
default:
KMP_ASSERT2(0, "__kmpc_for_static_init: unknown scheduling type");
break;
@@ -352,10 +378,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
#if USE_ITT_BUILD
// Report loop metadata
if (KMP_MASTER_TID(tid) && __itt_metadata_add_ptr &&
- __kmp_forkjoin_frames_mode == 3 &&
-#if OMP_40_ENABLED
- th->th.th_teams_microtask == NULL &&
-#endif
+ __kmp_forkjoin_frames_mode == 3 && th->th.th_teams_microtask == NULL &&
team->t.t_active_level == 1) {
kmp_uint64 cur_chunk = chunk;
// Calculate chunk in case it was not specified; it is specified for
@@ -389,26 +412,7 @@ static void __kmp_for_static_init(ident_t *loc, kmp_int32 global_tid,
}
#endif
-#if KMP_STATS_ENABLED
- {
- kmp_int64 t;
- kmp_int64 u = (kmp_int64)(*pupper);
- kmp_int64 l = (kmp_int64)(*plower);
- kmp_int64 i = (kmp_int64)incr;
- /* compute trip count */
- if (i == 1) {
- t = u - l + 1;
- } else if (i == -1) {
- t = l - u + 1;
- } else if (i > 0) {
- t = (u - l) / i + 1;
- } else {
- t = (l - u) / (-i) + 1;
- }
- KMP_COUNT_VALUE(OMP_loop_static_iterations, t);
- KMP_POP_PARTITIONED_TIMER();
- }
-#endif
+ KMP_STATS_LOOP_END(OMP_loop_static_iterations);
return;
}
@@ -420,6 +424,8 @@ static void __kmp_dist_for_static_init(ident_t *loc, kmp_int32 gtid,
typename traits_t<T>::signed_t incr,
typename traits_t<T>::signed_t chunk) {
KMP_COUNT_BLOCK(OMP_DISTRIBUTE);
+ KMP_PUSH_PARTITIONED_TIMER(OMP_distribute);
+ KMP_PUSH_PARTITIONED_TIMER(OMP_distribute_scheduling);
typedef typename traits_t<T>::unsigned_t UT;
typedef typename traits_t<T>::signed_t ST;
kmp_uint32 tid;
@@ -470,10 +476,8 @@ static void __kmp_dist_for_static_init(ident_t *loc, kmp_int32 gtid,
th = __kmp_threads[gtid];
nth = th->th.th_team_nproc;
team = th->th.th_team;
-#if OMP_40_ENABLED
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
nteams = th->th.th_teams_size.nteams;
-#endif
team_id = team->t.t_master_tid;
KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
@@ -649,6 +653,7 @@ end:;
}
#endif
KE_TRACE(10, ("__kmpc_dist_for_static_init: T#%d return\n", gtid));
+ KMP_STATS_LOOP_END(OMP_distribute_iterations);
return;
}
@@ -712,10 +717,8 @@ static void __kmp_team_static_init(ident_t *loc, kmp_int32 gtid,
}
th = __kmp_threads[gtid];
team = th->th.th_team;
-#if OMP_40_ENABLED
KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct
nteams = th->th.th_teams_size.nteams;
-#endif
team_id = team->t.t_master_tid;
KMP_DEBUG_ASSERT(nteams == (kmp_uint32)team->t.t_parent->t.t_nproc);
diff --git a/runtime/src/kmp_settings.cpp b/runtime/src/kmp_settings.cpp
index 6d049e4b9232..692ca26d0e42 100644
--- a/runtime/src/kmp_settings.cpp
+++ b/runtime/src/kmp_settings.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -290,6 +289,20 @@ static void __kmp_stg_parse_bool(char const *name, char const *value,
}
} // __kmp_stg_parse_bool
+// placed here in order to use __kmp_round4k static function
+void __kmp_check_stksize(size_t *val) {
+ // if system stack size is too big then limit the size for worker threads
+ if (*val > KMP_DEFAULT_STKSIZE * 16) // just a heuristics...
+ *val = KMP_DEFAULT_STKSIZE * 16;
+ if (*val < KMP_MIN_STKSIZE)
+ *val = KMP_MIN_STKSIZE;
+ if (*val > KMP_MAX_STKSIZE)
+ *val = KMP_MAX_STKSIZE; // dead code currently, but may work in future
+#if KMP_OS_DARWIN
+ *val = __kmp_round4k(*val);
+#endif // KMP_OS_DARWIN
+}
+
static void __kmp_stg_parse_size(char const *name, char const *value,
size_t size_min, size_t size_max,
int *is_specified, size_t *out,
@@ -630,6 +643,19 @@ static void __kmp_stg_print_teams_thread_limit(kmp_str_buf_t *buffer,
} // __kmp_stg_print_teams_thread_limit
// -----------------------------------------------------------------------------
+// KMP_USE_YIELD
+static void __kmp_stg_parse_use_yield(char const *name, char const *value,
+ void *data) {
+ __kmp_stg_parse_int(name, value, 0, 2, &__kmp_use_yield);
+ __kmp_use_yield_exp_set = 1;
+} // __kmp_stg_parse_use_yield
+
+static void __kmp_stg_print_use_yield(kmp_str_buf_t *buffer, char const *name,
+ void *data) {
+ __kmp_stg_print_int(buffer, name, __kmp_use_yield);
+} // __kmp_stg_print_use_yield
+
+// -----------------------------------------------------------------------------
// KMP_BLOCKTIME
static void __kmp_stg_parse_blocktime(char const *name, char const *value,
@@ -746,18 +772,24 @@ static void __kmp_stg_parse_wait_policy(char const *name, char const *value,
__kmp_library = library_serial;
} else if (__kmp_str_match("throughput", 2, value)) { /* TH */
__kmp_library = library_throughput;
+ if (blocktime_str == NULL) {
+ // KMP_BLOCKTIME not specified, so set default to 0.
+ __kmp_dflt_blocktime = 0;
+ }
} else if (__kmp_str_match("turnaround", 2, value)) { /* TU */
__kmp_library = library_turnaround;
} else if (__kmp_str_match("dedicated", 1, value)) { /* D */
__kmp_library = library_turnaround;
} else if (__kmp_str_match("multiuser", 1, value)) { /* M */
__kmp_library = library_throughput;
+ if (blocktime_str == NULL) {
+ // KMP_BLOCKTIME not specified, so set default to 0.
+ __kmp_dflt_blocktime = 0;
+ }
} else {
KMP_WARNING(StgInvalidValue, name, value);
}
}
- __kmp_aux_set_library(__kmp_library);
-
} // __kmp_stg_parse_wait_policy
static void __kmp_stg_print_wait_policy(kmp_str_buf_t *buffer, char const *name,
@@ -957,12 +989,27 @@ static void __kmp_stg_print_warnings(kmp_str_buf_t *buffer, char const *name,
static void __kmp_stg_parse_nested(char const *name, char const *value,
void *data) {
- __kmp_stg_parse_bool(name, value, &__kmp_dflt_nested);
+ int nested;
+ KMP_INFORM(EnvVarDeprecated, name, "OMP_MAX_ACTIVE_LEVELS");
+ __kmp_stg_parse_bool(name, value, &nested);
+ if (nested) {
+ if (!__kmp_dflt_max_active_levels_set)
+ __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
+ } else { // nesting explicitly turned off
+ __kmp_dflt_max_active_levels = 1;
+ __kmp_dflt_max_active_levels_set = true;
+ }
} // __kmp_stg_parse_nested
static void __kmp_stg_print_nested(kmp_str_buf_t *buffer, char const *name,
void *data) {
- __kmp_stg_print_bool(buffer, name, __kmp_dflt_nested);
+ if (__kmp_env_format) {
+ KMP_STR_BUF_PRINT_NAME;
+ } else {
+ __kmp_str_buf_print(buffer, " %s", name);
+ }
+ __kmp_str_buf_print(buffer, ": deprecated; max-active-levels-var=%d\n",
+ __kmp_dflt_max_active_levels);
} // __kmp_stg_print_nested
static void __kmp_parse_nested_num_threads(const char *var, const char *env,
@@ -1008,6 +1055,8 @@ static void __kmp_parse_nested_num_threads(const char *var, const char *env,
}
}
}
+ if (!__kmp_dflt_max_active_levels_set && total > 1)
+ __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
KMP_DEBUG_ASSERT(total > 0);
if (total <= 0) {
KMP_WARNING(NthSyntaxError, var, env);
@@ -1164,8 +1213,22 @@ static void __kmp_stg_print_task_stealing(kmp_str_buf_t *buffer,
static void __kmp_stg_parse_max_active_levels(char const *name,
char const *value, void *data) {
- __kmp_stg_parse_int(name, value, 0, KMP_MAX_ACTIVE_LEVELS_LIMIT,
- &__kmp_dflt_max_active_levels);
+ kmp_uint64 tmp_dflt = 0;
+ char const *msg = NULL;
+ if (!__kmp_dflt_max_active_levels_set) {
+ // Don't overwrite __kmp_dflt_max_active_levels if we get an invalid setting
+ __kmp_str_to_uint(value, &tmp_dflt, &msg);
+ if (msg != NULL) { // invalid setting; print warning and ignore
+ KMP_WARNING(ParseSizeIntWarn, name, value, msg);
+ } else if (tmp_dflt > KMP_MAX_ACTIVE_LEVELS_LIMIT) {
+ // invalid setting; print warning and ignore
+ msg = KMP_I18N_STR(ValueTooLarge);
+ KMP_WARNING(ParseSizeIntWarn, name, value, msg);
+ } else { // valid setting
+ __kmp_dflt_max_active_levels = tmp_dflt;
+ __kmp_dflt_max_active_levels_set = true;
+ }
+ }
} // __kmp_stg_parse_max_active_levels
static void __kmp_stg_print_max_active_levels(kmp_str_buf_t *buffer,
@@ -1173,7 +1236,6 @@ static void __kmp_stg_print_max_active_levels(kmp_str_buf_t *buffer,
__kmp_stg_print_int(buffer, name, __kmp_dflt_max_active_levels);
} // __kmp_stg_print_max_active_levels
-#if OMP_40_ENABLED
// -----------------------------------------------------------------------------
// OpenMP 4.0: OMP_DEFAULT_DEVICE
static void __kmp_stg_parse_default_device(char const *name, char const *value,
@@ -1186,9 +1248,7 @@ static void __kmp_stg_print_default_device(kmp_str_buf_t *buffer,
char const *name, void *data) {
__kmp_stg_print_int(buffer, name, __kmp_default_device);
} // __kmp_stg_print_default_device
-#endif
-#if OMP_50_ENABLED
// -----------------------------------------------------------------------------
// OpenMP 5.0: OMP_TARGET_OFFLOAD
static void __kmp_stg_parse_target_offload(char const *name, char const *value,
@@ -1201,11 +1261,11 @@ static void __kmp_stg_parse_target_offload(char const *name, char const *value,
if (*next == '\0')
return;
scan = next;
- if (__kmp_match_str("MANDATORY", scan, &next)) {
+ if (!__kmp_strcasecmp_with_sentinel("mandatory", scan, 0)) {
__kmp_target_offload = tgt_mandatory;
- } else if (__kmp_match_str("DISABLED", scan, &next)) {
+ } else if (!__kmp_strcasecmp_with_sentinel("disabled", scan, 0)) {
__kmp_target_offload = tgt_disabled;
- } else if (__kmp_match_str("DEFAULT", scan, &next)) {
+ } else if (!__kmp_strcasecmp_with_sentinel("default", scan, 0)) {
__kmp_target_offload = tgt_default;
} else {
KMP_WARNING(SyntaxErrorUsing, name, "DEFAULT");
@@ -1222,13 +1282,15 @@ static void __kmp_stg_print_target_offload(kmp_str_buf_t *buffer,
value = "MANDATORY";
else if (__kmp_target_offload == tgt_disabled)
value = "DISABLED";
- if (value) {
- __kmp_str_buf_print(buffer, " %s=%s\n", name, value);
+ KMP_DEBUG_ASSERT(value);
+ if (__kmp_env_format) {
+ KMP_STR_BUF_PRINT_NAME;
+ } else {
+ __kmp_str_buf_print(buffer, " %s", name);
}
+ __kmp_str_buf_print(buffer, "=%s\n", value);
} // __kmp_stg_print_target_offload
-#endif
-#if OMP_45_ENABLED
// -----------------------------------------------------------------------------
// OpenMP 4.5: OMP_MAX_TASK_PRIORITY
static void __kmp_stg_parse_max_task_priority(char const *name,
@@ -1255,7 +1317,6 @@ static void __kmp_stg_print_taskloop_min_tasks(kmp_str_buf_t *buffer,
char const *name, void *data) {
__kmp_stg_print_int(buffer, name, __kmp_taskloop_min_tasks);
} // __kmp_stg_print_taskloop_min_tasks
-#endif // OMP_45_ENABLED
// -----------------------------------------------------------------------------
// KMP_DISP_NUM_BUFFERS
@@ -2026,61 +2087,43 @@ static void __kmp_parse_affinity_env(char const *name, char const *value,
++gran; \
}
-#if OMP_40_ENABLED
KMP_DEBUG_ASSERT((__kmp_nested_proc_bind.bind_types != NULL) &&
(__kmp_nested_proc_bind.used > 0));
-#endif
while (*buf != '\0') {
start = next = buf;
if (__kmp_match_str("none", buf, CCAST(const char **, &next))) {
set_type(affinity_none);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
-#endif
buf = next;
} else if (__kmp_match_str("scatter", buf, CCAST(const char **, &next))) {
set_type(affinity_scatter);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
buf = next;
} else if (__kmp_match_str("compact", buf, CCAST(const char **, &next))) {
set_type(affinity_compact);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
buf = next;
} else if (__kmp_match_str("logical", buf, CCAST(const char **, &next))) {
set_type(affinity_logical);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
buf = next;
} else if (__kmp_match_str("physical", buf, CCAST(const char **, &next))) {
set_type(affinity_physical);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
buf = next;
} else if (__kmp_match_str("explicit", buf, CCAST(const char **, &next))) {
set_type(affinity_explicit);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
buf = next;
} else if (__kmp_match_str("balanced", buf, CCAST(const char **, &next))) {
set_type(affinity_balanced);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
buf = next;
} else if (__kmp_match_str("disabled", buf, CCAST(const char **, &next))) {
set_type(affinity_disabled);
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
-#endif
buf = next;
} else if (__kmp_match_str("verbose", buf, CCAST(const char **, &next))) {
set_verbose(TRUE);
@@ -2239,9 +2282,7 @@ static void __kmp_parse_affinity_env(char const *name, char const *value,
if (!type) {
KMP_WARNING(AffProcListNoType, name);
*out_type = affinity_explicit;
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
} else if (*out_type != affinity_explicit) {
KMP_WARNING(AffProcListNotExplicit, name);
KMP_ASSERT(*out_proclist != NULL);
@@ -2460,9 +2501,7 @@ static void __kmp_stg_parse_gomp_cpu_affinity(char const *name,
__kmp_affinity_proclist = temp_proclist;
__kmp_affinity_type = affinity_explicit;
__kmp_affinity_gran = affinity_gran_fine;
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
} else {
KMP_WARNING(AffSyntaxError, name);
if (temp_proclist != NULL) {
@@ -2472,16 +2511,12 @@ static void __kmp_stg_parse_gomp_cpu_affinity(char const *name,
} else {
// Warning already emitted
__kmp_affinity_type = affinity_none;
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
-#endif
}
} // __kmp_stg_parse_gomp_cpu_affinity
#endif /* KMP_GOMP_COMPAT */
-#if OMP_40_ENABLED
-
/*-----------------------------------------------------------------------------
The OMP_PLACES proc id list parser. Here is the grammar:
@@ -2904,40 +2939,6 @@ static void __kmp_stg_print_places(kmp_str_buf_t *buffer, char const *name,
}
}
-#endif /* OMP_40_ENABLED */
-
-#if (!OMP_40_ENABLED)
-
-static void __kmp_stg_parse_proc_bind(char const *name, char const *value,
- void *data) {
- int enabled;
- kmp_setting_t **rivals = (kmp_setting_t **)data;
- int rc;
-
- rc = __kmp_stg_check_rivals(name, value, rivals);
- if (rc) {
- return;
- }
-
- // In OMP 3.1, OMP_PROC_BIND is strictly a boolean
- __kmp_stg_parse_bool(name, value, &enabled);
- if (enabled) {
- // OMP_PROC_BIND => granularity=fine,scatter on MIC
- // OMP_PROC_BIND => granularity=core,scatter elsewhere
- __kmp_affinity_type = affinity_scatter;
-#if KMP_MIC_SUPPORTED
- if (__kmp_mic_type != non_mic)
- __kmp_affinity_gran = affinity_gran_fine;
- else
-#endif
- __kmp_affinity_gran = affinity_gran_core;
- } else {
- __kmp_affinity_type = affinity_none;
- }
-} // __kmp_parse_proc_bind
-
-#endif /* if (! OMP_40_ENABLED) */
-
static void __kmp_stg_parse_topology_method(char const *name, char const *value,
void *data) {
if (__kmp_str_match("all", 1, value)) {
@@ -3064,8 +3065,6 @@ static void __kmp_stg_print_topology_method(kmp_str_buf_t *buffer,
#endif /* KMP_AFFINITY_SUPPORTED */
-#if OMP_40_ENABLED
-
// OMP_PROC_BIND / bind-var is functional on all 4.0 builds, including OS X*
// OMP_PLACES / place-partition-var is not.
static void __kmp_stg_parse_proc_bind(char const *name, char const *value,
@@ -3144,6 +3143,9 @@ static void __kmp_stg_parse_proc_bind(char const *name, char const *value,
}
__kmp_nested_proc_bind.used = nelem;
+ if (nelem > 1 && !__kmp_dflt_max_active_levels_set)
+ __kmp_dflt_max_active_levels = KMP_MAX_ACTIVE_LEVELS_LIMIT;
+
// Save values in the nested proc_bind array
int i = 0;
for (;;) {
@@ -3249,9 +3251,6 @@ static void __kmp_stg_print_proc_bind(kmp_str_buf_t *buffer, char const *name,
}
}
-#endif /* OMP_40_ENABLED */
-
-#if OMP_50_ENABLED
static void __kmp_stg_parse_display_affinity(char const *name,
char const *value, void *data) {
__kmp_stg_parse_bool(name, value, &__kmp_display_affinity);
@@ -3301,7 +3300,7 @@ static void __kmp_stg_parse_allocator(char const *name, char const *value,
KMP_ASSERT(num > 0);
switch (num) {
case 4:
- if (__kmp_hbw_mem_available) {
+ if (__kmp_memkind_available) {
__kmp_def_allocator = omp_high_bw_mem_alloc;
} else {
__kmp_msg(kmp_ms_warning,
@@ -3350,7 +3349,7 @@ static void __kmp_stg_parse_allocator(char const *name, char const *value,
}
next = buf;
if (__kmp_match_str("omp_high_bw_mem_alloc", buf, &next)) {
- if (__kmp_hbw_mem_available) {
+ if (__kmp_memkind_available) {
__kmp_def_allocator = omp_high_bw_mem_alloc;
} else {
__kmp_msg(kmp_ms_warning,
@@ -3414,8 +3413,6 @@ static void __kmp_stg_print_allocator(kmp_str_buf_t *buffer, char const *name,
}
}
-#endif /* OMP_50_ENABLED */
-
// -----------------------------------------------------------------------------
// OMP_DYNAMIC
@@ -3606,104 +3603,137 @@ static inline void __kmp_omp_schedule_restore() {
__kmp_sched = kmp_sch_default;
}
+// if parse_hier = true:
+// Parse [HW,][modifier:]kind[,chunk]
+// else:
+// Parse [modifier:]kind[,chunk]
static const char *__kmp_parse_single_omp_schedule(const char *name,
const char *value,
bool parse_hier = false) {
/* get the specified scheduling style */
const char *ptr = value;
- const char *comma = strchr(ptr, ',');
const char *delim;
int chunk = 0;
enum sched_type sched = kmp_sch_default;
if (*ptr == '\0')
return NULL;
+ delim = ptr;
+ while (*delim != ',' && *delim != ':' && *delim != '\0')
+ delim++;
#if KMP_USE_HIER_SCHED
kmp_hier_layer_e layer = kmp_hier_layer_e::LAYER_THREAD;
if (parse_hier) {
- if (!__kmp_strcasecmp_with_sentinel("L1", ptr, ',')) {
- layer = kmp_hier_layer_e::LAYER_L1;
- } else if (!__kmp_strcasecmp_with_sentinel("L2", ptr, ',')) {
- layer = kmp_hier_layer_e::LAYER_L2;
- } else if (!__kmp_strcasecmp_with_sentinel("L3", ptr, ',')) {
- layer = kmp_hier_layer_e::LAYER_L3;
- } else if (!__kmp_strcasecmp_with_sentinel("NUMA", ptr, ',')) {
- layer = kmp_hier_layer_e::LAYER_NUMA;
- }
- if (layer != kmp_hier_layer_e::LAYER_THREAD && !comma) {
+ if (*delim == ',') {
+ if (!__kmp_strcasecmp_with_sentinel("L1", ptr, ',')) {
+ layer = kmp_hier_layer_e::LAYER_L1;
+ } else if (!__kmp_strcasecmp_with_sentinel("L2", ptr, ',')) {
+ layer = kmp_hier_layer_e::LAYER_L2;
+ } else if (!__kmp_strcasecmp_with_sentinel("L3", ptr, ',')) {
+ layer = kmp_hier_layer_e::LAYER_L3;
+ } else if (!__kmp_strcasecmp_with_sentinel("NUMA", ptr, ',')) {
+ layer = kmp_hier_layer_e::LAYER_NUMA;
+ }
+ }
+ if (layer != kmp_hier_layer_e::LAYER_THREAD && *delim != ',') {
// If there is no comma after the layer, then this schedule is invalid
KMP_WARNING(StgInvalidValue, name, value);
__kmp_omp_schedule_restore();
return NULL;
} else if (layer != kmp_hier_layer_e::LAYER_THREAD) {
- ptr = ++comma;
- comma = strchr(ptr, ',');
+ ptr = ++delim;
+ while (*delim != ',' && *delim != ':' && *delim != '\0')
+ delim++;
}
}
- delim = ptr;
- while (*delim != ',' && *delim != ':' && *delim != '\0')
- delim++;
-#else // KMP_USE_HIER_SCHED
- delim = ptr;
- while (*delim != ',' && *delim != '\0')
- delim++;
#endif // KMP_USE_HIER_SCHED
- if (!__kmp_strcasecmp_with_sentinel("dynamic", ptr, *delim)) /* DYNAMIC */
+ // Read in schedule modifier if specified
+ enum sched_type sched_modifier = (enum sched_type)0;
+ if (*delim == ':') {
+ if (!__kmp_strcasecmp_with_sentinel("monotonic", ptr, *delim)) {
+ sched_modifier = sched_type::kmp_sch_modifier_monotonic;
+ ptr = ++delim;
+ while (*delim != ',' && *delim != ':' && *delim != '\0')
+ delim++;
+ } else if (!__kmp_strcasecmp_with_sentinel("nonmonotonic", ptr, *delim)) {
+ sched_modifier = sched_type::kmp_sch_modifier_nonmonotonic;
+ ptr = ++delim;
+ while (*delim != ',' && *delim != ':' && *delim != '\0')
+ delim++;
+ } else if (!parse_hier) {
+ // If there is no proper schedule modifier, then this schedule is invalid
+ KMP_WARNING(StgInvalidValue, name, value);
+ __kmp_omp_schedule_restore();
+ return NULL;
+ }
+ }
+ // Read in schedule kind (required)
+ if (!__kmp_strcasecmp_with_sentinel("dynamic", ptr, *delim))
sched = kmp_sch_dynamic_chunked;
- else if (!__kmp_strcasecmp_with_sentinel("guided", ptr, *delim)) /* GUIDED */
+ else if (!__kmp_strcasecmp_with_sentinel("guided", ptr, *delim))
sched = kmp_sch_guided_chunked;
- // AC: TODO: add AUTO schedule, and probably remove TRAPEZOIDAL (OMP 3.0 does
- // not allow it)
- else if (!__kmp_strcasecmp_with_sentinel("auto", ptr, *delim)) { /* AUTO */
+ // AC: TODO: probably remove TRAPEZOIDAL (OMP 3.0 does not allow it)
+ else if (!__kmp_strcasecmp_with_sentinel("auto", ptr, *delim))
sched = kmp_sch_auto;
- if (comma) {
- __kmp_msg(kmp_ms_warning, KMP_MSG(IgnoreChunk, name, comma),
- __kmp_msg_null);
- comma = NULL;
- }
- } else if (!__kmp_strcasecmp_with_sentinel("trapezoidal", ptr,
- *delim)) /* TRAPEZOIDAL */
+ else if (!__kmp_strcasecmp_with_sentinel("trapezoidal", ptr, *delim))
sched = kmp_sch_trapezoidal;
- else if (!__kmp_strcasecmp_with_sentinel("static", ptr, *delim)) /* STATIC */
+ else if (!__kmp_strcasecmp_with_sentinel("static", ptr, *delim))
sched = kmp_sch_static;
#if KMP_STATIC_STEAL_ENABLED
else if (!__kmp_strcasecmp_with_sentinel("static_steal", ptr, *delim))
sched = kmp_sch_static_steal;
#endif
else {
+ // If there is no proper schedule kind, then this schedule is invalid
KMP_WARNING(StgInvalidValue, name, value);
__kmp_omp_schedule_restore();
return NULL;
}
- if (ptr && comma && *comma == *delim) {
- ptr = comma + 1;
- SKIP_DIGITS(ptr);
- if (sched == kmp_sch_static)
- sched = kmp_sch_static_chunked;
- ++comma;
- chunk = __kmp_str_to_int(comma, *ptr);
- if (chunk < 1) {
- chunk = KMP_DEFAULT_CHUNK;
- __kmp_msg(kmp_ms_warning, KMP_MSG(InvalidChunk, name, comma),
- __kmp_msg_null);
- KMP_INFORM(Using_int_Value, name, __kmp_chunk);
- // AC: next block commented out until KMP_DEFAULT_CHUNK != KMP_MIN_CHUNK
- // (to improve code coverage :)
- // The default chunk size is 1 according to standard, thus making
- // KMP_MIN_CHUNK not 1 we would introduce mess:
- // wrong chunk becomes 1, but it will be impossible to explicitely set
- // 1, because it becomes KMP_MIN_CHUNK...
- // } else if ( chunk < KMP_MIN_CHUNK ) {
- // chunk = KMP_MIN_CHUNK;
- } else if (chunk > KMP_MAX_CHUNK) {
- chunk = KMP_MAX_CHUNK;
- __kmp_msg(kmp_ms_warning, KMP_MSG(LargeChunk, name, comma),
+ // Read in schedule chunk size if specified
+ if (*delim == ',') {
+ ptr = delim + 1;
+ SKIP_WS(ptr);
+ if (!isdigit(*ptr)) {
+ // If there is no chunk after comma, then this schedule is invalid
+ KMP_WARNING(StgInvalidValue, name, value);
+ __kmp_omp_schedule_restore();
+ return NULL;
+ }
+ SKIP_DIGITS(ptr);
+ // auto schedule should not specify chunk size
+ if (sched == kmp_sch_auto) {
+ __kmp_msg(kmp_ms_warning, KMP_MSG(IgnoreChunk, name, delim),
__kmp_msg_null);
- KMP_INFORM(Using_int_Value, name, chunk);
+ } else {
+ if (sched == kmp_sch_static)
+ sched = kmp_sch_static_chunked;
+ chunk = __kmp_str_to_int(delim + 1, *ptr);
+ if (chunk < 1) {
+ chunk = KMP_DEFAULT_CHUNK;
+ __kmp_msg(kmp_ms_warning, KMP_MSG(InvalidChunk, name, delim),
+ __kmp_msg_null);
+ KMP_INFORM(Using_int_Value, name, __kmp_chunk);
+ // AC: next block commented out until KMP_DEFAULT_CHUNK != KMP_MIN_CHUNK
+ // (to improve code coverage :)
+ // The default chunk size is 1 according to standard, thus making
+ // KMP_MIN_CHUNK not 1 we would introduce mess:
+ // wrong chunk becomes 1, but it will be impossible to explicitly set
+ // to 1 because it becomes KMP_MIN_CHUNK...
+ // } else if ( chunk < KMP_MIN_CHUNK ) {
+ // chunk = KMP_MIN_CHUNK;
+ } else if (chunk > KMP_MAX_CHUNK) {
+ chunk = KMP_MAX_CHUNK;
+ __kmp_msg(kmp_ms_warning, KMP_MSG(LargeChunk, name, delim),
+ __kmp_msg_null);
+ KMP_INFORM(Using_int_Value, name, chunk);
+ }
}
- } else if (ptr) {
- SKIP_TOKEN(ptr);
+ } else {
+ ptr = delim;
}
+
+ SCHEDULE_SET_MODIFIERS(sched, sched_modifier);
+
#if KMP_USE_HIER_SCHED
if (layer != kmp_hier_layer_e::LAYER_THREAD) {
__kmp_hier_scheds.append(sched, chunk, layer);
@@ -3734,6 +3764,8 @@ static void __kmp_stg_parse_omp_schedule(char const *name, char const *value,
while ((ptr = __kmp_parse_single_omp_schedule(name, ptr, true))) {
while (*ptr == ' ' || *ptr == '\t' || *ptr == ':')
ptr++;
+ if (*ptr == '\0')
+ break;
}
} else
#endif
@@ -3757,8 +3789,14 @@ static void __kmp_stg_print_omp_schedule(kmp_str_buf_t *buffer,
} else {
__kmp_str_buf_print(buffer, " %s='", name);
}
+ enum sched_type sched = SCHEDULE_WITHOUT_MODIFIERS(__kmp_sched);
+ if (SCHEDULE_HAS_MONOTONIC(__kmp_sched)) {
+ __kmp_str_buf_print(buffer, "monotonic:");
+ } else if (SCHEDULE_HAS_NONMONOTONIC(__kmp_sched)) {
+ __kmp_str_buf_print(buffer, "nonmonotonic:");
+ }
if (__kmp_chunk) {
- switch (__kmp_sched) {
+ switch (sched) {
case kmp_sch_dynamic_chunked:
__kmp_str_buf_print(buffer, "%s,%d'\n", "dynamic", __kmp_chunk);
break;
@@ -3783,7 +3821,7 @@ static void __kmp_stg_print_omp_schedule(kmp_str_buf_t *buffer,
break;
}
} else {
- switch (__kmp_sched) {
+ switch (sched) {
case kmp_sch_dynamic_chunked:
__kmp_str_buf_print(buffer, "%s'\n", "dynamic");
break;
@@ -3945,79 +3983,9 @@ static void __kmp_stg_print_par_range_env(kmp_str_buf_t *buffer,
}
} // __kmp_stg_print_par_range_env
-// -----------------------------------------------------------------------------
-// KMP_YIELD_CYCLE, KMP_YIELD_ON, KMP_YIELD_OFF
-
-static void __kmp_stg_parse_yield_cycle(char const *name, char const *value,
- void *data) {
- int flag = __kmp_yield_cycle;
- __kmp_stg_parse_bool(name, value, &flag);
- __kmp_yield_cycle = flag;
-} // __kmp_stg_parse_yield_cycle
-
-static void __kmp_stg_print_yield_cycle(kmp_str_buf_t *buffer, char const *name,
- void *data) {
- __kmp_stg_print_bool(buffer, name, __kmp_yield_cycle);
-} // __kmp_stg_print_yield_cycle
-
-static void __kmp_stg_parse_yield_on(char const *name, char const *value,
- void *data) {
- __kmp_stg_parse_int(name, value, 2, INT_MAX, &__kmp_yield_on_count);
-} // __kmp_stg_parse_yield_on
-
-static void __kmp_stg_print_yield_on(kmp_str_buf_t *buffer, char const *name,
- void *data) {
- __kmp_stg_print_int(buffer, name, __kmp_yield_on_count);
-} // __kmp_stg_print_yield_on
-
-static void __kmp_stg_parse_yield_off(char const *name, char const *value,
- void *data) {
- __kmp_stg_parse_int(name, value, 2, INT_MAX, &__kmp_yield_off_count);
-} // __kmp_stg_parse_yield_off
-
-static void __kmp_stg_print_yield_off(kmp_str_buf_t *buffer, char const *name,
- void *data) {
- __kmp_stg_print_int(buffer, name, __kmp_yield_off_count);
-} // __kmp_stg_print_yield_off
-
#endif
// -----------------------------------------------------------------------------
-// KMP_INIT_WAIT, KMP_NEXT_WAIT
-
-static void __kmp_stg_parse_init_wait(char const *name, char const *value,
- void *data) {
- int wait;
- KMP_ASSERT((__kmp_init_wait & 1) == 0);
- wait = __kmp_init_wait / 2;
- __kmp_stg_parse_int(name, value, KMP_MIN_INIT_WAIT, KMP_MAX_INIT_WAIT, &wait);
- __kmp_init_wait = wait * 2;
- KMP_ASSERT((__kmp_init_wait & 1) == 0);
- __kmp_yield_init = __kmp_init_wait;
-} // __kmp_stg_parse_init_wait
-
-static void __kmp_stg_print_init_wait(kmp_str_buf_t *buffer, char const *name,
- void *data) {
- __kmp_stg_print_int(buffer, name, __kmp_init_wait);
-} // __kmp_stg_print_init_wait
-
-static void __kmp_stg_parse_next_wait(char const *name, char const *value,
- void *data) {
- int wait;
- KMP_ASSERT((__kmp_next_wait & 1) == 0);
- wait = __kmp_next_wait / 2;
- __kmp_stg_parse_int(name, value, KMP_MIN_NEXT_WAIT, KMP_MAX_NEXT_WAIT, &wait);
- __kmp_next_wait = wait * 2;
- KMP_ASSERT((__kmp_next_wait & 1) == 0);
- __kmp_yield_next = __kmp_next_wait;
-} // __kmp_stg_parse_next_wait
-
-static void __kmp_stg_print_next_wait(kmp_str_buf_t *buffer, char const *name,
- void *data) {
- __kmp_stg_print_int(buffer, name, __kmp_next_wait);
-} //__kmp_stg_print_next_wait
-
-// -----------------------------------------------------------------------------
// KMP_GTID_MODE
static void __kmp_stg_parse_gtid_mode(char const *name, char const *value,
@@ -4476,10 +4444,10 @@ static void __kmp_stg_parse_hw_subset(char const *name, char const *value,
pos = input;
components[level++] = pos;
while ((pos = strchr(pos, ','))) {
+ if (level >= MAX_T_LEVEL)
+ goto err; // too many components provided
*pos = '\0'; // modify input and avoid more copying
components[level++] = ++pos; // expect something after ","
- if (level > MAX_T_LEVEL)
- goto err; // too many components provided
}
// Check each component
for (int i = 0; i < level; ++i) {
@@ -4640,9 +4608,21 @@ static void __kmp_stg_print_forkjoin_frames_mode(kmp_str_buf_t *buffer,
#endif /* USE_ITT_BUILD */
// -----------------------------------------------------------------------------
-// OMP_DISPLAY_ENV
+// KMP_ENABLE_TASK_THROTTLING
-#if OMP_40_ENABLED
+static void __kmp_stg_parse_task_throttling(char const *name,
+ char const *value, void *data) {
+ __kmp_stg_parse_bool(name, value, &__kmp_enable_task_throttling);
+} // __kmp_stg_parse_task_throttling
+
+
+static void __kmp_stg_print_task_throttling(kmp_str_buf_t *buffer,
+ char const *name, void *data) {
+ __kmp_stg_print_bool(buffer, name, __kmp_enable_task_throttling);
+} // __kmp_stg_print_task_throttling
+
+// -----------------------------------------------------------------------------
+// OMP_DISPLAY_ENV
static void __kmp_stg_parse_omp_display_env(char const *name, char const *value,
void *data) {
@@ -4651,7 +4631,6 @@ static void __kmp_stg_parse_omp_display_env(char const *name, char const *value,
} else {
__kmp_stg_parse_bool(name, value, &__kmp_display_env);
}
-
} // __kmp_stg_parse_omp_display_env
static void __kmp_stg_print_omp_display_env(kmp_str_buf_t *buffer,
@@ -4677,9 +4656,7 @@ static void __kmp_stg_print_omp_cancellation(kmp_str_buf_t *buffer,
__kmp_stg_print_bool(buffer, name, __kmp_omp_cancellation);
} // __kmp_stg_print_omp_cancellation
-#endif
-
-#if OMP_50_ENABLED && OMPT_SUPPORT
+#if OMPT_SUPPORT
static int __kmp_tool = 1;
static void __kmp_stg_parse_omp_tool(char const *name, char const *value,
@@ -4727,6 +4704,8 @@ static kmp_setting_t __kmp_stg_table[] = {
{"KMP_ALL_THREADS", __kmp_stg_parse_device_thread_limit, NULL, NULL, 0, 0},
{"KMP_BLOCKTIME", __kmp_stg_parse_blocktime, __kmp_stg_print_blocktime,
NULL, 0, 0},
+ {"KMP_USE_YIELD", __kmp_stg_parse_use_yield, __kmp_stg_print_use_yield,
+ NULL, 0, 0},
{"KMP_DUPLICATE_LIB_OK", __kmp_stg_parse_duplicate_lib_ok,
__kmp_stg_print_duplicate_lib_ok, NULL, 0, 0},
{"KMP_LIBRARY", __kmp_stg_parse_wait_policy, __kmp_stg_print_wait_policy,
@@ -4762,20 +4741,14 @@ static kmp_setting_t __kmp_stg_table[] = {
__kmp_stg_print_task_stealing, NULL, 0, 0},
{"OMP_MAX_ACTIVE_LEVELS", __kmp_stg_parse_max_active_levels,
__kmp_stg_print_max_active_levels, NULL, 0, 0},
-#if OMP_40_ENABLED
{"OMP_DEFAULT_DEVICE", __kmp_stg_parse_default_device,
__kmp_stg_print_default_device, NULL, 0, 0},
-#endif
-#if OMP_50_ENABLED
{"OMP_TARGET_OFFLOAD", __kmp_stg_parse_target_offload,
__kmp_stg_print_target_offload, NULL, 0, 0},
-#endif
-#if OMP_45_ENABLED
{"OMP_MAX_TASK_PRIORITY", __kmp_stg_parse_max_task_priority,
__kmp_stg_print_max_task_priority, NULL, 0, 0},
{"KMP_TASKLOOP_MIN_TASKS", __kmp_stg_parse_taskloop_min_tasks,
__kmp_stg_print_taskloop_min_tasks, NULL, 0, 0},
-#endif
{"OMP_THREAD_LIMIT", __kmp_stg_parse_thread_limit,
__kmp_stg_print_thread_limit, NULL, 0, 0},
{"KMP_TEAMS_THREAD_LIMIT", __kmp_stg_parse_teams_thread_limit,
@@ -4831,12 +4804,6 @@ static kmp_setting_t __kmp_stg_table[] = {
{"KMP_PAR_RANGE", __kmp_stg_parse_par_range_env,
__kmp_stg_print_par_range_env, NULL, 0, 0},
- {"KMP_YIELD_CYCLE", __kmp_stg_parse_yield_cycle,
- __kmp_stg_print_yield_cycle, NULL, 0, 0},
- {"KMP_YIELD_ON", __kmp_stg_parse_yield_on, __kmp_stg_print_yield_on, NULL,
- 0, 0},
- {"KMP_YIELD_OFF", __kmp_stg_parse_yield_off, __kmp_stg_print_yield_off,
- NULL, 0, 0},
#endif // KMP_DEBUG
{"KMP_ALIGN_ALLOC", __kmp_stg_parse_align_alloc,
@@ -4880,33 +4847,24 @@ static kmp_setting_t __kmp_stg_table[] = {
{"GOMP_CPU_AFFINITY", __kmp_stg_parse_gomp_cpu_affinity, NULL,
/* no print */ NULL, 0, 0},
#endif /* KMP_GOMP_COMPAT */
-#if OMP_40_ENABLED
{"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind,
NULL, 0, 0},
{"OMP_PLACES", __kmp_stg_parse_places, __kmp_stg_print_places, NULL, 0, 0},
-#else
- {"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, NULL, /* no print */ NULL, 0,
- 0},
-#endif /* OMP_40_ENABLED */
{"KMP_TOPOLOGY_METHOD", __kmp_stg_parse_topology_method,
__kmp_stg_print_topology_method, NULL, 0, 0},
#else
-// KMP_AFFINITY is not supported on OS X*, nor is OMP_PLACES.
-// OMP_PROC_BIND and proc-bind-var are supported, however.
-#if OMP_40_ENABLED
+ // KMP_AFFINITY is not supported on OS X*, nor is OMP_PLACES.
+ // OMP_PROC_BIND and proc-bind-var are supported, however.
{"OMP_PROC_BIND", __kmp_stg_parse_proc_bind, __kmp_stg_print_proc_bind,
NULL, 0, 0},
-#endif
#endif // KMP_AFFINITY_SUPPORTED
-#if OMP_50_ENABLED
{"OMP_DISPLAY_AFFINITY", __kmp_stg_parse_display_affinity,
__kmp_stg_print_display_affinity, NULL, 0, 0},
{"OMP_AFFINITY_FORMAT", __kmp_stg_parse_affinity_format,
__kmp_stg_print_affinity_format, NULL, 0, 0},
-#endif
{"KMP_INIT_AT_FORK", __kmp_stg_parse_init_at_fork,
__kmp_stg_print_init_at_fork, NULL, 0, 0},
{"KMP_SCHEDULE", __kmp_stg_parse_schedule, __kmp_stg_print_schedule, NULL,
@@ -4928,10 +4886,6 @@ static kmp_setting_t __kmp_stg_table[] = {
#endif /* USE_ITT_BUILD && USE_ITT_NOTIFY */
{"KMP_MALLOC_POOL_INCR", __kmp_stg_parse_malloc_pool_incr,
__kmp_stg_print_malloc_pool_incr, NULL, 0, 0},
- {"KMP_INIT_WAIT", __kmp_stg_parse_init_wait, __kmp_stg_print_init_wait,
- NULL, 0, 0},
- {"KMP_NEXT_WAIT", __kmp_stg_parse_next_wait, __kmp_stg_print_next_wait,
- NULL, 0, 0},
{"KMP_GTID_MODE", __kmp_stg_parse_gtid_mode, __kmp_stg_print_gtid_mode,
NULL, 0, 0},
{"OMP_DYNAMIC", __kmp_stg_parse_omp_dynamic, __kmp_stg_print_omp_dynamic,
@@ -4968,20 +4922,17 @@ static kmp_setting_t __kmp_stg_table[] = {
{"KMP_FORKJOIN_FRAMES_MODE", __kmp_stg_parse_forkjoin_frames_mode,
__kmp_stg_print_forkjoin_frames_mode, NULL, 0, 0},
#endif
+ {"KMP_ENABLE_TASK_THROTTLING", __kmp_stg_parse_task_throttling,
+ __kmp_stg_print_task_throttling, NULL, 0, 0},
-#if OMP_40_ENABLED
{"OMP_DISPLAY_ENV", __kmp_stg_parse_omp_display_env,
__kmp_stg_print_omp_display_env, NULL, 0, 0},
{"OMP_CANCELLATION", __kmp_stg_parse_omp_cancellation,
__kmp_stg_print_omp_cancellation, NULL, 0, 0},
-#endif
-
-#if OMP_50_ENABLED
{"OMP_ALLOCATOR", __kmp_stg_parse_allocator, __kmp_stg_print_allocator,
NULL, 0, 0},
-#endif
-#if OMP_50_ENABLED && OMPT_SUPPORT
+#if OMPT_SUPPORT
{"OMP_TOOL", __kmp_stg_parse_omp_tool, __kmp_stg_print_omp_tool, NULL, 0,
0},
{"OMP_TOOL_LIBRARIES", __kmp_stg_parse_omp_tool_libraries,
@@ -5167,7 +5118,6 @@ static void __kmp_stg_init(void) {
omp_proc_bind->data = CCAST(kmp_setting_t **, rivals);
rivals[i++] = NULL;
-#if OMP_40_ENABLED
static kmp_setting_t *volatile places_rivals[4];
i = 0;
@@ -5181,7 +5131,6 @@ static void __kmp_stg_init(void) {
places_rivals[i++] = omp_places;
omp_places->data = CCAST(kmp_setting_t **, places_rivals);
places_rivals[i++] = NULL;
-#endif
}
#else
// KMP_AFFINITY not supported, so OMP_PROC_BIND has no rivals.
@@ -5308,7 +5257,7 @@ static void __kmp_aux_env_initialize(kmp_env_blk_t *block) {
/* OMP_NESTED */
value = __kmp_env_blk_var(block, "OMP_NESTED");
if (value) {
- ompc_set_nested(__kmp_dflt_nested);
+ ompc_set_nested(__kmp_dflt_max_active_levels > 1);
}
/* OMP_DYNAMIC */
@@ -5403,7 +5352,6 @@ void __kmp_env_initialize(char const *string) {
}
#undef FIND
-#if OMP_40_ENABLED
// Also reset the affinity flags if OMP_PROC_BIND is specified.
aff_str = __kmp_env_blk_var(&block, "OMP_PROC_BIND");
if (aff_str != NULL) {
@@ -5412,12 +5360,10 @@ void __kmp_env_initialize(char const *string) {
__kmp_affinity_top_method = affinity_top_method_default;
__kmp_affinity_respect_mask = affinity_respect_mask_default;
}
-#endif /* OMP_40_ENABLED */
}
#endif /* KMP_AFFINITY_SUPPORTED */
-#if OMP_40_ENABLED
// Set up the nested proc bind type vector.
if (__kmp_nested_proc_bind.bind_types == NULL) {
__kmp_nested_proc_bind.bind_types =
@@ -5434,9 +5380,7 @@ void __kmp_env_initialize(char const *string) {
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
#endif
}
-#endif /* OMP_40_ENABLED */
-#if OMP_50_ENABLED
// Set up the affinity format ICV
// Grab the default affinity format string from the message catalog
kmp_msg_t m =
@@ -5449,7 +5393,6 @@ void __kmp_env_initialize(char const *string) {
}
KMP_STRCPY_S(__kmp_affinity_format, KMP_AFFINITY_FORMAT_SIZE, m.str);
__kmp_str_free(&m.str);
-#endif
// Now process all of the settings.
for (i = 0; i < block.count; ++i) {
@@ -5524,14 +5467,12 @@ void __kmp_env_initialize(char const *string) {
}
}
-#if OMP_40_ENABLED
if (__kmp_affinity_type == affinity_disabled) {
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
} else if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_true) {
// OMP_PROC_BIND=true maps to OMP_PROC_BIND=spread.
__kmp_nested_proc_bind.bind_types[0] = proc_bind_spread;
}
-#endif /* OMP_40_ENABLED */
if (KMP_AFFINITY_CAPABLE()) {
@@ -5568,20 +5509,16 @@ void __kmp_env_initialize(char const *string) {
// processor groups, or if the user requested it, and OMP 4.0
// affinity is not in effect.
if (((__kmp_num_proc_groups > 1) &&
- (__kmp_affinity_type == affinity_default)
-#if OMP_40_ENABLED
- && (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default))
-#endif
- || (__kmp_affinity_top_method == affinity_top_method_group)) {
+ (__kmp_affinity_type == affinity_default) &&
+ (__kmp_nested_proc_bind.bind_types[0] == proc_bind_default)) ||
+ (__kmp_affinity_top_method == affinity_top_method_group)) {
if (__kmp_affinity_respect_mask == affinity_respect_mask_default &&
exactly_one_group) {
__kmp_affinity_respect_mask = FALSE;
}
if (__kmp_affinity_type == affinity_default) {
__kmp_affinity_type = affinity_compact;
-#if OMP_40_ENABLED
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
-#endif
}
if (__kmp_affinity_top_method == affinity_top_method_default) {
if (__kmp_affinity_gran == affinity_gran_default) {
@@ -5662,17 +5599,13 @@ void __kmp_env_initialize(char const *string) {
__kmp_affinity_respect_mask = TRUE;
}
}
-#if OMP_40_ENABLED
if ((__kmp_nested_proc_bind.bind_types[0] != proc_bind_intel) &&
(__kmp_nested_proc_bind.bind_types[0] != proc_bind_default)) {
if (__kmp_affinity_type == affinity_default) {
__kmp_affinity_type = affinity_compact;
__kmp_affinity_dups = FALSE;
}
- } else
-#endif /* OMP_40_ENABLED */
- if (__kmp_affinity_type == affinity_default) {
-#if OMP_40_ENABLED
+ } else if (__kmp_affinity_type == affinity_default) {
#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic) {
__kmp_nested_proc_bind.bind_types[0] = proc_bind_intel;
@@ -5681,7 +5614,6 @@ void __kmp_env_initialize(char const *string) {
{
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
}
-#endif /* OMP_40_ENABLED */
#if KMP_MIC_SUPPORTED
if (__kmp_mic_type != non_mic) {
__kmp_affinity_type = affinity_scatter;
@@ -5718,11 +5650,9 @@ void __kmp_env_initialize(char const *string) {
K_DIAG(1, ("__kmp_affinity_gran == %d\n", __kmp_affinity_gran));
KMP_DEBUG_ASSERT(__kmp_affinity_type != affinity_default);
-#if OMP_40_ENABLED
KMP_DEBUG_ASSERT(__kmp_nested_proc_bind.bind_types[0] != proc_bind_default);
K_DIAG(1, ("__kmp_nested_proc_bind.bind_types[0] == %d\n",
__kmp_nested_proc_bind.bind_types[0]));
-#endif
}
#endif /* KMP_AFFINITY_SUPPORTED */
@@ -5789,7 +5719,6 @@ void __kmp_env_print() {
} // __kmp_env_print
-#if OMP_40_ENABLED
void __kmp_env_print_2() {
kmp_env_blk_t block;
@@ -5827,6 +5756,5 @@ void __kmp_env_print_2() {
__kmp_printf("\n");
} // __kmp_env_print_2
-#endif // OMP_40_ENABLED
// end of file
diff --git a/runtime/src/kmp_settings.h b/runtime/src/kmp_settings.h
index 338a4435cba1..3247ffc6af74 100644
--- a/runtime/src/kmp_settings.h
+++ b/runtime/src/kmp_settings.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -17,9 +16,7 @@
void __kmp_reset_global_vars(void);
void __kmp_env_initialize(char const *);
void __kmp_env_print();
-#if OMP_40_ENABLED
void __kmp_env_print_2();
-#endif // OMP_40_ENABLED
int __kmp_initial_threads_capacity(int req_nproc);
void __kmp_init_dflt_team_nth();
diff --git a/runtime/src/kmp_stats.cpp b/runtime/src/kmp_stats.cpp
index 2c0eabef26aa..71f2dd93be79 100644
--- a/runtime/src/kmp_stats.cpp
+++ b/runtime/src/kmp_stats.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -547,7 +546,6 @@ static std::string generateFilename(char const *prototype,
// of __kmp_stats_global_output
void kmp_stats_output_module::init() {
- fprintf(stderr, "*** Stats enabled OpenMP* runtime ***\n");
char *statsFileName = getenv("KMP_STATS_FILE");
eventsFileName = getenv("KMP_STATS_EVENTS_FILE");
plotFileName = getenv("KMP_STATS_PLOT_FILE");
@@ -670,9 +668,11 @@ void kmp_stats_output_module::printEvents(FILE *eventsOut,
for (int i = 0; i < theEvents->size(); i++) {
kmp_stats_event ev = theEvents->at(i);
rgb_color color = getEventColor(ev.getTimerName());
- fprintf(eventsOut, "%d %lu %lu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n", gtid,
- ev.getStart(), ev.getStop(), 1.2 - (ev.getNestLevel() * 0.2),
- color.r, color.g, color.b, timeStat::name(ev.getTimerName()));
+ fprintf(eventsOut, "%d %llu %llu %1.1f rgb(%1.1f,%1.1f,%1.1f) %s\n", gtid,
+ static_cast<unsigned long long>(ev.getStart()),
+ static_cast<unsigned long long>(ev.getStop()),
+ 1.2 - (ev.getNestLevel() * 0.2), color.r, color.g, color.b,
+ timeStat::name(ev.getTimerName()));
}
return;
}
diff --git a/runtime/src/kmp_stats.h b/runtime/src/kmp_stats.h
index be94843948ca..ee95658fd9b7 100644
--- a/runtime/src/kmp_stats.h
+++ b/runtime/src/kmp_stats.h
@@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -70,7 +69,8 @@ enum stats_state_e {
TASKYIELD,
TASKGROUP,
IMPLICIT_TASK,
- EXPLICIT_TASK
+ EXPLICIT_TASK,
+ TEAMS_REGION
};
/*!
@@ -138,10 +138,14 @@ enum stats_state_e {
macro (OMP_worker_thread_life, stats_flags_e::logEvent, arg) \
macro (OMP_parallel, stats_flags_e::logEvent, arg) \
macro (OMP_parallel_overhead, stats_flags_e::logEvent, arg) \
+ macro (OMP_teams, stats_flags_e::logEvent, arg) \
+ macro (OMP_teams_overhead, stats_flags_e::logEvent, arg) \
macro (OMP_loop_static, 0, arg) \
macro (OMP_loop_static_scheduling, 0, arg) \
macro (OMP_loop_dynamic, 0, arg) \
macro (OMP_loop_dynamic_scheduling, 0, arg) \
+ macro (OMP_distribute, 0, arg) \
+ macro (OMP_distribute_scheduling, 0, arg) \
macro (OMP_critical, 0, arg) \
macro (OMP_critical_wait, 0, arg) \
macro (OMP_single, 0, arg) \
@@ -164,8 +168,14 @@ enum stats_state_e {
arg) \
macro (OMP_loop_static_iterations, \
stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
+ macro (OMP_loop_static_total_iterations, \
+ stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
macro (OMP_loop_dynamic_iterations, \
stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
+ macro (OMP_loop_dynamic_total_iterations, \
+ stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
+ macro (OMP_distribute_iterations, \
+ stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
KMP_FOREACH_DEVELOPER_TIMER(macro, arg)
// clang-format on
@@ -956,42 +966,40 @@ extern kmp_stats_output_module __kmp_stats_output;
#define KMP_RESET_STATS() __kmp_reset_stats()
#if (KMP_DEVELOPER_STATS)
-#define KMP_TIME_DEVELOPER_BLOCK(n) KMP_TIME_BLOCK(n)
#define KMP_COUNT_DEVELOPER_VALUE(n, v) KMP_COUNT_VALUE(n, v)
#define KMP_COUNT_DEVELOPER_BLOCK(n) KMP_COUNT_BLOCK(n)
-#define KMP_START_DEVELOPER_EXPLICIT_TIMER(n) KMP_START_EXPLICIT_TIMER(n)
-#define KMP_STOP_DEVELOPER_EXPLICIT_TIMER(n) KMP_STOP_EXPLICIT_TIMER(n)
#define KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(n) KMP_TIME_PARTITIONED_BLOCK(n)
+#define KMP_PUSH_DEVELOPER_PARTITIONED_TIMER(n) KMP_PUSH_PARTITIONED_TIMER(n)
+#define KMP_POP_DEVELOPER_PARTITIONED_TIMER(n) KMP_POP_PARTITIONED_TIMER(n)
+#define KMP_EXCHANGE_DEVELOPER_PARTITIONED_TIMER(n) \
+ KMP_EXCHANGE_PARTITIONED_TIMER(n)
#else
// Null definitions
-#define KMP_TIME_DEVELOPER_BLOCK(n) ((void)0)
#define KMP_COUNT_DEVELOPER_VALUE(n, v) ((void)0)
#define KMP_COUNT_DEVELOPER_BLOCK(n) ((void)0)
-#define KMP_START_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
-#define KMP_STOP_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
#define KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(n) ((void)0)
+#define KMP_PUSH_DEVELOPER_PARTITIONED_TIMER(n) ((void)0)
+#define KMP_POP_DEVELOPER_PARTITIONED_TIMER(n) ((void)0)
+#define KMP_EXCHANGE_DEVELOPER_PARTITIONED_TIMER(n) ((void)0)
#endif
#else // KMP_STATS_ENABLED
// Null definitions
-#define KMP_TIME_BLOCK(n) ((void)0)
#define KMP_COUNT_VALUE(n, v) ((void)0)
#define KMP_COUNT_BLOCK(n) ((void)0)
-#define KMP_START_EXPLICIT_TIMER(n) ((void)0)
-#define KMP_STOP_EXPLICIT_TIMER(n) ((void)0)
#define KMP_OUTPUT_STATS(heading_string) ((void)0)
#define KMP_RESET_STATS() ((void)0)
-#define KMP_TIME_DEVELOPER_BLOCK(n) ((void)0)
#define KMP_COUNT_DEVELOPER_VALUE(n, v) ((void)0)
#define KMP_COUNT_DEVELOPER_BLOCK(n) ((void)0)
-#define KMP_START_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
-#define KMP_STOP_DEVELOPER_EXPLICIT_TIMER(n) ((void)0)
+#define KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(n) ((void)0)
+#define KMP_PUSH_DEVELOPER_PARTITIONED_TIMER(n) ((void)0)
+#define KMP_POP_DEVELOPER_PARTITIONED_TIMER(n) ((void)0)
+#define KMP_EXCHANGE_DEVELOPER_PARTITIONED_TIMER(n) ((void)0)
#define KMP_INIT_PARTITIONED_TIMERS(name) ((void)0)
#define KMP_TIME_PARTITIONED_BLOCK(name) ((void)0)
-#define KMP_TIME_DEVELOPER_PARTITIONED_BLOCK(n) ((void)0)
#define KMP_PUSH_PARTITIONED_TIMER(name) ((void)0)
#define KMP_POP_PARTITIONED_TIMER() ((void)0)
#define KMP_SET_THREAD_STATE(state_name) ((void)0)
diff --git a/runtime/src/kmp_stats_timing.cpp b/runtime/src/kmp_stats_timing.cpp
index 2fcbaab75681..bdfe68c3fc9c 100644
--- a/runtime/src/kmp_stats_timing.cpp
+++ b/runtime/src/kmp_stats_timing.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_stats_timing.h b/runtime/src/kmp_stats_timing.h
index 84252ec13805..f3428b31d46c 100644
--- a/runtime/src/kmp_stats_timing.h
+++ b/runtime/src/kmp_stats_timing.h
@@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_str.cpp b/runtime/src/kmp_str.cpp
index 5338edf7243e..fb748d1a54ab 100644
--- a/runtime/src/kmp_str.cpp
+++ b/runtime/src/kmp_str.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_str.h b/runtime/src/kmp_str.h
index c30255db9f58..09faadb68f1a 100644
--- a/runtime/src/kmp_str.h
+++ b/runtime/src/kmp_str.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_stub.cpp b/runtime/src/kmp_stub.cpp
index c1f3bf38755c..badbbde7c967 100644
--- a/runtime/src/kmp_stub.cpp
+++ b/runtime/src/kmp_stub.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -276,22 +275,11 @@ void __kmps_get_schedule(kmp_sched_t *kind, int *modifier) {
*modifier = __kmps_sched_modifier;
} // __kmps_get_schedule
-#if OMP_40_ENABLED
-
-static kmp_proc_bind_t __kmps_proc_bind = proc_bind_false;
-
-void __kmps_set_proc_bind(kmp_proc_bind_t arg) {
- i;
- __kmps_proc_bind = arg;
-} // __kmps_set_proc_bind
-
kmp_proc_bind_t __kmps_get_proc_bind(void) {
i;
- return __kmps_proc_bind;
+ return 0;
} // __kmps_get_proc_bind
-#endif /* OMP_40_ENABLED */
-
double __kmps_get_wtime(void) {
// Elapsed wall clock time (in second) from "sometime in the past".
double wtime = 0.0;
@@ -343,17 +331,45 @@ double __kmps_get_wtick(void) {
return wtick;
} // __kmps_get_wtick
-#if OMP_50_ENABLED
/* OpenMP 5.0 Memory Management */
-const omp_allocator_t *OMP_NULL_ALLOCATOR = NULL;
-const omp_allocator_t *omp_default_mem_alloc = (const omp_allocator_t *)1;
-const omp_allocator_t *omp_large_cap_mem_alloc = (const omp_allocator_t *)2;
-const omp_allocator_t *omp_const_mem_alloc = (const omp_allocator_t *)3;
-const omp_allocator_t *omp_high_bw_mem_alloc = (const omp_allocator_t *)4;
-const omp_allocator_t *omp_low_lat_mem_alloc = (const omp_allocator_t *)5;
-const omp_allocator_t *omp_cgroup_mem_alloc = (const omp_allocator_t *)6;
-const omp_allocator_t *omp_pteam_mem_alloc = (const omp_allocator_t *)7;
-const omp_allocator_t *omp_thread_mem_alloc = (const omp_allocator_t *)8;
+#if KMP_OS_WINDOWS
+omp_allocator_handle_t const omp_null_allocator = 0;
+omp_allocator_handle_t const omp_default_mem_alloc =
+ (omp_allocator_handle_t const)1;
+omp_allocator_handle_t const omp_large_cap_mem_alloc =
+ (omp_allocator_handle_t const)2;
+omp_allocator_handle_t const omp_const_mem_alloc =
+ (omp_allocator_handle_t const)3;
+omp_allocator_handle_t const omp_high_bw_mem_alloc =
+ (omp_allocator_handle_t const)4;
+omp_allocator_handle_t const omp_low_lat_mem_alloc =
+ (omp_allocator_handle_t const)5;
+omp_allocator_handle_t const omp_cgroup_mem_alloc =
+ (omp_allocator_handle_t const)6;
+omp_allocator_handle_t const omp_pteam_mem_alloc =
+ (omp_allocator_handle_t const)7;
+omp_allocator_handle_t const omp_thread_mem_alloc =
+ (omp_allocator_handle_t const)8;
+
+omp_memspace_handle_t const omp_default_mem_space =
+ (omp_memspace_handle_t const)0;
+omp_memspace_handle_t const omp_large_cap_mem_space =
+ (omp_memspace_handle_t const)1;
+omp_memspace_handle_t const omp_const_mem_space =
+ (omp_memspace_handle_t const)2;
+omp_memspace_handle_t const omp_high_bw_mem_space =
+ (omp_memspace_handle_t const)3;
+omp_memspace_handle_t const omp_low_lat_mem_space =
+ (omp_memspace_handle_t const)4;
+#endif /* KMP_OS_WINDOWS */
+void *omp_alloc(size_t size, const omp_allocator_handle_t allocator) {
+ i;
+ return malloc(size);
+}
+void omp_free(void *ptr, const omp_allocator_handle_t allocator) {
+ i;
+ free(ptr);
+}
/* OpenMP 5.0 Affinity Format */
void omp_set_affinity_format(char const *format) { i; }
size_t omp_get_affinity_format(char *buffer, size_t size) {
@@ -365,6 +381,5 @@ size_t omp_capture_affinity(char *buffer, size_t buf_size, char const *format) {
i;
return 0;
}
-#endif /* OMP_50_ENABLED */
// end of file //
diff --git a/runtime/src/kmp_stub.h b/runtime/src/kmp_stub.h
index 487729f75754..679c07b16a42 100644
--- a/runtime/src/kmp_stub.h
+++ b/runtime/src/kmp_stub.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -42,10 +41,7 @@ typedef enum kmp_sched {
void __kmps_set_schedule(kmp_sched_t kind, int modifier);
void __kmps_get_schedule(kmp_sched_t *kind, int *modifier);
-#if OMP_40_ENABLED
-void __kmps_set_proc_bind(kmp_proc_bind_t arg);
kmp_proc_bind_t __kmps_get_proc_bind(void);
-#endif /* OMP_40_ENABLED */
double __kmps_get_wtime();
double __kmps_get_wtick();
diff --git a/runtime/src/kmp_taskdeps.cpp b/runtime/src/kmp_taskdeps.cpp
index fcdd632c972b..db79deac3127 100644
--- a/runtime/src/kmp_taskdeps.cpp
+++ b/runtime/src/kmp_taskdeps.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -21,8 +20,6 @@
#include "ompt-specific.h"
#endif
-#if OMP_40_ENABLED
-
// TODO: Improve memory allocation? keep a list of pre-allocated structures?
// allocate in blocks? re-use list finished list entries?
// TODO: don't use atomic ref counters for stack-allocated nodes.
@@ -536,10 +533,8 @@ kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
bool serial = current_task->td_flags.team_serial ||
current_task->td_flags.tasking_ser ||
current_task->td_flags.final;
-#if OMP_45_ENABLED
kmp_task_team_t *task_team = thread->th.th_task_team;
serial = serial && !(task_team && task_team->tt.tt_found_proxy_tasks);
-#endif
if (!serial && (ndeps > 0 || ndeps_noalias > 0)) {
/* if no dependencies have been tracked yet, create the dependence hash */
@@ -624,10 +619,8 @@ void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps,
bool ignore = current_task->td_flags.team_serial ||
current_task->td_flags.tasking_ser ||
current_task->td_flags.final;
-#if OMP_45_ENABLED
ignore = ignore && thread->th.th_task_team != NULL &&
thread->th.th_task_team->tt.tt_found_proxy_tasks == FALSE;
-#endif
ignore = ignore || current_task->td_dephash == NULL;
if (ignore) {
@@ -660,5 +653,3 @@ void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps,
KA_TRACE(10, ("__kmpc_omp_wait_deps(exit): T#%d finished waiting : loc=%p\n",
gtid, loc_ref));
}
-
-#endif /* OMP_40_ENABLED */
diff --git a/runtime/src/kmp_taskdeps.h b/runtime/src/kmp_taskdeps.h
index 8496884d1c3a..2a712b348af6 100644
--- a/runtime/src/kmp_taskdeps.h
+++ b/runtime/src/kmp_taskdeps.h
@@ -5,10 +5,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -18,8 +17,6 @@
#include "kmp.h"
-#if OMP_40_ENABLED
-
#define KMP_ACQUIRE_DEPNODE(gtid, n) __kmp_acquire_lock(&(n)->dn.lock, (gtid))
#define KMP_RELEASE_DEPNODE(gtid, n) __kmp_release_lock(&(n)->dn.lock, (gtid))
@@ -145,6 +142,4 @@ static inline void __kmp_release_deps(kmp_int32 gtid, kmp_taskdata_t *task) {
gtid, task));
}
-#endif // OMP_40_ENABLED
-
#endif // KMP_TASKDEPS_H
diff --git a/runtime/src/kmp_tasking.cpp b/runtime/src/kmp_tasking.cpp
index 7292ed1452d2..d037299f1477 100644
--- a/runtime/src/kmp_tasking.cpp
+++ b/runtime/src/kmp_tasking.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -31,10 +30,7 @@ static void __kmp_alloc_task_deque(kmp_info_t *thread,
kmp_thread_data_t *thread_data);
static int __kmp_realloc_task_threads_data(kmp_info_t *thread,
kmp_task_team_t *task_team);
-
-#if OMP_45_ENABLED
static void __kmp_bottom_half_finish_proxy(kmp_int32 gtid, kmp_task_t *ptask);
-#endif
#ifdef BUILD_TIED_TASK_STACK
@@ -375,7 +371,8 @@ static kmp_int32 __kmp_push_task(kmp_int32 gtid, kmp_task_t *task) {
// Check if deque is full
if (TCR_4(thread_data->td.td_deque_ntasks) >=
TASK_DEQUE_SIZE(thread_data->td)) {
- if (__kmp_task_is_allowed(gtid, __kmp_task_stealing_constraint, taskdata,
+ if (__kmp_enable_task_throttling &&
+ __kmp_task_is_allowed(gtid, __kmp_task_stealing_constraint, taskdata,
thread->th.th_current_task)) {
KA_TRACE(20, ("__kmp_push_task: T#%d deque is full; returning "
"TASK_NOT_PUSHED for task %p\n",
@@ -391,11 +388,11 @@ static kmp_int32 __kmp_push_task(kmp_int32 gtid, kmp_task_t *task) {
// Lock the deque for the task push operation
if (!locked) {
__kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
-#if OMP_45_ENABLED
// Need to recheck as we can get a proxy task from thread outside of OpenMP
if (TCR_4(thread_data->td.td_deque_ntasks) >=
TASK_DEQUE_SIZE(thread_data->td)) {
- if (__kmp_task_is_allowed(gtid, __kmp_task_stealing_constraint, taskdata,
+ if (__kmp_enable_task_throttling &&
+ __kmp_task_is_allowed(gtid, __kmp_task_stealing_constraint, taskdata,
thread->th.th_current_task)) {
__kmp_release_bootstrap_lock(&thread_data->td.td_deque_lock);
KA_TRACE(20, ("__kmp_push_task: T#%d deque is full on 2nd check; "
@@ -407,7 +404,6 @@ static kmp_int32 __kmp_push_task(kmp_int32 gtid, kmp_task_t *task) {
__kmp_realloc_task_deque(thread, thread_data);
}
}
-#endif
}
// Must have room since no thread can add tasks but calling thread
KMP_DEBUG_ASSERT(TCR_4(thread_data->td.td_deque_ntasks) <
@@ -551,10 +547,8 @@ static inline void __ompt_task_init(kmp_taskdata_t *task, int tid) {
task->ompt_task_info.frame.enter_frame = ompt_data_none;
task->ompt_task_info.frame.exit_frame_flags = ompt_frame_runtime | ompt_frame_framepointer;
task->ompt_task_info.frame.enter_frame_flags = ompt_frame_runtime | ompt_frame_framepointer;
-#if OMP_40_ENABLED
task->ompt_task_info.ndeps = 0;
task->ompt_task_info.deps = NULL;
-#endif /* OMP_40_ENABLED */
}
// __ompt_task_start:
@@ -741,16 +735,11 @@ static void __kmp_free_task(kmp_int32 gtid, kmp_taskdata_t *taskdata,
static void __kmp_free_task_and_ancestors(kmp_int32 gtid,
kmp_taskdata_t *taskdata,
kmp_info_t *thread) {
-#if OMP_45_ENABLED
// Proxy tasks must always be allowed to free their parents
// because they can be run in background even in serial mode.
kmp_int32 team_serial =
(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser) &&
!taskdata->td_flags.proxy;
-#else
- kmp_int32 team_serial =
- taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser;
-#endif
KMP_DEBUG_ASSERT(taskdata->td_flags.tasktype == TASK_EXPLICIT);
kmp_int32 children = KMP_ATOMIC_DEC(&taskdata->td_allocated_child_tasks) - 1;
@@ -815,10 +804,8 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task,
kmp_taskdata_t *resumed_task) {
kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
kmp_info_t *thread = __kmp_threads[gtid];
-#if OMP_45_ENABLED
kmp_task_team_t *task_team =
thread->th.th_task_team; // might be NULL for serial teams...
-#endif // OMP_45_ENABLED
kmp_int32 children = 0;
KA_TRACE(10, ("__kmp_task_finish(enter): T#%d finishing task %p and resuming "
@@ -875,28 +862,41 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task,
}
KMP_DEBUG_ASSERT(taskdata->td_flags.complete == 0);
- taskdata->td_flags.complete = 1; // mark the task as completed
+ bool detach = false;
+ if (taskdata->td_flags.detachable == TASK_DETACHABLE) {
+ if (taskdata->td_allow_completion_event.type ==
+ KMP_EVENT_ALLOW_COMPLETION) {
+ // event hasn't been fulfilled yet. Try to detach task.
+ __kmp_acquire_tas_lock(&taskdata->td_allow_completion_event.lock, gtid);
+ if (taskdata->td_allow_completion_event.type ==
+ KMP_EVENT_ALLOW_COMPLETION) {
+ taskdata->td_flags.proxy = TASK_PROXY; // proxify!
+ detach = true;
+ }
+ __kmp_release_tas_lock(&taskdata->td_allow_completion_event.lock, gtid);
+ }
+ }
KMP_DEBUG_ASSERT(taskdata->td_flags.started == 1);
KMP_DEBUG_ASSERT(taskdata->td_flags.freed == 0);
- // Only need to keep track of count if team parallel and tasking not
- // serialized
- if (!(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser)) {
- // Predecrement simulated by "- 1" calculation
- children =
- KMP_ATOMIC_DEC(&taskdata->td_parent->td_incomplete_child_tasks) - 1;
- KMP_DEBUG_ASSERT(children >= 0);
-#if OMP_40_ENABLED
- if (taskdata->td_taskgroup)
- KMP_ATOMIC_DEC(&taskdata->td_taskgroup->count);
- __kmp_release_deps(gtid, taskdata);
-#if OMP_45_ENABLED
- } else if (task_team && task_team->tt.tt_found_proxy_tasks) {
- // if we found proxy tasks there could exist a dependency chain
- // with the proxy task as origin
- __kmp_release_deps(gtid, taskdata);
-#endif // OMP_45_ENABLED
-#endif // OMP_40_ENABLED
+ if (!detach) {
+ taskdata->td_flags.complete = 1; // mark the task as completed
+
+ // Only need to keep track of count if team parallel and tasking not
+ // serialized
+ if (!(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser)) {
+ // Predecrement simulated by "- 1" calculation
+ children =
+ KMP_ATOMIC_DEC(&taskdata->td_parent->td_incomplete_child_tasks) - 1;
+ KMP_DEBUG_ASSERT(children >= 0);
+ if (taskdata->td_taskgroup)
+ KMP_ATOMIC_DEC(&taskdata->td_taskgroup->count);
+ __kmp_release_deps(gtid, taskdata);
+ } else if (task_team && task_team->tt.tt_found_proxy_tasks) {
+ // if we found proxy tasks there could exist a dependency chain
+ // with the proxy task as origin
+ __kmp_release_deps(gtid, taskdata);
+ }
}
// td_flags.executing must be marked as 0 after __kmp_release_deps has been
@@ -909,7 +909,6 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task,
20, ("__kmp_task_finish: T#%d finished task %p, %d incomplete children\n",
gtid, taskdata, children));
-#if OMP_40_ENABLED
/* If the tasks' destructor thunk flag has been set, we need to invoke the
destructor thunk that has been generated by the compiler. The code is
placed here, since at this point other tasks might have been released
@@ -921,7 +920,6 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task,
KMP_ASSERT(destr_thunk);
destr_thunk(gtid, task);
}
-#endif // OMP_40_ENABLED
// bookkeeping for resuming task:
// GEH - note tasking_ser => task_serial
@@ -943,7 +941,8 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task,
// johnmc: if an asynchronous inquiry peers into the runtime system
// it doesn't see the freed task as the current task.
thread->th.th_current_task = resumed_task;
- __kmp_free_task_and_ancestors(gtid, taskdata, thread);
+ if (!detach)
+ __kmp_free_task_and_ancestors(gtid, taskdata, thread);
// TODO: GEH - make sure root team implicit task is initialized properly.
// KMP_DEBUG_ASSERT( resumed_task->td_flags.executing == 0 );
@@ -1052,9 +1051,7 @@ void __kmp_init_implicit_task(ident_t *loc_ref, kmp_info_t *this_thr,
task->td_flags.tiedness = TASK_TIED;
task->td_flags.tasktype = TASK_IMPLICIT;
-#if OMP_45_ENABLED
task->td_flags.proxy = TASK_FULL;
-#endif
// All implicit tasks are executed immediately, not deferred
task->td_flags.task_serial = 1;
@@ -1066,19 +1063,16 @@ void __kmp_init_implicit_task(ident_t *loc_ref, kmp_info_t *this_thr,
task->td_flags.complete = 0;
task->td_flags.freed = 0;
-#if OMP_40_ENABLED
task->td_depnode = NULL;
-#endif
task->td_last_tied = task;
+ task->td_allow_completion_event.type = KMP_EVENT_UNINITIALIZED;
if (set_curr_task) { // only do this init first time thread is created
KMP_ATOMIC_ST_REL(&task->td_incomplete_child_tasks, 0);
// Not used: don't need to deallocate implicit task
KMP_ATOMIC_ST_REL(&task->td_allocated_child_tasks, 0);
-#if OMP_40_ENABLED
task->td_taskgroup = NULL; // An implicit task does not have taskgroup
task->td_dephash = NULL;
-#endif
__kmp_push_current_task_to_thread(this_thr, team, tid);
} else {
KMP_DEBUG_ASSERT(task->td_incomplete_child_tasks == 0);
@@ -1188,11 +1182,14 @@ kmp_task_t *__kmp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
KMP_CHECK_UPDATE(thread->th.th_task_team->tt.tt_untied_task_encountered, 1);
}
-#if OMP_45_ENABLED
- if (flags->proxy == TASK_PROXY) {
- flags->tiedness = TASK_UNTIED;
- flags->merged_if0 = 1;
-
+ // Detachable tasks are not proxy tasks yet but could be in the future. Doing
+ // the tasking setup
+ // when that happens is too late.
+ if (flags->proxy == TASK_PROXY || flags->detachable == TASK_DETACHABLE) {
+ if (flags->proxy == TASK_PROXY) {
+ flags->tiedness = TASK_UNTIED;
+ flags->merged_if0 = 1;
+ }
/* are we running in a sequential parallel or tskm_immediate_exec... we need
tasking support enabled */
if ((thread->th.th_task_team) == NULL) {
@@ -1226,7 +1223,6 @@ kmp_task_t *__kmp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
if (task_team->tt.tt_found_proxy_tasks == FALSE)
TCW_4(task_team->tt.tt_found_proxy_tasks, TRUE);
}
-#endif
// Calculate shared structure offset including padding after kmp_task_t struct
// to align pointers in shared struct
@@ -1282,23 +1278,18 @@ kmp_task_t *__kmp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
taskdata->td_taskwait_counter = 0;
taskdata->td_taskwait_thread = 0;
KMP_DEBUG_ASSERT(taskdata->td_parent != NULL);
-#if OMP_45_ENABLED
// avoid copying icvs for proxy tasks
if (flags->proxy == TASK_FULL)
-#endif
copy_icvs(&taskdata->td_icvs, &taskdata->td_parent->td_icvs);
taskdata->td_flags.tiedness = flags->tiedness;
taskdata->td_flags.final = flags->final;
taskdata->td_flags.merged_if0 = flags->merged_if0;
-#if OMP_40_ENABLED
taskdata->td_flags.destructors_thunk = flags->destructors_thunk;
-#endif // OMP_40_ENABLED
-#if OMP_45_ENABLED
taskdata->td_flags.proxy = flags->proxy;
+ taskdata->td_flags.detachable = flags->detachable;
taskdata->td_task_team = thread->th.th_task_team;
taskdata->td_size_alloc = shareds_offset + sizeof_shareds;
-#endif
taskdata->td_flags.tasktype = TASK_EXPLICIT;
// GEH - TODO: fix this to copy parent task's value of tasking_ser flag
@@ -1325,35 +1316,28 @@ kmp_task_t *__kmp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
KMP_ATOMIC_ST_RLX(&taskdata->td_incomplete_child_tasks, 0);
// start at one because counts current task and children
KMP_ATOMIC_ST_RLX(&taskdata->td_allocated_child_tasks, 1);
-#if OMP_40_ENABLED
taskdata->td_taskgroup =
parent_task->td_taskgroup; // task inherits taskgroup from the parent task
taskdata->td_dephash = NULL;
taskdata->td_depnode = NULL;
-#endif
if (flags->tiedness == TASK_UNTIED)
taskdata->td_last_tied = NULL; // will be set when the task is scheduled
else
taskdata->td_last_tied = taskdata;
-
+ taskdata->td_allow_completion_event.type = KMP_EVENT_UNINITIALIZED;
#if OMPT_SUPPORT
if (UNLIKELY(ompt_enabled.enabled))
__ompt_task_init(taskdata, gtid);
#endif
// Only need to keep track of child task counts if team parallel and tasking not
-// serialized or if it is a proxy task
-#if OMP_45_ENABLED
+// serialized or if it is a proxy or detachable task
if (flags->proxy == TASK_PROXY ||
+ flags->detachable == TASK_DETACHABLE ||
!(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser))
-#else
- if (!(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser))
-#endif
{
KMP_ATOMIC_INC(&parent_task->td_incomplete_child_tasks);
-#if OMP_40_ENABLED
if (parent_task->td_taskgroup)
KMP_ATOMIC_INC(&parent_task->td_taskgroup->count);
-#endif
// Only need to keep track of allocated child tasks for explicit tasks since
// implicit not deallocated
if (taskdata->td_parent->td_flags.tasktype == TASK_EXPLICIT) {
@@ -1378,18 +1362,12 @@ kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
input_flags->native = FALSE;
// __kmp_task_alloc() sets up all other runtime flags
-#if OMP_45_ENABLED
- KA_TRACE(10, ("__kmpc_omp_task_alloc(enter): T#%d loc=%p, flags=(%s %s) "
+ KA_TRACE(10, ("__kmpc_omp_task_alloc(enter): T#%d loc=%p, flags=(%s %s %s) "
"sizeof_task=%ld sizeof_shared=%ld entry=%p\n",
gtid, loc_ref, input_flags->tiedness ? "tied " : "untied",
- input_flags->proxy ? "proxy" : "", sizeof_kmp_task_t,
+ input_flags->proxy ? "proxy" : "",
+ input_flags->detachable ? "detachable" : "", sizeof_kmp_task_t,
sizeof_shareds, task_entry));
-#else
- KA_TRACE(10, ("__kmpc_omp_task_alloc(enter): T#%d loc=%p, flags=(%s) "
- "sizeof_task=%ld sizeof_shared=%ld entry=%p\n",
- gtid, loc_ref, input_flags->tiedness ? "tied " : "untied",
- sizeof_kmp_task_t, sizeof_shareds, task_entry));
-#endif
retval = __kmp_task_alloc(loc_ref, gtid, input_flags, sizeof_kmp_task_t,
sizeof_shareds, task_entry);
@@ -1399,7 +1377,16 @@ kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
return retval;
}
-#if OMP_50_ENABLED
+kmp_task_t *__kmpc_omp_target_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
+ kmp_int32 flags,
+ size_t sizeof_kmp_task_t,
+ size_t sizeof_shareds,
+ kmp_routine_entry_t task_entry,
+ kmp_int64 device_id) {
+ return __kmpc_omp_task_alloc(loc_ref, gtid, flags, sizeof_kmp_task_t,
+ sizeof_shareds, task_entry);
+}
+
/*!
@ingroup TASKING
@param loc_ref location of the original task directive
@@ -1419,7 +1406,6 @@ __kmpc_omp_reg_task_with_affinity(ident_t *loc_ref, kmp_int32 gtid,
kmp_task_affinity_info_t *affin_list) {
return 0;
}
-#endif
// __kmp_invoke_task: invoke the specified task
//
@@ -1430,14 +1416,11 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
kmp_taskdata_t *current_task) {
kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
kmp_info_t *thread;
-#if OMP_40_ENABLED
int discard = 0 /* false */;
-#endif
KA_TRACE(
30, ("__kmp_invoke_task(enter): T#%d invoking task %p, current_task=%p\n",
gtid, taskdata, current_task));
KMP_DEBUG_ASSERT(task);
-#if OMP_45_ENABLED
if (taskdata->td_flags.proxy == TASK_PROXY &&
taskdata->td_flags.complete == 1) {
// This is a proxy task that was already completed but it needs to run
@@ -1455,7 +1438,6 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
return;
}
-#endif
#if OMPT_SUPPORT
// For untied tasks, the first task executed only calls __kmpc_omp_task and
@@ -1473,17 +1455,12 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
}
#endif
-#if OMP_45_ENABLED
// Proxy tasks are not handled by the runtime
if (taskdata->td_flags.proxy != TASK_PROXY) {
-#endif
ANNOTATE_HAPPENS_AFTER(task);
__kmp_task_start(gtid, task, current_task); // OMPT only if not discarded
-#if OMP_45_ENABLED
}
-#endif
-#if OMP_40_ENABLED
// TODO: cancel tasks if the parallel region has also been cancelled
// TODO: check if this sequence can be hoisted above __kmp_task_start
// if cancellation has been enabled for this run ...
@@ -1541,7 +1518,6 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
break;
}
#endif // KMP_STATS_ENABLED
-#endif // OMP_40_ENABLED
// OMPT task begin
#if OMPT_SUPPORT
@@ -1581,15 +1557,11 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
}
#endif
-#if OMP_40_ENABLED
}
-#endif // OMP_40_ENABLED
-#if OMP_45_ENABLED
// Proxy tasks are not handled by the runtime
if (taskdata->td_flags.proxy != TASK_PROXY) {
-#endif
ANNOTATE_HAPPENS_BEFORE(taskdata->td_parent);
#if OMPT_SUPPORT
if (UNLIKELY(ompt_enabled.enabled)) {
@@ -1601,9 +1573,7 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
} else
#endif
__kmp_task_finish<false>(gtid, task, current_task);
-#if OMP_45_ENABLED
}
-#endif
KA_TRACE(
30,
@@ -1684,14 +1654,10 @@ kmp_int32 __kmp_omp_task(kmp_int32 gtid, kmp_task_t *new_task,
bool serialize_immediate) {
kmp_taskdata_t *new_taskdata = KMP_TASK_TO_TASKDATA(new_task);
-/* Should we execute the new task or queue it? For now, let's just always try to
- queue it. If the queue fills up, then we'll execute it. */
-#if OMP_45_ENABLED
+ /* Should we execute the new task or queue it? For now, let's just always try
+ to queue it. If the queue fills up, then we'll execute it. */
if (new_taskdata->td_flags.proxy == TASK_PROXY ||
__kmp_push_task(gtid, new_task) == TASK_NOT_PUSHED) // if cannot defer
-#else
- if (__kmp_push_task(gtid, new_task) == TASK_NOT_PUSHED) // if cannot defer
-#endif
{ // Execute this task immediately
kmp_taskdata_t *current_task = __kmp_threads[gtid]->th.th_current_task;
if (serialize_immediate)
@@ -1880,10 +1846,8 @@ static kmp_int32 __kmpc_omp_taskwait_template(ident_t *loc_ref, kmp_int32 gtid,
bool must_wait =
!taskdata->td_flags.team_serial && !taskdata->td_flags.final;
-#if OMP_45_ENABLED
must_wait = must_wait || (thread->th.th_task_team != NULL &&
thread->th.th_task_team->tt.tt_found_proxy_tasks);
-#endif
if (must_wait) {
kmp_flag_32 flag(RCAST(std::atomic<kmp_uint32> *,
&(taskdata->td_incomplete_child_tasks)),
@@ -2018,51 +1982,110 @@ kmp_int32 __kmpc_omp_taskyield(ident_t *loc_ref, kmp_int32 gtid, int end_part) {
return TASK_CURRENT_NOT_QUEUED;
}
-#if OMP_50_ENABLED
// Task Reduction implementation
+//
+// Note: initial implementation didn't take into account the possibility
+// to specify omp_orig for initializer of the UDR (user defined reduction).
+// Corrected implementation takes into account the omp_orig object.
+// Compiler is free to use old implementation if omp_orig is not specified.
-typedef struct kmp_task_red_flags {
- unsigned lazy_priv : 1; // hint: (1) use lazy allocation (big objects)
+/*!
+@ingroup BASIC_TYPES
+@{
+*/
+
+/*!
+Flags for special info per task reduction item.
+*/
+typedef struct kmp_taskred_flags {
+ /*! 1 - use lazy alloc/init (e.g. big objects, #tasks < #threads) */
+ unsigned lazy_priv : 1;
unsigned reserved31 : 31;
-} kmp_task_red_flags_t;
-
-// internal structure for reduction data item related info
-typedef struct kmp_task_red_data {
- void *reduce_shar; // shared reduction item
- size_t reduce_size; // size of data item
- void *reduce_priv; // thread specific data
- void *reduce_pend; // end of private data for comparison op
- void *reduce_init; // data initialization routine
- void *reduce_fini; // data finalization routine
- void *reduce_comb; // data combiner routine
- kmp_task_red_flags_t flags; // flags for additional info from compiler
-} kmp_task_red_data_t;
-
-// structure sent us by compiler - one per reduction item
+} kmp_taskred_flags_t;
+
+/*!
+Internal struct for reduction data item related info set up by compiler.
+*/
typedef struct kmp_task_red_input {
- void *reduce_shar; // shared reduction item
- size_t reduce_size; // size of data item
- void *reduce_init; // data initialization routine
- void *reduce_fini; // data finalization routine
- void *reduce_comb; // data combiner routine
- kmp_task_red_flags_t flags; // flags for additional info from compiler
+ void *reduce_shar; /**< shared between tasks item to reduce into */
+ size_t reduce_size; /**< size of data item in bytes */
+ // three compiler-generated routines (init, fini are optional):
+ void *reduce_init; /**< data initialization routine (single parameter) */
+ void *reduce_fini; /**< data finalization routine */
+ void *reduce_comb; /**< data combiner routine */
+ kmp_taskred_flags_t flags; /**< flags for additional info from compiler */
} kmp_task_red_input_t;
/*!
-@ingroup TASKING
-@param gtid Global thread ID
-@param num Number of data items to reduce
-@param data Array of data for reduction
-@return The taskgroup identifier
+Internal struct for reduction data item related info saved by the library.
+*/
+typedef struct kmp_taskred_data {
+ void *reduce_shar; /**< shared between tasks item to reduce into */
+ size_t reduce_size; /**< size of data item */
+ kmp_taskred_flags_t flags; /**< flags for additional info from compiler */
+ void *reduce_priv; /**< array of thread specific items */
+ void *reduce_pend; /**< end of private data for faster comparison op */
+ // three compiler-generated routines (init, fini are optional):
+ void *reduce_comb; /**< data combiner routine */
+ void *reduce_init; /**< data initialization routine (two parameters) */
+ void *reduce_fini; /**< data finalization routine */
+ void *reduce_orig; /**< original item (can be used in UDR initializer) */
+} kmp_taskred_data_t;
-Initialize task reduction for the taskgroup.
+/*!
+Internal struct for reduction data item related info set up by compiler.
+
+New interface: added reduce_orig field to provide omp_orig for UDR initializer.
*/
-void *__kmpc_task_reduction_init(int gtid, int num, void *data) {
+typedef struct kmp_taskred_input {
+ void *reduce_shar; /**< shared between tasks item to reduce into */
+ void *reduce_orig; /**< original reduction item used for initialization */
+ size_t reduce_size; /**< size of data item */
+ // three compiler-generated routines (init, fini are optional):
+ void *reduce_init; /**< data initialization routine (two parameters) */
+ void *reduce_fini; /**< data finalization routine */
+ void *reduce_comb; /**< data combiner routine */
+ kmp_taskred_flags_t flags; /**< flags for additional info from compiler */
+} kmp_taskred_input_t;
+/*!
+@}
+*/
+
+template <typename T> void __kmp_assign_orig(kmp_taskred_data_t &item, T &src);
+template <>
+void __kmp_assign_orig<kmp_task_red_input_t>(kmp_taskred_data_t &item,
+ kmp_task_red_input_t &src) {
+ item.reduce_orig = NULL;
+}
+template <>
+void __kmp_assign_orig<kmp_taskred_input_t>(kmp_taskred_data_t &item,
+ kmp_taskred_input_t &src) {
+ if (src.reduce_orig != NULL) {
+ item.reduce_orig = src.reduce_orig;
+ } else {
+ item.reduce_orig = src.reduce_shar;
+ } // non-NULL reduce_orig means new interface used
+}
+
+template <typename T> void __kmp_call_init(kmp_taskred_data_t &item, int j);
+template <>
+void __kmp_call_init<kmp_task_red_input_t>(kmp_taskred_data_t &item,
+ int offset) {
+ ((void (*)(void *))item.reduce_init)((char *)(item.reduce_priv) + offset);
+}
+template <>
+void __kmp_call_init<kmp_taskred_input_t>(kmp_taskred_data_t &item,
+ int offset) {
+ ((void (*)(void *, void *))item.reduce_init)(
+ (char *)(item.reduce_priv) + offset, item.reduce_orig);
+}
+
+template <typename T>
+void *__kmp_task_reduction_init(int gtid, int num, T *data) {
kmp_info_t *thread = __kmp_threads[gtid];
kmp_taskgroup_t *tg = thread->th.th_current_task->td_taskgroup;
kmp_int32 nth = thread->th.th_team_nproc;
- kmp_task_red_input_t *input = (kmp_task_red_input_t *)data;
- kmp_task_red_data_t *arr;
+ kmp_taskred_data_t *arr;
// check input data just in case
KMP_ASSERT(tg != NULL);
@@ -2075,33 +2098,34 @@ void *__kmpc_task_reduction_init(int gtid, int num, void *data) {
}
KA_TRACE(10, ("__kmpc_task_reduction_init: T#%d, taskgroup %p, #items %d\n",
gtid, tg, num));
- arr = (kmp_task_red_data_t *)__kmp_thread_malloc(
- thread, num * sizeof(kmp_task_red_data_t));
+ arr = (kmp_taskred_data_t *)__kmp_thread_malloc(
+ thread, num * sizeof(kmp_taskred_data_t));
for (int i = 0; i < num; ++i) {
- void (*f_init)(void *) = (void (*)(void *))(input[i].reduce_init);
- size_t size = input[i].reduce_size - 1;
+ size_t size = data[i].reduce_size - 1;
// round the size up to cache line per thread-specific item
size += CACHE_LINE - size % CACHE_LINE;
- KMP_ASSERT(input[i].reduce_comb != NULL); // combiner is mandatory
- arr[i].reduce_shar = input[i].reduce_shar;
+ KMP_ASSERT(data[i].reduce_comb != NULL); // combiner is mandatory
+ arr[i].reduce_shar = data[i].reduce_shar;
arr[i].reduce_size = size;
- arr[i].reduce_init = input[i].reduce_init;
- arr[i].reduce_fini = input[i].reduce_fini;
- arr[i].reduce_comb = input[i].reduce_comb;
- arr[i].flags = input[i].flags;
- if (!input[i].flags.lazy_priv) {
+ arr[i].flags = data[i].flags;
+ arr[i].reduce_comb = data[i].reduce_comb;
+ arr[i].reduce_init = data[i].reduce_init;
+ arr[i].reduce_fini = data[i].reduce_fini;
+ __kmp_assign_orig<T>(arr[i], data[i]);
+ if (!arr[i].flags.lazy_priv) {
// allocate cache-line aligned block and fill it with zeros
arr[i].reduce_priv = __kmp_allocate(nth * size);
arr[i].reduce_pend = (char *)(arr[i].reduce_priv) + nth * size;
- if (f_init != NULL) {
- // initialize thread-specific items
+ if (arr[i].reduce_init != NULL) {
+ // initialize all thread-specific items
for (int j = 0; j < nth; ++j) {
- f_init((char *)(arr[i].reduce_priv) + j * size);
+ __kmp_call_init<T>(arr[i], j * size);
}
}
} else {
// only allocate space for pointers now,
- // objects will be lazily allocated/initialized once requested
+ // objects will be lazily allocated/initialized if/when requested
+ // note that __kmp_allocate zeroes the allocated memory
arr[i].reduce_priv = __kmp_allocate(nth * sizeof(void *));
}
}
@@ -2112,6 +2136,59 @@ void *__kmpc_task_reduction_init(int gtid, int num, void *data) {
/*!
@ingroup TASKING
+@param gtid Global thread ID
+@param num Number of data items to reduce
+@param data Array of data for reduction
+@return The taskgroup identifier
+
+Initialize task reduction for the taskgroup.
+
+Note: this entry supposes the optional compiler-generated initializer routine
+has single parameter - pointer to object to be initialized. That means
+the reduction either does not use omp_orig object, or the omp_orig is accessible
+without help of the runtime library.
+*/
+void *__kmpc_task_reduction_init(int gtid, int num, void *data) {
+ return __kmp_task_reduction_init(gtid, num, (kmp_task_red_input_t *)data);
+}
+
+/*!
+@ingroup TASKING
+@param gtid Global thread ID
+@param num Number of data items to reduce
+@param data Array of data for reduction
+@return The taskgroup identifier
+
+Initialize task reduction for the taskgroup.
+
+Note: this entry supposes the optional compiler-generated initializer routine
+has two parameters, pointer to object to be initialized and pointer to omp_orig
+*/
+void *__kmpc_taskred_init(int gtid, int num, void *data) {
+ return __kmp_task_reduction_init(gtid, num, (kmp_taskred_input_t *)data);
+}
+
+// Copy task reduction data (except for shared pointers).
+template <typename T>
+void __kmp_task_reduction_init_copy(kmp_info_t *thr, int num, T *data,
+ kmp_taskgroup_t *tg, void *reduce_data) {
+ kmp_taskred_data_t *arr;
+ KA_TRACE(20, ("__kmp_task_reduction_init_copy: Th %p, init taskgroup %p,"
+ " from data %p\n",
+ thr, tg, reduce_data));
+ arr = (kmp_taskred_data_t *)__kmp_thread_malloc(
+ thr, num * sizeof(kmp_taskred_data_t));
+ // threads will share private copies, thunk routines, sizes, flags, etc.:
+ KMP_MEMCPY(arr, reduce_data, num * sizeof(kmp_taskred_data_t));
+ for (int i = 0; i < num; ++i) {
+ arr[i].reduce_shar = data[i].reduce_shar; // init unique shared pointers
+ }
+ tg->reduce_data = (void *)arr;
+ tg->reduce_num_data = num;
+}
+
+/*!
+@ingroup TASKING
@param gtid Global thread ID
@param tskgrp The taskgroup ID (optional)
@param data Shared location of the item
@@ -2129,7 +2206,7 @@ void *__kmpc_task_reduction_get_th_data(int gtid, void *tskgrp, void *data) {
if (tg == NULL)
tg = thread->th.th_current_task->td_taskgroup;
KMP_ASSERT(tg != NULL);
- kmp_task_red_data_t *arr = (kmp_task_red_data_t *)(tg->reduce_data);
+ kmp_taskred_data_t *arr = (kmp_taskred_data_t *)(tg->reduce_data);
kmp_int32 num = tg->reduce_num_data;
kmp_int32 tid = thread->th.th_info.ds.ds_tid;
@@ -2153,17 +2230,21 @@ void *__kmpc_task_reduction_get_th_data(int gtid, void *tskgrp, void *data) {
found:
if (p_priv[tid] == NULL) {
// allocate thread specific object lazily
- void (*f_init)(void *) = (void (*)(void *))(arr[i].reduce_init);
p_priv[tid] = __kmp_allocate(arr[i].reduce_size);
- if (f_init != NULL) {
- f_init(p_priv[tid]);
+ if (arr[i].reduce_init != NULL) {
+ if (arr[i].reduce_orig != NULL) { // new interface
+ ((void (*)(void *, void *))arr[i].reduce_init)(
+ p_priv[tid], arr[i].reduce_orig);
+ } else { // old interface (single parameter)
+ ((void (*)(void *))arr[i].reduce_init)(p_priv[tid]);
+ }
}
}
return p_priv[tid];
}
}
tg = tg->parent;
- arr = (kmp_task_red_data_t *)(tg->reduce_data);
+ arr = (kmp_taskred_data_t *)(tg->reduce_data);
num = tg->reduce_num_data;
}
KMP_ASSERT2(0, "Unknown task reduction item");
@@ -2175,7 +2256,7 @@ void *__kmpc_task_reduction_get_th_data(int gtid, void *tskgrp, void *data) {
static void __kmp_task_reduction_fini(kmp_info_t *th, kmp_taskgroup_t *tg) {
kmp_int32 nth = th->th.th_team_nproc;
KMP_DEBUG_ASSERT(nth > 1); // should not be called if nth == 1
- kmp_task_red_data_t *arr = (kmp_task_red_data_t *)tg->reduce_data;
+ kmp_taskred_data_t *arr = (kmp_taskred_data_t *)tg->reduce_data;
kmp_int32 num = tg->reduce_num_data;
for (int i = 0; i < num; ++i) {
void *sh_data = arr[i].reduce_shar;
@@ -2208,9 +2289,112 @@ static void __kmp_task_reduction_fini(kmp_info_t *th, kmp_taskgroup_t *tg) {
tg->reduce_data = NULL;
tg->reduce_num_data = 0;
}
-#endif
-#if OMP_40_ENABLED
+// Cleanup task reduction data for parallel or worksharing,
+// do not touch task private data other threads still working with.
+// Called from __kmpc_end_taskgroup()
+static void __kmp_task_reduction_clean(kmp_info_t *th, kmp_taskgroup_t *tg) {
+ __kmp_thread_free(th, tg->reduce_data);
+ tg->reduce_data = NULL;
+ tg->reduce_num_data = 0;
+}
+
+template <typename T>
+void *__kmp_task_reduction_modifier_init(ident_t *loc, int gtid, int is_ws,
+ int num, T *data) {
+ kmp_info_t *thr = __kmp_threads[gtid];
+ kmp_int32 nth = thr->th.th_team_nproc;
+ __kmpc_taskgroup(loc, gtid); // form new taskgroup first
+ if (nth == 1) {
+ KA_TRACE(10,
+ ("__kmpc_reduction_modifier_init: T#%d, tg %p, exiting nth=1\n",
+ gtid, thr->th.th_current_task->td_taskgroup));
+ return (void *)thr->th.th_current_task->td_taskgroup;
+ }
+ kmp_team_t *team = thr->th.th_team;
+ void *reduce_data;
+ kmp_taskgroup_t *tg;
+ reduce_data = KMP_ATOMIC_LD_RLX(&team->t.t_tg_reduce_data[is_ws]);
+ if (reduce_data == NULL &&
+ __kmp_atomic_compare_store(&team->t.t_tg_reduce_data[is_ws], reduce_data,
+ (void *)1)) {
+ // single thread enters this block to initialize common reduction data
+ KMP_DEBUG_ASSERT(reduce_data == NULL);
+ // first initialize own data, then make a copy other threads can use
+ tg = (kmp_taskgroup_t *)__kmp_task_reduction_init<T>(gtid, num, data);
+ reduce_data = __kmp_thread_malloc(thr, num * sizeof(kmp_taskred_data_t));
+ KMP_MEMCPY(reduce_data, tg->reduce_data, num * sizeof(kmp_taskred_data_t));
+ // fini counters should be 0 at this point
+ KMP_DEBUG_ASSERT(KMP_ATOMIC_LD_RLX(&team->t.t_tg_fini_counter[0]) == 0);
+ KMP_DEBUG_ASSERT(KMP_ATOMIC_LD_RLX(&team->t.t_tg_fini_counter[1]) == 0);
+ KMP_ATOMIC_ST_REL(&team->t.t_tg_reduce_data[is_ws], reduce_data);
+ } else {
+ while (
+ (reduce_data = KMP_ATOMIC_LD_ACQ(&team->t.t_tg_reduce_data[is_ws])) ==
+ (void *)1) { // wait for task reduction initialization
+ KMP_CPU_PAUSE();
+ }
+ KMP_DEBUG_ASSERT(reduce_data > (void *)1); // should be valid pointer here
+ tg = thr->th.th_current_task->td_taskgroup;
+ __kmp_task_reduction_init_copy<T>(thr, num, data, tg, reduce_data);
+ }
+ return tg;
+}
+
+/*!
+@ingroup TASKING
+@param loc Source location info
+@param gtid Global thread ID
+@param is_ws Is 1 if the reduction is for worksharing, 0 otherwise
+@param num Number of data items to reduce
+@param data Array of data for reduction
+@return The taskgroup identifier
+
+Initialize task reduction for a parallel or worksharing.
+
+Note: this entry supposes the optional compiler-generated initializer routine
+has single parameter - pointer to object to be initialized. That means
+the reduction either does not use omp_orig object, or the omp_orig is accessible
+without help of the runtime library.
+*/
+void *__kmpc_task_reduction_modifier_init(ident_t *loc, int gtid, int is_ws,
+ int num, void *data) {
+ return __kmp_task_reduction_modifier_init(loc, gtid, is_ws, num,
+ (kmp_task_red_input_t *)data);
+}
+
+/*!
+@ingroup TASKING
+@param loc Source location info
+@param gtid Global thread ID
+@param is_ws Is 1 if the reduction is for worksharing, 0 otherwise
+@param num Number of data items to reduce
+@param data Array of data for reduction
+@return The taskgroup identifier
+
+Initialize task reduction for a parallel or worksharing.
+
+Note: this entry supposes the optional compiler-generated initializer routine
+has two parameters, pointer to object to be initialized and pointer to omp_orig
+*/
+void *__kmpc_taskred_modifier_init(ident_t *loc, int gtid, int is_ws, int num,
+ void *data) {
+ return __kmp_task_reduction_modifier_init(loc, gtid, is_ws, num,
+ (kmp_taskred_input_t *)data);
+}
+
+/*!
+@ingroup TASKING
+@param loc Source location info
+@param gtid Global thread ID
+@param is_ws Is 1 if the reduction is for worksharing, 0 otherwise
+
+Finalize task reduction for a parallel or worksharing.
+*/
+void __kmpc_task_reduction_modifier_fini(ident_t *loc, int gtid, int is_ws) {
+ __kmpc_end_taskgroup(loc, gtid);
+}
+
// __kmpc_taskgroup: Start a new taskgroup
void __kmpc_taskgroup(ident_t *loc, int gtid) {
kmp_info_t *thread = __kmp_threads[gtid];
@@ -2221,10 +2405,8 @@ void __kmpc_taskgroup(ident_t *loc, int gtid) {
KMP_ATOMIC_ST_RLX(&tg_new->count, 0);
KMP_ATOMIC_ST_RLX(&tg_new->cancel_request, cancel_noreq);
tg_new->parent = taskdata->td_taskgroup;
-#if OMP_50_ENABLED
tg_new->reduce_data = NULL;
tg_new->reduce_num_data = 0;
-#endif
taskdata->td_taskgroup = tg_new;
#if OMPT_SUPPORT && OMPT_OPTIONAL
@@ -2293,14 +2475,9 @@ void __kmpc_end_taskgroup(ident_t *loc, int gtid) {
}
#endif
-#if OMP_45_ENABLED
if (!taskdata->td_flags.team_serial ||
(thread->th.th_task_team != NULL &&
- thread->th.th_task_team->tt.tt_found_proxy_tasks))
-#else
- if (!taskdata->td_flags.team_serial)
-#endif
- {
+ thread->th.th_task_team->tt.tt_found_proxy_tasks)) {
kmp_flag_32 flag(RCAST(std::atomic<kmp_uint32> *, &(taskgroup->count)),
0U);
while (KMP_ATOMIC_LD_ACQ(&taskgroup->count) != 0) {
@@ -2326,10 +2503,54 @@ void __kmpc_end_taskgroup(ident_t *loc, int gtid) {
}
KMP_DEBUG_ASSERT(taskgroup->count == 0);
-#if OMP_50_ENABLED
- if (taskgroup->reduce_data != NULL) // need to reduce?
- __kmp_task_reduction_fini(thread, taskgroup);
-#endif
+ if (taskgroup->reduce_data != NULL) { // need to reduce?
+ int cnt;
+ void *reduce_data;
+ kmp_team_t *t = thread->th.th_team;
+ kmp_taskred_data_t *arr = (kmp_taskred_data_t *)taskgroup->reduce_data;
+ // check if <priv> data of the first reduction variable shared for the team
+ void *priv0 = arr[0].reduce_priv;
+ if ((reduce_data = KMP_ATOMIC_LD_ACQ(&t->t.t_tg_reduce_data[0])) != NULL &&
+ ((kmp_taskred_data_t *)reduce_data)[0].reduce_priv == priv0) {
+ // finishing task reduction on parallel
+ cnt = KMP_ATOMIC_INC(&t->t.t_tg_fini_counter[0]);
+ if (cnt == thread->th.th_team_nproc - 1) {
+ // we are the last thread passing __kmpc_reduction_modifier_fini()
+ // finalize task reduction:
+ __kmp_task_reduction_fini(thread, taskgroup);
+ // cleanup fields in the team structure:
+ // TODO: is relaxed store enough here (whole barrier should follow)?
+ __kmp_thread_free(thread, reduce_data);
+ KMP_ATOMIC_ST_REL(&t->t.t_tg_reduce_data[0], NULL);
+ KMP_ATOMIC_ST_REL(&t->t.t_tg_fini_counter[0], 0);
+ } else {
+ // we are not the last thread passing __kmpc_reduction_modifier_fini(),
+ // so do not finalize reduction, just clean own copy of the data
+ __kmp_task_reduction_clean(thread, taskgroup);
+ }
+ } else if ((reduce_data = KMP_ATOMIC_LD_ACQ(&t->t.t_tg_reduce_data[1])) !=
+ NULL &&
+ ((kmp_taskred_data_t *)reduce_data)[0].reduce_priv == priv0) {
+ // finishing task reduction on worksharing
+ cnt = KMP_ATOMIC_INC(&t->t.t_tg_fini_counter[1]);
+ if (cnt == thread->th.th_team_nproc - 1) {
+ // we are the last thread passing __kmpc_reduction_modifier_fini()
+ __kmp_task_reduction_fini(thread, taskgroup);
+ // cleanup fields in team structure:
+ // TODO: is relaxed store enough here (whole barrier should follow)?
+ __kmp_thread_free(thread, reduce_data);
+ KMP_ATOMIC_ST_REL(&t->t.t_tg_reduce_data[1], NULL);
+ KMP_ATOMIC_ST_REL(&t->t.t_tg_fini_counter[1], 0);
+ } else {
+ // we are not the last thread passing __kmpc_reduction_modifier_fini(),
+ // so do not finalize reduction, just clean own copy of the data
+ __kmp_task_reduction_clean(thread, taskgroup);
+ }
+ } else {
+ // finishing task reduction on taskgroup
+ __kmp_task_reduction_fini(thread, taskgroup);
+ }
+ }
// Restore parent taskgroup for the current task
taskdata->td_taskgroup = taskgroup->parent;
__kmp_thread_free(thread, taskgroup);
@@ -2346,7 +2567,6 @@ void __kmpc_end_taskgroup(ident_t *loc, int gtid) {
}
#endif
}
-#endif
// __kmp_remove_my_task: remove a task from my own deque
static kmp_task_t *__kmp_remove_my_task(kmp_info_t *thread, kmp_int32 gtid,
@@ -2589,11 +2809,7 @@ static inline int __kmp_execute_tasks_template(
nthreads = task_team->tt.tt_nproc;
unfinished_threads = &(task_team->tt.tt_unfinished_threads);
-#if OMP_45_ENABLED
KMP_DEBUG_ASSERT(nthreads > 1 || task_team->tt.tt_found_proxy_tasks);
-#else
- KMP_DEBUG_ASSERT(nthreads > 1);
-#endif
KMP_DEBUG_ASSERT(*unfinished_threads >= 0);
while (1) { // Outer loop keeps trying to find tasks in case of single thread
@@ -2706,8 +2922,7 @@ static inline int __kmp_execute_tasks_template(
if (thread->th.th_task_team == NULL) {
break;
}
- // Yield before executing next task
- KMP_YIELD(__kmp_library == library_throughput);
+ KMP_YIELD(__kmp_library == library_throughput); // Yield before next task
// If execution of a stolen task results in more tasks being placed on our
// run queue, reset use_own_tasks
if (!use_own_tasks && TCR_4(threads_data[tid].td.td_deque_ntasks) != 0) {
@@ -2719,17 +2934,11 @@ static inline int __kmp_execute_tasks_template(
}
}
-// The task source has been exhausted. If in final spin loop of barrier, check
-// if termination condition is satisfied.
-#if OMP_45_ENABLED
- // The work queue may be empty but there might be proxy tasks still
- // executing
+ // The task source has been exhausted. If in final spin loop of barrier,
+ // check if termination condition is satisfied. The work queue may be empty
+ // but there might be proxy tasks still executing.
if (final_spin &&
- KMP_ATOMIC_LD_ACQ(&current_task->td_incomplete_child_tasks) == 0)
-#else
- if (final_spin)
-#endif
- {
+ KMP_ATOMIC_LD_ACQ(&current_task->td_incomplete_child_tasks) == 0) {
// First, decrement the #unfinished threads, if that has not already been
// done. This decrement might be to the spin location, and result in the
// termination condition being satisfied.
@@ -2765,14 +2974,11 @@ static inline int __kmp_execute_tasks_template(
return FALSE;
}
-#if OMP_45_ENABLED
// We could be getting tasks from target constructs; if this is the only
// thread, keep trying to execute tasks from own queue
if (nthreads == 1)
use_own_tasks = 1;
- else
-#endif
- {
+ else {
KA_TRACE(15,
("__kmp_execute_tasks_template: T#%d can't find work\n", gtid));
return FALSE;
@@ -2839,7 +3045,7 @@ static void __kmp_enable_tasking(kmp_task_team_t *task_team,
threads_data = (kmp_thread_data_t *)TCR_PTR(task_team->tt.tt_threads_data);
KMP_DEBUG_ASSERT(threads_data != NULL);
- if ((__kmp_tasking_mode == tskm_task_teams) &&
+ if (__kmp_tasking_mode == tskm_task_teams &&
(__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME)) {
// Release any threads sleeping at the barrier, so that they can steal
// tasks and execute them. In extra barrier mode, tasks do not sleep
@@ -2895,12 +3101,8 @@ static void __kmp_enable_tasking(kmp_task_team_t *task_team,
* exit __kmp_<barrier_kind>_release at the next barrier. I.e. the lifetimes
* of the kmp_task_team_t structs for consecutive barriers can overlap
* (and will, unless the master thread is the last thread to exit the barrier
- * release phase, which is not typical).
- *
- * The existence of such a struct is useful outside the context of tasking,
- * but for now, I'm trying to keep it specific to the OMP_30_ENABLED macro,
- * so that any performance differences show up when comparing the 2.5 vs. 3.0
- * libraries.
+ * release phase, which is not typical). The existence of such a struct is
+ * useful outside the context of tasking.
*
* We currently use the existence of the threads array as an indicator that
* tasks were spawned since the last barrier. If the structure is to be
@@ -3129,9 +3331,7 @@ static kmp_task_team_t *__kmp_allocate_task_team(kmp_info_t *thread,
}
TCW_4(task_team->tt.tt_found_tasks, FALSE);
-#if OMP_45_ENABLED
TCW_4(task_team->tt.tt_found_proxy_tasks, FALSE);
-#endif
task_team->tt.tt_nproc = nthreads = team->t.t_nproc;
KMP_ATOMIC_ST_REL(&task_team->tt.tt_unfinished_threads, nthreads);
@@ -3243,10 +3443,8 @@ void __kmp_wait_to_unref_task_teams(void) {
break;
}
- // If we are oversubscribed, or have waited a bit (and library mode is
- // throughput), yield. Pause is in the following code.
- KMP_YIELD(TCR_4(__kmp_nth) > __kmp_avail_proc);
- KMP_YIELD_SPIN(spins); // Yields only if KMP_LIBRARY=throughput
+ // If oversubscribed or have waited a bit, yield.
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
}
}
@@ -3295,9 +3493,7 @@ void __kmp_task_team_setup(kmp_info_t *this_thr, kmp_team_t *team, int always) {
team->t.t_nproc != task_team->tt.tt_nproc) {
TCW_4(task_team->tt.tt_nproc, team->t.t_nproc);
TCW_4(task_team->tt.tt_found_tasks, FALSE);
-#if OMP_45_ENABLED
TCW_4(task_team->tt.tt_found_proxy_tasks, FALSE);
-#endif
KMP_ATOMIC_ST_REL(&task_team->tt.tt_unfinished_threads,
team->t.t_nproc);
TCW_4(task_team->tt.tt_active, TRUE);
@@ -3368,13 +3564,9 @@ void __kmp_task_team_wait(
("__kmp_task_team_wait: Master T#%d deactivating task_team %p: "
"setting active to false, setting local and team's pointer to NULL\n",
__kmp_gtid_from_thread(this_thr), task_team));
-#if OMP_45_ENABLED
KMP_DEBUG_ASSERT(task_team->tt.tt_nproc > 1 ||
task_team->tt.tt_found_proxy_tasks == TRUE);
TCW_SYNC_4(task_team->tt.tt_found_proxy_tasks, FALSE);
-#else
- KMP_DEBUG_ASSERT(task_team->tt.tt_nproc > 1);
-#endif
KMP_CHECK_UPDATE(task_team->tt.tt_untied_task_encountered, 0);
TCW_SYNC_4(task_team->tt.tt_active, FALSE);
KMP_MB();
@@ -3411,15 +3603,13 @@ void __kmp_tasking_barrier(kmp_team_t *team, kmp_info_t *thread, int gtid) {
__kmp_abort_thread();
break;
}
- KMP_YIELD(TRUE); // GH: We always yield here
+ KMP_YIELD(TRUE);
}
#if USE_ITT_BUILD
KMP_FSYNC_SPIN_ACQUIRED(RCAST(void *, spin));
#endif /* USE_ITT_BUILD */
}
-#if OMP_45_ENABLED
-
// __kmp_give_task puts a task into a given thread queue if:
// - the queue for that thread was created
// - there's space in that queue
@@ -3639,6 +3829,56 @@ void __kmpc_proxy_task_completed_ooo(kmp_task_t *ptask) {
taskdata));
}
+kmp_event_t *__kmpc_task_allow_completion_event(ident_t *loc_ref, int gtid,
+ kmp_task_t *task) {
+ kmp_taskdata_t *td = KMP_TASK_TO_TASKDATA(task);
+ if (td->td_allow_completion_event.type == KMP_EVENT_UNINITIALIZED) {
+ td->td_allow_completion_event.type = KMP_EVENT_ALLOW_COMPLETION;
+ td->td_allow_completion_event.ed.task = task;
+ __kmp_init_tas_lock(&td->td_allow_completion_event.lock);
+ }
+ return &td->td_allow_completion_event;
+}
+
+void __kmp_fulfill_event(kmp_event_t *event) {
+ if (event->type == KMP_EVENT_ALLOW_COMPLETION) {
+ kmp_task_t *ptask = event->ed.task;
+ kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(ptask);
+ bool detached = false;
+ int gtid = __kmp_get_gtid();
+
+ if (taskdata->td_flags.proxy == TASK_PROXY) {
+ // The associated task code completed before this call and detached.
+ detached = true;
+ event->type = KMP_EVENT_UNINITIALIZED;
+ } else {
+ // The associated task has not completed but could be completing at this
+ // point.
+ // We need to take the lock to avoid races
+ __kmp_acquire_tas_lock(&event->lock, gtid);
+ if (taskdata->td_flags.proxy == TASK_PROXY)
+ detached = true;
+ event->type = KMP_EVENT_UNINITIALIZED;
+ __kmp_release_tas_lock(&event->lock, gtid);
+ }
+
+ if (detached) {
+ // If the task detached complete the proxy task
+ if (gtid >= 0) {
+ kmp_team_t *team = taskdata->td_team;
+ kmp_info_t *thread = __kmp_get_thread();
+ if (thread->th.th_team == team) {
+ __kmpc_proxy_task_completed(gtid, ptask);
+ return;
+ }
+ }
+
+ // fallback
+ __kmpc_proxy_task_completed_ooo(ptask);
+ }
+ }
+}
+
// __kmp_task_dup_alloc: Allocate the taskdata and make a copy of source task
// for taskloop
//
@@ -4206,6 +4446,7 @@ void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
case 0: // no schedule clause specified, we can choose the default
// let's try to schedule (team_size*10) tasks
grainsize = thread->th.th_team_nproc * 10;
+ KMP_FALLTHROUGH();
case 2: // num_tasks provided
if (grainsize > tc) {
num_tasks = tc; // too big num_tasks requested, adjust values
@@ -4289,5 +4530,3 @@ void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
}
KA_TRACE(20, ("__kmpc_taskloop(exit): T#%d\n", gtid));
}
-
-#endif
diff --git a/runtime/src/kmp_taskq.cpp b/runtime/src/kmp_taskq.cpp
index 6e8f2d556eff..e69de29bb2d1 100644
--- a/runtime/src/kmp_taskq.cpp
+++ b/runtime/src/kmp_taskq.cpp
@@ -1,2029 +0,0 @@
-/*
- * kmp_taskq.cpp -- TASKQ support for OpenMP.
- */
-
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "kmp.h"
-#include "kmp_error.h"
-#include "kmp_i18n.h"
-#include "kmp_io.h"
-
-#define MAX_MESSAGE 512
-
-/* Taskq routines and global variables */
-
-#define KMP_DEBUG_REF_CTS(x) KF_TRACE(1, x);
-
-#define THREAD_ALLOC_FOR_TASKQ
-
-static int in_parallel_context(kmp_team_t *team) {
- return !team->t.t_serialized;
-}
-
-static void __kmp_taskq_eo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
- int gtid = *gtid_ref;
- int tid = __kmp_tid_from_gtid(gtid);
- kmp_uint32 my_token;
- kmpc_task_queue_t *taskq;
- kmp_taskq_t *tq = &__kmp_threads[gtid]->th.th_team->t.t_taskq;
-
- if (__kmp_env_consistency_check)
-#if KMP_USE_DYNAMIC_LOCK
- __kmp_push_sync(gtid, ct_ordered_in_taskq, loc_ref, NULL, 0);
-#else
- __kmp_push_sync(gtid, ct_ordered_in_taskq, loc_ref, NULL);
-#endif
-
- if (!__kmp_threads[gtid]->th.th_team->t.t_serialized) {
- KMP_MB(); /* Flush all pending memory write invalidates. */
-
- /* GEH - need check here under stats to make sure */
- /* inside task (curr_thunk[*tid_ref] != NULL) */
-
- my_token = tq->tq_curr_thunk[tid]->th_tasknum;
-
- taskq = tq->tq_curr_thunk[tid]->th.th_shareds->sv_queue;
-
- KMP_WAIT_YIELD(&taskq->tq_tasknum_serving, my_token, KMP_EQ, NULL);
- KMP_MB();
- }
-}
-
-static void __kmp_taskq_xo(int *gtid_ref, int *cid_ref, ident_t *loc_ref) {
- int gtid = *gtid_ref;
- int tid = __kmp_tid_from_gtid(gtid);
- kmp_uint32 my_token;
- kmp_taskq_t *tq = &__kmp_threads[gtid]->th.th_team->t.t_taskq;
-
- if (__kmp_env_consistency_check)
- __kmp_pop_sync(gtid, ct_ordered_in_taskq, loc_ref);
-
- if (!__kmp_threads[gtid]->th.th_team->t.t_serialized) {
- KMP_MB(); /* Flush all pending memory write invalidates. */
-
- /* GEH - need check here under stats to make sure */
- /* inside task (curr_thunk[tid] != NULL) */
-
- my_token = tq->tq_curr_thunk[tid]->th_tasknum;
-
- KMP_MB(); /* Flush all pending memory write invalidates. */
-
- tq->tq_curr_thunk[tid]->th.th_shareds->sv_queue->tq_tasknum_serving =
- my_token + 1;
-
- KMP_MB(); /* Flush all pending memory write invalidates. */
- }
-}
-
-static void __kmp_taskq_check_ordered(kmp_int32 gtid, kmpc_thunk_t *thunk) {
- kmp_uint32 my_token;
- kmpc_task_queue_t *taskq;
-
- /* assume we are always called from an active parallel context */
-
- KMP_MB(); /* Flush all pending memory write invalidates. */
-
- my_token = thunk->th_tasknum;
-
- taskq = thunk->th.th_shareds->sv_queue;
-
- if (taskq->tq_tasknum_serving <= my_token) {
- KMP_WAIT_YIELD(&taskq->tq_tasknum_serving, my_token, KMP_GE, NULL);
- KMP_MB();
- taskq->tq_tasknum_serving = my_token + 1;
- KMP_MB();
- }
-}
-
-#ifdef KMP_DEBUG
-
-static void __kmp_dump_TQF(kmp_int32 flags) {
- if (flags & TQF_IS_ORDERED)
- __kmp_printf("ORDERED ");
- if (flags & TQF_IS_LASTPRIVATE)
- __kmp_printf("LAST_PRIV ");
- if (flags & TQF_IS_NOWAIT)
- __kmp_printf("NOWAIT ");
- if (flags & TQF_HEURISTICS)
- __kmp_printf("HEURIST ");
- if (flags & TQF_INTERFACE_RESERVED1)
- __kmp_printf("RESERV1 ");
- if (flags & TQF_INTERFACE_RESERVED2)
- __kmp_printf("RESERV2 ");
- if (flags & TQF_INTERFACE_RESERVED3)
- __kmp_printf("RESERV3 ");
- if (flags & TQF_INTERFACE_RESERVED4)
- __kmp_printf("RESERV4 ");
- if (flags & TQF_IS_LAST_TASK)
- __kmp_printf("LAST_TASK ");
- if (flags & TQF_TASKQ_TASK)
- __kmp_printf("TASKQ_TASK ");
- if (flags & TQF_RELEASE_WORKERS)
- __kmp_printf("RELEASE ");
- if (flags & TQF_ALL_TASKS_QUEUED)
- __kmp_printf("ALL_QUEUED ");
- if (flags & TQF_PARALLEL_CONTEXT)
- __kmp_printf("PARALLEL ");
- if (flags & TQF_DEALLOCATED)
- __kmp_printf("DEALLOC ");
- if (!(flags & (TQF_INTERNAL_FLAGS | TQF_INTERFACE_FLAGS)))
- __kmp_printf("(NONE)");
-}
-
-static void __kmp_dump_thunk(kmp_taskq_t *tq, kmpc_thunk_t *thunk,
- kmp_int32 global_tid) {
- int i;
- int nproc = __kmp_threads[global_tid]->th.th_team->t.t_nproc;
-
- __kmp_printf("\tThunk at %p on (%d): ", thunk, global_tid);
-
- if (thunk != NULL) {
- for (i = 0; i < nproc; i++) {
- if (tq->tq_curr_thunk[i] == thunk) {
- __kmp_printf("[%i] ", i);
- }
- }
- __kmp_printf("th_shareds=%p, ", thunk->th.th_shareds);
- __kmp_printf("th_task=%p, ", thunk->th_task);
- __kmp_printf("th_encl_thunk=%p, ", thunk->th_encl_thunk);
- __kmp_printf("th_status=%d, ", thunk->th_status);
- __kmp_printf("th_tasknum=%u, ", thunk->th_tasknum);
- __kmp_printf("th_flags=");
- __kmp_dump_TQF(thunk->th_flags);
- }
-
- __kmp_printf("\n");
-}
-
-static void __kmp_dump_thunk_stack(kmpc_thunk_t *thunk, kmp_int32 thread_num) {
- kmpc_thunk_t *th;
-
- __kmp_printf(" Thunk stack for T#%d: ", thread_num);
-
- for (th = thunk; th != NULL; th = th->th_encl_thunk)
- __kmp_printf("%p ", th);
-
- __kmp_printf("\n");
-}
-
-static void __kmp_dump_task_queue(kmp_taskq_t *tq, kmpc_task_queue_t *queue,
- kmp_int32 global_tid) {
- int qs, count, i;
- kmpc_thunk_t *thunk;
- kmpc_task_queue_t *taskq;
-
- __kmp_printf("Task Queue at %p on (%d):\n", queue, global_tid);
-
- if (queue != NULL) {
- int in_parallel = queue->tq_flags & TQF_PARALLEL_CONTEXT;
-
- if (__kmp_env_consistency_check) {
- __kmp_printf(" tq_loc : ");
- }
- if (in_parallel) {
-
- // if (queue->tq.tq_parent != 0)
- //__kmp_acquire_lock(& queue->tq.tq_parent->tq_link_lck, global_tid);
-
- //__kmp_acquire_lock(& queue->tq_link_lck, global_tid);
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- __kmp_printf(" tq_parent : %p\n", queue->tq.tq_parent);
- __kmp_printf(" tq_first_child : %p\n", queue->tq_first_child);
- __kmp_printf(" tq_next_child : %p\n", queue->tq_next_child);
- __kmp_printf(" tq_prev_child : %p\n", queue->tq_prev_child);
- __kmp_printf(" tq_ref_count : %d\n", queue->tq_ref_count);
-
- //__kmp_release_lock(& queue->tq_link_lck, global_tid);
-
- // if (queue->tq.tq_parent != 0)
- //__kmp_release_lock(& queue->tq.tq_parent->tq_link_lck, global_tid);
-
- //__kmp_acquire_lock(& queue->tq_free_thunks_lck, global_tid);
- //__kmp_acquire_lock(& queue->tq_queue_lck, global_tid);
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
- }
-
- __kmp_printf(" tq_shareds : ");
- for (i = 0; i < ((queue == tq->tq_root) ? queue->tq_nproc : 1); i++)
- __kmp_printf("%p ", queue->tq_shareds[i].ai_data);
- __kmp_printf("\n");
-
- if (in_parallel) {
- __kmp_printf(" tq_tasknum_queuing : %u\n", queue->tq_tasknum_queuing);
- __kmp_printf(" tq_tasknum_serving : %u\n", queue->tq_tasknum_serving);
- }
-
- __kmp_printf(" tq_queue : %p\n", queue->tq_queue);
- __kmp_printf(" tq_thunk_space : %p\n", queue->tq_thunk_space);
- __kmp_printf(" tq_taskq_slot : %p\n", queue->tq_taskq_slot);
-
- __kmp_printf(" tq_free_thunks : ");
- for (thunk = queue->tq_free_thunks; thunk != NULL;
- thunk = thunk->th.th_next_free)
- __kmp_printf("%p ", thunk);
- __kmp_printf("\n");
-
- __kmp_printf(" tq_nslots : %d\n", queue->tq_nslots);
- __kmp_printf(" tq_head : %d\n", queue->tq_head);
- __kmp_printf(" tq_tail : %d\n", queue->tq_tail);
- __kmp_printf(" tq_nfull : %d\n", queue->tq_nfull);
- __kmp_printf(" tq_hiwat : %d\n", queue->tq_hiwat);
- __kmp_printf(" tq_flags : ");
- __kmp_dump_TQF(queue->tq_flags);
- __kmp_printf("\n");
-
- if (in_parallel) {
- __kmp_printf(" tq_th_thunks : ");
- for (i = 0; i < queue->tq_nproc; i++) {
- __kmp_printf("%d ", queue->tq_th_thunks[i].ai_data);
- }
- __kmp_printf("\n");
- }
-
- __kmp_printf("\n");
- __kmp_printf(" Queue slots:\n");
-
- qs = queue->tq_tail;
- for (count = 0; count < queue->tq_nfull; ++count) {
- __kmp_printf("(%d)", qs);
- __kmp_dump_thunk(tq, queue->tq_queue[qs].qs_thunk, global_tid);
- qs = (qs + 1) % queue->tq_nslots;
- }
-
- __kmp_printf("\n");
-
- if (in_parallel) {
- if (queue->tq_taskq_slot != NULL) {
- __kmp_printf(" TaskQ slot:\n");
- __kmp_dump_thunk(tq, CCAST(kmpc_thunk_t *, queue->tq_taskq_slot),
- global_tid);
- __kmp_printf("\n");
- }
- //__kmp_release_lock(& queue->tq_queue_lck, global_tid);
- //__kmp_release_lock(& queue->tq_free_thunks_lck, global_tid);
- }
- }
-
- __kmp_printf(" Taskq freelist: ");
-
- //__kmp_acquire_lock( & tq->tq_freelist_lck, global_tid );
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- for (taskq = tq->tq_freelist; taskq != NULL; taskq = taskq->tq.tq_next_free)
- __kmp_printf("%p ", taskq);
-
- //__kmp_release_lock( & tq->tq_freelist_lck, global_tid );
-
- __kmp_printf("\n\n");
-}
-
-static void __kmp_aux_dump_task_queue_tree(kmp_taskq_t *tq,
- kmpc_task_queue_t *curr_queue,
- kmp_int32 level,
- kmp_int32 global_tid) {
- int i, count, qs;
- int nproc = __kmp_threads[global_tid]->th.th_team->t.t_nproc;
- kmpc_task_queue_t *queue = curr_queue;
-
- if (curr_queue == NULL)
- return;
-
- __kmp_printf(" ");
-
- for (i = 0; i < level; i++)
- __kmp_printf(" ");
-
- __kmp_printf("%p", curr_queue);
-
- for (i = 0; i < nproc; i++) {
- if (tq->tq_curr_thunk[i] &&
- tq->tq_curr_thunk[i]->th.th_shareds->sv_queue == curr_queue) {
- __kmp_printf(" [%i]", i);
- }
- }
-
- __kmp_printf(":");
-
- //__kmp_acquire_lock(& curr_queue->tq_queue_lck, global_tid);
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- qs = curr_queue->tq_tail;
-
- for (count = 0; count < curr_queue->tq_nfull; ++count) {
- __kmp_printf("%p ", curr_queue->tq_queue[qs].qs_thunk);
- qs = (qs + 1) % curr_queue->tq_nslots;
- }
-
- //__kmp_release_lock(& curr_queue->tq_queue_lck, global_tid);
-
- __kmp_printf("\n");
-
- if (curr_queue->tq_first_child) {
- //__kmp_acquire_lock(& curr_queue->tq_link_lck, global_tid);
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- if (curr_queue->tq_first_child) {
- for (queue = CCAST(kmpc_task_queue_t *, curr_queue->tq_first_child);
- queue != NULL; queue = queue->tq_next_child) {
- __kmp_aux_dump_task_queue_tree(tq, queue, level + 1, global_tid);
- }
- }
-
- //__kmp_release_lock(& curr_queue->tq_link_lck, global_tid);
- }
-}
-
-static void __kmp_dump_task_queue_tree(kmp_taskq_t *tq,
- kmpc_task_queue_t *tqroot,
- kmp_int32 global_tid) {
- __kmp_printf("TaskQ Tree at root %p on (%d):\n", tqroot, global_tid);
-
- __kmp_aux_dump_task_queue_tree(tq, tqroot, 0, global_tid);
-
- __kmp_printf("\n");
-}
-#endif
-
-/* New taskq storage routines that try to minimize overhead of mallocs but
- still provide cache line alignment. */
-static void *__kmp_taskq_allocate(size_t size, kmp_int32 global_tid) {
- void *addr, *orig_addr;
- size_t bytes;
-
- KB_TRACE(5, ("__kmp_taskq_allocate: called size=%d, gtid=%d\n", (int)size,
- global_tid));
-
- bytes = sizeof(void *) + CACHE_LINE + size;
-
-#ifdef THREAD_ALLOC_FOR_TASKQ
- orig_addr =
- (void *)__kmp_thread_malloc(__kmp_thread_from_gtid(global_tid), bytes);
-#else
- KE_TRACE(10, ("%%%%%% MALLOC( %d )\n", bytes));
- orig_addr = (void *)KMP_INTERNAL_MALLOC(bytes);
-#endif /* THREAD_ALLOC_FOR_TASKQ */
-
- if (orig_addr == 0)
- KMP_FATAL(OutOfHeapMemory);
-
- addr = orig_addr;
-
- if (((kmp_uintptr_t)addr & (CACHE_LINE - 1)) != 0) {
- KB_TRACE(50, ("__kmp_taskq_allocate: adjust for cache alignment\n"));
- addr = (void *)(((kmp_uintptr_t)addr + CACHE_LINE) & ~(CACHE_LINE - 1));
- }
-
- (*(void **)addr) = orig_addr;
-
- KB_TRACE(10,
- ("__kmp_taskq_allocate: allocate: %p, use: %p - %p, size: %d, "
- "gtid: %d\n",
- orig_addr, ((void **)addr) + 1,
- ((char *)(((void **)addr) + 1)) + size - 1, (int)size, global_tid));
-
- return (((void **)addr) + 1);
-}
-
-static void __kmpc_taskq_free(void *p, kmp_int32 global_tid) {
- KB_TRACE(5, ("__kmpc_taskq_free: called addr=%p, gtid=%d\n", p, global_tid));
-
- KB_TRACE(10, ("__kmpc_taskq_free: freeing: %p, gtid: %d\n",
- (*(((void **)p) - 1)), global_tid));
-
-#ifdef THREAD_ALLOC_FOR_TASKQ
- __kmp_thread_free(__kmp_thread_from_gtid(global_tid), *(((void **)p) - 1));
-#else
- KMP_INTERNAL_FREE(*(((void **)p) - 1));
-#endif /* THREAD_ALLOC_FOR_TASKQ */
-}
-
-/* Keep freed kmpc_task_queue_t on an internal freelist and recycle since
- they're of constant size. */
-
-static kmpc_task_queue_t *
-__kmp_alloc_taskq(kmp_taskq_t *tq, int in_parallel, kmp_int32 nslots,
- kmp_int32 nthunks, kmp_int32 nshareds, kmp_int32 nproc,
- size_t sizeof_thunk, size_t sizeof_shareds,
- kmpc_thunk_t **new_taskq_thunk, kmp_int32 global_tid) {
- kmp_int32 i;
- size_t bytes;
- kmpc_task_queue_t *new_queue;
- kmpc_aligned_shared_vars_t *shared_var_array;
- char *shared_var_storage;
- char *pt; /* for doing byte-adjusted address computations */
-
- __kmp_acquire_lock(&tq->tq_freelist_lck, global_tid);
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- if (tq->tq_freelist) {
- new_queue = tq->tq_freelist;
- tq->tq_freelist = tq->tq_freelist->tq.tq_next_free;
-
- KMP_DEBUG_ASSERT(new_queue->tq_flags & TQF_DEALLOCATED);
-
- new_queue->tq_flags = 0;
-
- __kmp_release_lock(&tq->tq_freelist_lck, global_tid);
- } else {
- __kmp_release_lock(&tq->tq_freelist_lck, global_tid);
-
- new_queue = (kmpc_task_queue_t *)__kmp_taskq_allocate(
- sizeof(kmpc_task_queue_t), global_tid);
- new_queue->tq_flags = 0;
- }
-
- /* space in the task queue for queue slots (allocate as one big chunk */
- /* of storage including new_taskq_task space) */
-
- sizeof_thunk +=
- (CACHE_LINE - (sizeof_thunk % CACHE_LINE)); /* pad to cache line size */
- pt = (char *)__kmp_taskq_allocate(nthunks * sizeof_thunk, global_tid);
- new_queue->tq_thunk_space = (kmpc_thunk_t *)pt;
- *new_taskq_thunk = (kmpc_thunk_t *)(pt + (nthunks - 1) * sizeof_thunk);
-
- /* chain the allocated thunks into a freelist for this queue */
-
- new_queue->tq_free_thunks = (kmpc_thunk_t *)pt;
-
- for (i = 0; i < (nthunks - 2); i++) {
- ((kmpc_thunk_t *)(pt + i * sizeof_thunk))->th.th_next_free =
- (kmpc_thunk_t *)(pt + (i + 1) * sizeof_thunk);
-#ifdef KMP_DEBUG
- ((kmpc_thunk_t *)(pt + i * sizeof_thunk))->th_flags = TQF_DEALLOCATED;
-#endif
- }
-
- ((kmpc_thunk_t *)(pt + (nthunks - 2) * sizeof_thunk))->th.th_next_free = NULL;
-#ifdef KMP_DEBUG
- ((kmpc_thunk_t *)(pt + (nthunks - 2) * sizeof_thunk))->th_flags =
- TQF_DEALLOCATED;
-#endif
-
- /* initialize the locks */
-
- if (in_parallel) {
- __kmp_init_lock(&new_queue->tq_link_lck);
- __kmp_init_lock(&new_queue->tq_free_thunks_lck);
- __kmp_init_lock(&new_queue->tq_queue_lck);
- }
-
- /* now allocate the slots */
-
- bytes = nslots * sizeof(kmpc_aligned_queue_slot_t);
- new_queue->tq_queue =
- (kmpc_aligned_queue_slot_t *)__kmp_taskq_allocate(bytes, global_tid);
-
- /* space for array of pointers to shared variable structures */
- sizeof_shareds += sizeof(kmpc_task_queue_t *);
- sizeof_shareds +=
- (CACHE_LINE - (sizeof_shareds % CACHE_LINE)); /* pad to cache line size */
-
- bytes = nshareds * sizeof(kmpc_aligned_shared_vars_t);
- shared_var_array =
- (kmpc_aligned_shared_vars_t *)__kmp_taskq_allocate(bytes, global_tid);
-
- bytes = nshareds * sizeof_shareds;
- shared_var_storage = (char *)__kmp_taskq_allocate(bytes, global_tid);
-
- for (i = 0; i < nshareds; i++) {
- shared_var_array[i].ai_data =
- (kmpc_shared_vars_t *)(shared_var_storage + i * sizeof_shareds);
- shared_var_array[i].ai_data->sv_queue = new_queue;
- }
- new_queue->tq_shareds = shared_var_array;
-
- /* array for number of outstanding thunks per thread */
-
- if (in_parallel) {
- bytes = nproc * sizeof(kmpc_aligned_int32_t);
- new_queue->tq_th_thunks =
- (kmpc_aligned_int32_t *)__kmp_taskq_allocate(bytes, global_tid);
- new_queue->tq_nproc = nproc;
-
- for (i = 0; i < nproc; i++)
- new_queue->tq_th_thunks[i].ai_data = 0;
- }
-
- return new_queue;
-}
-
-static void __kmp_free_taskq(kmp_taskq_t *tq, kmpc_task_queue_t *p,
- int in_parallel, kmp_int32 global_tid) {
- __kmpc_taskq_free(p->tq_thunk_space, global_tid);
- __kmpc_taskq_free(p->tq_queue, global_tid);
-
- /* free shared var structure storage */
- __kmpc_taskq_free(CCAST(kmpc_shared_vars_t *, p->tq_shareds[0].ai_data),
- global_tid);
- /* free array of pointers to shared vars storage */
- __kmpc_taskq_free(p->tq_shareds, global_tid);
-
-#ifdef KMP_DEBUG
- p->tq_first_child = NULL;
- p->tq_next_child = NULL;
- p->tq_prev_child = NULL;
- p->tq_ref_count = -10;
- p->tq_shareds = NULL;
- p->tq_tasknum_queuing = 0;
- p->tq_tasknum_serving = 0;
- p->tq_queue = NULL;
- p->tq_thunk_space = NULL;
- p->tq_taskq_slot = NULL;
- p->tq_free_thunks = NULL;
- p->tq_nslots = 0;
- p->tq_head = 0;
- p->tq_tail = 0;
- p->tq_nfull = 0;
- p->tq_hiwat = 0;
-
- if (in_parallel) {
- int i;
-
- for (i = 0; i < p->tq_nproc; i++)
- p->tq_th_thunks[i].ai_data = 0;
- }
- if (__kmp_env_consistency_check)
- p->tq_loc = NULL;
- KMP_DEBUG_ASSERT(p->tq_flags & TQF_DEALLOCATED);
- p->tq_flags = TQF_DEALLOCATED;
-#endif /* KMP_DEBUG */
-
- if (in_parallel) {
- __kmpc_taskq_free(p->tq_th_thunks, global_tid);
- __kmp_destroy_lock(&p->tq_link_lck);
- __kmp_destroy_lock(&p->tq_queue_lck);
- __kmp_destroy_lock(&p->tq_free_thunks_lck);
- }
-#ifdef KMP_DEBUG
- p->tq_th_thunks = NULL;
-#endif /* KMP_DEBUG */
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- __kmp_acquire_lock(&tq->tq_freelist_lck, global_tid);
- p->tq.tq_next_free = tq->tq_freelist;
-
- tq->tq_freelist = p;
- __kmp_release_lock(&tq->tq_freelist_lck, global_tid);
-}
-
-/* Once a group of thunks has been allocated for use in a particular queue,
- these are managed via a per-queue freelist.
- We force a check that there's always a thunk free if we need one. */
-
-static kmpc_thunk_t *__kmp_alloc_thunk(kmpc_task_queue_t *queue,
- int in_parallel, kmp_int32 global_tid) {
- kmpc_thunk_t *fl;
-
- if (in_parallel) {
- __kmp_acquire_lock(&queue->tq_free_thunks_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
- }
-
- fl = queue->tq_free_thunks;
-
- KMP_DEBUG_ASSERT(fl != NULL);
-
- queue->tq_free_thunks = fl->th.th_next_free;
- fl->th_flags = 0;
-
- if (in_parallel)
- __kmp_release_lock(&queue->tq_free_thunks_lck, global_tid);
-
- return fl;
-}
-
-static void __kmp_free_thunk(kmpc_task_queue_t *queue, kmpc_thunk_t *p,
- int in_parallel, kmp_int32 global_tid) {
-#ifdef KMP_DEBUG
- p->th_task = 0;
- p->th_encl_thunk = 0;
- p->th_status = 0;
- p->th_tasknum = 0;
-/* Also could zero pointers to private vars */
-#endif
-
- if (in_parallel) {
- __kmp_acquire_lock(&queue->tq_free_thunks_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
- }
-
- p->th.th_next_free = queue->tq_free_thunks;
- queue->tq_free_thunks = p;
-
-#ifdef KMP_DEBUG
- p->th_flags = TQF_DEALLOCATED;
-#endif
-
- if (in_parallel)
- __kmp_release_lock(&queue->tq_free_thunks_lck, global_tid);
-}
-
-/* returns nonzero if the queue just became full after the enqueue */
-static kmp_int32 __kmp_enqueue_task(kmp_taskq_t *tq, kmp_int32 global_tid,
- kmpc_task_queue_t *queue,
- kmpc_thunk_t *thunk, int in_parallel) {
- kmp_int32 ret;
-
- /* dkp: can we get around the lock in the TQF_RELEASE_WORKERS case (only the
- * master is executing then) */
- if (in_parallel) {
- __kmp_acquire_lock(&queue->tq_queue_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
- }
-
- KMP_DEBUG_ASSERT(queue->tq_nfull < queue->tq_nslots); // check queue not full
-
- queue->tq_queue[(queue->tq_head)++].qs_thunk = thunk;
-
- if (queue->tq_head >= queue->tq_nslots)
- queue->tq_head = 0;
-
- (queue->tq_nfull)++;
-
- KMP_MB(); /* to assure that nfull is seen to increase before
- TQF_ALL_TASKS_QUEUED is set */
-
- ret = (in_parallel) ? (queue->tq_nfull == queue->tq_nslots) : FALSE;
-
- if (in_parallel) {
- /* don't need to wait until workers are released before unlocking */
- __kmp_release_lock(&queue->tq_queue_lck, global_tid);
-
- if (tq->tq_global_flags & TQF_RELEASE_WORKERS) {
- // If just creating the root queue, the worker threads are waiting at a
- // join barrier until now, when there's something in the queue for them to
- // do; release them now to do work. This should only be done when this is
- // the first task enqueued, so reset the flag here also.
- tq->tq_global_flags &= ~TQF_RELEASE_WORKERS; /* no lock needed, workers
- are still in spin mode */
- // avoid releasing barrier twice if taskq_task switches threads
- KMP_MB();
-
- __kmpc_end_barrier_master(NULL, global_tid);
- }
- }
-
- return ret;
-}
-
-static kmpc_thunk_t *__kmp_dequeue_task(kmp_int32 global_tid,
- kmpc_task_queue_t *queue,
- int in_parallel) {
- kmpc_thunk_t *pt;
- int tid = __kmp_tid_from_gtid(global_tid);
-
- KMP_DEBUG_ASSERT(queue->tq_nfull > 0); /* check queue not empty */
-
- if (queue->tq.tq_parent != NULL && in_parallel) {
- int ct;
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- ct = ++(queue->tq_ref_count);
- __kmp_release_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p inc %d\n", __LINE__, global_tid, queue, ct));
- }
-
- pt = queue->tq_queue[(queue->tq_tail)++].qs_thunk;
-
- if (queue->tq_tail >= queue->tq_nslots)
- queue->tq_tail = 0;
-
- if (in_parallel) {
- queue->tq_th_thunks[tid].ai_data++;
-
- KMP_MB(); /* necessary so ai_data increment is propagated to other threads
- immediately (digital) */
-
- KF_TRACE(200, ("__kmp_dequeue_task: T#%d(:%d) now has %d outstanding "
- "thunks from queue %p\n",
- global_tid, tid, queue->tq_th_thunks[tid].ai_data, queue));
- }
-
- (queue->tq_nfull)--;
-
-#ifdef KMP_DEBUG
- KMP_MB();
-
- /* necessary so (queue->tq_nfull > 0) above succeeds after tq_nfull is
- * decremented */
-
- KMP_DEBUG_ASSERT(queue->tq_nfull >= 0);
-
- if (in_parallel) {
- KMP_DEBUG_ASSERT(queue->tq_th_thunks[tid].ai_data <=
- __KMP_TASKQ_THUNKS_PER_TH);
- }
-#endif
-
- return pt;
-}
-
-/* Find the next (non-null) task to dequeue and return it.
- * This is never called unless in_parallel=TRUE
- *
- * Here are the rules for deciding which queue to take the task from:
- * 1. Walk up the task queue tree from the current queue's parent and look
- * on the way up (for loop, below).
- * 2. Do a depth-first search back down the tree from the root and
- * look (find_task_in_descendant_queue()).
- *
- * Here are the rules for deciding which task to take from a queue
- * (__kmp_find_task_in_queue ()):
- * 1. Never take the last task from a queue if TQF_IS_LASTPRIVATE; this task
- * must be staged to make sure we execute the last one with
- * TQF_IS_LAST_TASK at the end of task queue execution.
- * 2. If the queue length is below some high water mark and the taskq task
- * is enqueued, prefer running the taskq task.
- * 3. Otherwise, take a (normal) task from the queue.
- *
- * If we do all this and return pt == NULL at the bottom of this routine,
- * this means there are no more tasks to execute (except possibly for
- * TQF_IS_LASTPRIVATE).
- */
-
-static kmpc_thunk_t *__kmp_find_task_in_queue(kmp_int32 global_tid,
- kmpc_task_queue_t *queue) {
- kmpc_thunk_t *pt = NULL;
- int tid = __kmp_tid_from_gtid(global_tid);
-
- /* To prevent deadlock from tq_queue_lck if queue already deallocated */
- if (!(queue->tq_flags & TQF_DEALLOCATED)) {
-
- __kmp_acquire_lock(&queue->tq_queue_lck, global_tid);
-
- /* Check again to avoid race in __kmpc_end_taskq() */
- if (!(queue->tq_flags & TQF_DEALLOCATED)) {
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- if ((queue->tq_taskq_slot != NULL) &&
- (queue->tq_nfull <= queue->tq_hiwat)) {
- /* if there's enough room in the queue and the dispatcher */
- /* (taskq task) is available, schedule more tasks */
- pt = CCAST(kmpc_thunk_t *, queue->tq_taskq_slot);
- queue->tq_taskq_slot = NULL;
- } else if (queue->tq_nfull == 0 ||
- queue->tq_th_thunks[tid].ai_data >=
- __KMP_TASKQ_THUNKS_PER_TH) {
- /* do nothing if no thunks available or this thread can't */
- /* run any because it already is executing too many */
- pt = NULL;
- } else if (queue->tq_nfull > 1) {
- /* always safe to schedule a task even if TQF_IS_LASTPRIVATE */
-
- pt = __kmp_dequeue_task(global_tid, queue, TRUE);
- } else if (!(queue->tq_flags & TQF_IS_LASTPRIVATE)) {
- // one thing in queue, always safe to schedule if !TQF_IS_LASTPRIVATE
- pt = __kmp_dequeue_task(global_tid, queue, TRUE);
- } else if (queue->tq_flags & TQF_IS_LAST_TASK) {
- /* TQF_IS_LASTPRIVATE, one thing in queue, kmpc_end_taskq_task() */
- /* has been run so this is last task, run with TQF_IS_LAST_TASK so */
- /* instrumentation does copy-out. */
- pt = __kmp_dequeue_task(global_tid, queue, TRUE);
- pt->th_flags |=
- TQF_IS_LAST_TASK; /* don't need test_then_or since already locked */
- }
- }
-
- /* GEH - What happens here if is lastprivate, but not last task? */
- __kmp_release_lock(&queue->tq_queue_lck, global_tid);
- }
-
- return pt;
-}
-
-/* Walk a tree of queues starting at queue's first child and return a non-NULL
- thunk if one can be scheduled. Must only be called when in_parallel=TRUE */
-
-static kmpc_thunk_t *
-__kmp_find_task_in_descendant_queue(kmp_int32 global_tid,
- kmpc_task_queue_t *curr_queue) {
- kmpc_thunk_t *pt = NULL;
- kmpc_task_queue_t *queue = curr_queue;
-
- if (curr_queue->tq_first_child != NULL) {
- __kmp_acquire_lock(&curr_queue->tq_link_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- queue = CCAST(kmpc_task_queue_t *, curr_queue->tq_first_child);
- if (queue == NULL) {
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
- return NULL;
- }
-
- while (queue != NULL) {
- int ct;
- kmpc_task_queue_t *next;
-
- ct = ++(queue->tq_ref_count);
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p inc %d\n", __LINE__, global_tid, queue, ct));
-
- pt = __kmp_find_task_in_queue(global_tid, queue);
-
- if (pt != NULL) {
- int ct;
-
- __kmp_acquire_lock(&curr_queue->tq_link_lck, global_tid);
- // Make sure data structures in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- ct = --(queue->tq_ref_count);
- KMP_DEBUG_REF_CTS(("line %d gtid %d: Q %p dec %d\n", __LINE__,
- global_tid, queue, ct));
- KMP_DEBUG_ASSERT(queue->tq_ref_count >= 0);
-
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
-
- return pt;
- }
-
- /* although reference count stays active during descendant walk, shouldn't
- matter since if children still exist, reference counts aren't being
- monitored anyway */
-
- pt = __kmp_find_task_in_descendant_queue(global_tid, queue);
-
- if (pt != NULL) {
- int ct;
-
- __kmp_acquire_lock(&curr_queue->tq_link_lck, global_tid);
- // Make sure data structures in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- ct = --(queue->tq_ref_count);
- KMP_DEBUG_REF_CTS(("line %d gtid %d: Q %p dec %d\n", __LINE__,
- global_tid, queue, ct));
- KMP_DEBUG_ASSERT(ct >= 0);
-
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
-
- return pt;
- }
-
- __kmp_acquire_lock(&curr_queue->tq_link_lck, global_tid);
- // Make sure data structures in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- next = queue->tq_next_child;
-
- ct = --(queue->tq_ref_count);
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p dec %d\n", __LINE__, global_tid, queue, ct));
- KMP_DEBUG_ASSERT(ct >= 0);
-
- queue = next;
- }
-
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
- }
-
- return pt;
-}
-
-/* Walk up the taskq tree looking for a task to execute. If we get to the root,
- search the tree for a descendent queue task. Must only be called when
- in_parallel=TRUE */
-static kmpc_thunk_t *
-__kmp_find_task_in_ancestor_queue(kmp_taskq_t *tq, kmp_int32 global_tid,
- kmpc_task_queue_t *curr_queue) {
- kmpc_task_queue_t *queue;
- kmpc_thunk_t *pt;
-
- pt = NULL;
-
- if (curr_queue->tq.tq_parent != NULL) {
- queue = curr_queue->tq.tq_parent;
-
- while (queue != NULL) {
- if (queue->tq.tq_parent != NULL) {
- int ct;
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- // Make sure data structures in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- ct = ++(queue->tq_ref_count);
- __kmp_release_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- KMP_DEBUG_REF_CTS(("line %d gtid %d: Q %p inc %d\n", __LINE__,
- global_tid, queue, ct));
- }
-
- pt = __kmp_find_task_in_queue(global_tid, queue);
- if (pt != NULL) {
- if (queue->tq.tq_parent != NULL) {
- int ct;
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- // Make sure data structures in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- ct = --(queue->tq_ref_count);
- KMP_DEBUG_REF_CTS(("line %d gtid %d: Q %p dec %d\n", __LINE__,
- global_tid, queue, ct));
- KMP_DEBUG_ASSERT(ct >= 0);
-
- __kmp_release_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- }
-
- return pt;
- }
-
- if (queue->tq.tq_parent != NULL) {
- int ct;
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- // Make sure data structures in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- ct = --(queue->tq_ref_count);
- KMP_DEBUG_REF_CTS(("line %d gtid %d: Q %p dec %d\n", __LINE__,
- global_tid, queue, ct));
- KMP_DEBUG_ASSERT(ct >= 0);
- }
- queue = queue->tq.tq_parent;
-
- if (queue != NULL)
- __kmp_release_lock(&queue->tq_link_lck, global_tid);
- }
- }
-
- pt = __kmp_find_task_in_descendant_queue(global_tid, tq->tq_root);
-
- return pt;
-}
-
-static int __kmp_taskq_tasks_finished(kmpc_task_queue_t *queue) {
- int i;
-
- /* KMP_MB(); */ /* is this really necessary? */
-
- for (i = 0; i < queue->tq_nproc; i++) {
- if (queue->tq_th_thunks[i].ai_data != 0)
- return FALSE;
- }
-
- return TRUE;
-}
-
-static int __kmp_taskq_has_any_children(kmpc_task_queue_t *queue) {
- return (queue->tq_first_child != NULL);
-}
-
-static void __kmp_remove_queue_from_tree(kmp_taskq_t *tq, kmp_int32 global_tid,
- kmpc_task_queue_t *queue,
- int in_parallel) {
-#ifdef KMP_DEBUG
- kmp_int32 i;
- kmpc_thunk_t *thunk;
-#endif
-
- KF_TRACE(50,
- ("Before Deletion of TaskQ at %p on (%d):\n", queue, global_tid));
- KF_DUMP(50, __kmp_dump_task_queue(tq, queue, global_tid));
-
- /* sub-queue in a recursion, not the root task queue */
- KMP_DEBUG_ASSERT(queue->tq.tq_parent != NULL);
-
- if (in_parallel) {
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
- }
-
- KMP_DEBUG_ASSERT(queue->tq_first_child == NULL);
-
- /* unlink queue from its siblings if any at this level */
- if (queue->tq_prev_child != NULL)
- queue->tq_prev_child->tq_next_child = queue->tq_next_child;
- if (queue->tq_next_child != NULL)
- queue->tq_next_child->tq_prev_child = queue->tq_prev_child;
- if (queue->tq.tq_parent->tq_first_child == queue)
- queue->tq.tq_parent->tq_first_child = queue->tq_next_child;
-
- queue->tq_prev_child = NULL;
- queue->tq_next_child = NULL;
-
- if (in_parallel) {
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p waiting for ref_count of %d to reach 1\n",
- __LINE__, global_tid, queue, queue->tq_ref_count));
-
- /* wait until all other threads have stopped accessing this queue */
- while (queue->tq_ref_count > 1) {
- __kmp_release_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
-
- KMP_WAIT_YIELD((volatile kmp_uint32 *)&queue->tq_ref_count, 1, KMP_LE,
- NULL);
-
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
- }
-
- __kmp_release_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- }
-
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p freeing queue\n", __LINE__, global_tid, queue));
-
-#ifdef KMP_DEBUG
- KMP_DEBUG_ASSERT(queue->tq_flags & TQF_ALL_TASKS_QUEUED);
- KMP_DEBUG_ASSERT(queue->tq_nfull == 0);
-
- for (i = 0; i < queue->tq_nproc; i++) {
- KMP_DEBUG_ASSERT(queue->tq_th_thunks[i].ai_data == 0);
- }
-
- i = 0;
- for (thunk = queue->tq_free_thunks; thunk != NULL;
- thunk = thunk->th.th_next_free)
- ++i;
-
- KMP_ASSERT(i ==
- queue->tq_nslots + (queue->tq_nproc * __KMP_TASKQ_THUNKS_PER_TH));
-#endif
-
- /* release storage for queue entry */
- __kmp_free_taskq(tq, queue, TRUE, global_tid);
-
- KF_TRACE(50, ("After Deletion of TaskQ at %p on (%d):\n", queue, global_tid));
- KF_DUMP(50, __kmp_dump_task_queue_tree(tq, tq->tq_root, global_tid));
-}
-
-/* Starting from indicated queue, proceed downward through tree and remove all
- taskqs which are finished, but only go down to taskqs which have the "nowait"
- clause present. Assume this is only called when in_parallel=TRUE. */
-
-static void __kmp_find_and_remove_finished_child_taskq(
- kmp_taskq_t *tq, kmp_int32 global_tid, kmpc_task_queue_t *curr_queue) {
- kmpc_task_queue_t *queue = curr_queue;
-
- if (curr_queue->tq_first_child != NULL) {
- __kmp_acquire_lock(&curr_queue->tq_link_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this call for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- queue = CCAST(kmpc_task_queue_t *, curr_queue->tq_first_child);
- if (queue != NULL) {
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
- return;
- }
-
- while (queue != NULL) {
- kmpc_task_queue_t *next;
- int ct = ++(queue->tq_ref_count);
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p inc %d\n", __LINE__, global_tid, queue, ct));
-
- /* although reference count stays active during descendant walk, */
- /* shouldn't matter since if children still exist, reference */
- /* counts aren't being monitored anyway */
-
- if (queue->tq_flags & TQF_IS_NOWAIT) {
- __kmp_find_and_remove_finished_child_taskq(tq, global_tid, queue);
-
- if ((queue->tq_flags & TQF_ALL_TASKS_QUEUED) &&
- (queue->tq_nfull == 0) && __kmp_taskq_tasks_finished(queue) &&
- !__kmp_taskq_has_any_children(queue)) {
-
- /* Only remove this if we have not already marked it for deallocation.
- This should prevent multiple threads from trying to free this. */
-
- if (__kmp_test_lock(&queue->tq_queue_lck, global_tid)) {
- if (!(queue->tq_flags & TQF_DEALLOCATED)) {
- queue->tq_flags |= TQF_DEALLOCATED;
- __kmp_release_lock(&queue->tq_queue_lck, global_tid);
-
- __kmp_remove_queue_from_tree(tq, global_tid, queue, TRUE);
-
- /* Can't do any more here since can't be sure where sibling queue
- * is so just exit this level */
- return;
- } else {
- __kmp_release_lock(&queue->tq_queue_lck, global_tid);
- }
- }
- /* otherwise, just fall through and decrement reference count */
- }
- }
-
- __kmp_acquire_lock(&curr_queue->tq_link_lck, global_tid);
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- next = queue->tq_next_child;
-
- ct = --(queue->tq_ref_count);
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p dec %d\n", __LINE__, global_tid, queue, ct));
- KMP_DEBUG_ASSERT(ct >= 0);
-
- queue = next;
- }
-
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
- }
-}
-
-/* Starting from indicated queue, proceed downward through tree and remove all
- taskq's assuming all are finished and assuming NO other threads are executing
- at this point. */
-static void __kmp_remove_all_child_taskq(kmp_taskq_t *tq, kmp_int32 global_tid,
- kmpc_task_queue_t *queue) {
- kmpc_task_queue_t *next_child;
-
- queue = CCAST(kmpc_task_queue_t *, queue->tq_first_child);
-
- while (queue != NULL) {
- __kmp_remove_all_child_taskq(tq, global_tid, queue);
-
- next_child = queue->tq_next_child;
- queue->tq_flags |= TQF_DEALLOCATED;
- __kmp_remove_queue_from_tree(tq, global_tid, queue, FALSE);
- queue = next_child;
- }
-}
-
-static void __kmp_execute_task_from_queue(kmp_taskq_t *tq, ident_t *loc,
- kmp_int32 global_tid,
- kmpc_thunk_t *thunk,
- int in_parallel) {
- kmpc_task_queue_t *queue = thunk->th.th_shareds->sv_queue;
- kmp_int32 tid = __kmp_tid_from_gtid(global_tid);
-
- KF_TRACE(100, ("After dequeueing this Task on (%d):\n", global_tid));
- KF_DUMP(100, __kmp_dump_thunk(tq, thunk, global_tid));
- KF_TRACE(100, ("Task Queue: %p looks like this (%d):\n", queue, global_tid));
- KF_DUMP(100, __kmp_dump_task_queue(tq, queue, global_tid));
-
- /* For the taskq task, the curr_thunk pushes and pop pairs are set up as
- * follows:
- *
- * happens exactly once:
- * 1) __kmpc_taskq : push (if returning thunk only)
- * 4) __kmpc_end_taskq_task : pop
- *
- * optionally happens *each* time taskq task is dequeued/enqueued:
- * 2) __kmpc_taskq_task : pop
- * 3) __kmp_execute_task_from_queue : push
- *
- * execution ordering: 1,(2,3)*,4
- */
-
- if (!(thunk->th_flags & TQF_TASKQ_TASK)) {
- kmp_int32 index = (queue == tq->tq_root) ? tid : 0;
- thunk->th.th_shareds =
- CCAST(kmpc_shared_vars_t *, queue->tq_shareds[index].ai_data);
-
- if (__kmp_env_consistency_check) {
- __kmp_push_workshare(global_tid,
- (queue->tq_flags & TQF_IS_ORDERED) ? ct_task_ordered
- : ct_task,
- queue->tq_loc);
- }
- } else {
- if (__kmp_env_consistency_check)
- __kmp_push_workshare(global_tid, ct_taskq, queue->tq_loc);
- }
-
- if (in_parallel) {
- thunk->th_encl_thunk = tq->tq_curr_thunk[tid];
- tq->tq_curr_thunk[tid] = thunk;
-
- KF_DUMP(200, __kmp_dump_thunk_stack(tq->tq_curr_thunk[tid], global_tid));
- }
-
- KF_TRACE(50, ("Begin Executing Thunk %p from queue %p on (%d)\n", thunk,
- queue, global_tid));
- thunk->th_task(global_tid, thunk);
- KF_TRACE(50, ("End Executing Thunk %p from queue %p on (%d)\n", thunk, queue,
- global_tid));
-
- if (!(thunk->th_flags & TQF_TASKQ_TASK)) {
- if (__kmp_env_consistency_check)
- __kmp_pop_workshare(global_tid,
- (queue->tq_flags & TQF_IS_ORDERED) ? ct_task_ordered
- : ct_task,
- queue->tq_loc);
-
- if (in_parallel) {
- tq->tq_curr_thunk[tid] = thunk->th_encl_thunk;
- thunk->th_encl_thunk = NULL;
- KF_DUMP(200, __kmp_dump_thunk_stack(tq->tq_curr_thunk[tid], global_tid));
- }
-
- if ((thunk->th_flags & TQF_IS_ORDERED) && in_parallel) {
- __kmp_taskq_check_ordered(global_tid, thunk);
- }
-
- __kmp_free_thunk(queue, thunk, in_parallel, global_tid);
-
- KF_TRACE(100, ("T#%d After freeing thunk: %p, TaskQ looks like this:\n",
- global_tid, thunk));
- KF_DUMP(100, __kmp_dump_task_queue(tq, queue, global_tid));
-
- if (in_parallel) {
- KMP_MB(); /* needed so thunk put on free list before outstanding thunk
- count is decremented */
-
- KMP_DEBUG_ASSERT(queue->tq_th_thunks[tid].ai_data >= 1);
-
- KF_TRACE(
- 200,
- ("__kmp_execute_task_from_queue: T#%d has %d thunks in queue %p\n",
- global_tid, queue->tq_th_thunks[tid].ai_data - 1, queue));
-
- queue->tq_th_thunks[tid].ai_data--;
-
- /* KMP_MB(); */ /* is MB really necessary ? */
- }
-
- if (queue->tq.tq_parent != NULL && in_parallel) {
- int ct;
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- ct = --(queue->tq_ref_count);
- __kmp_release_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- KMP_DEBUG_REF_CTS(
- ("line %d gtid %d: Q %p dec %d\n", __LINE__, global_tid, queue, ct));
- KMP_DEBUG_ASSERT(ct >= 0);
- }
- }
-}
-
-/* starts a taskq; creates and returns a thunk for the taskq_task */
-/* also, returns pointer to shared vars for this thread in "shareds" arg */
-kmpc_thunk_t *__kmpc_taskq(ident_t *loc, kmp_int32 global_tid,
- kmpc_task_t taskq_task, size_t sizeof_thunk,
- size_t sizeof_shareds, kmp_int32 flags,
- kmpc_shared_vars_t **shareds) {
- int in_parallel;
- kmp_int32 nslots, nthunks, nshareds, nproc;
- kmpc_task_queue_t *new_queue, *curr_queue;
- kmpc_thunk_t *new_taskq_thunk;
- kmp_info_t *th;
- kmp_team_t *team;
- kmp_taskq_t *tq;
- kmp_int32 tid;
-
- KE_TRACE(10, ("__kmpc_taskq called (%d)\n", global_tid));
-
- th = __kmp_threads[global_tid];
- team = th->th.th_team;
- tq = &team->t.t_taskq;
- nproc = team->t.t_nproc;
- tid = __kmp_tid_from_gtid(global_tid);
-
- /* find out whether this is a parallel taskq or serialized one. */
- in_parallel = in_parallel_context(team);
-
- if (!tq->tq_root) {
- if (in_parallel) {
- /* Vector ORDERED SECTION to taskq version */
- th->th.th_dispatch->th_deo_fcn = __kmp_taskq_eo;
-
- /* Vector ORDERED SECTION to taskq version */
- th->th.th_dispatch->th_dxo_fcn = __kmp_taskq_xo;
- }
-
- if (in_parallel) {
- // This shouldn't be a barrier region boundary, it will confuse the user.
- /* Need the boundary to be at the end taskq instead. */
- if (__kmp_barrier(bs_plain_barrier, global_tid, TRUE, 0, NULL, NULL)) {
- /* Creating the active root queue, and we are not the master thread. */
- /* The master thread below created the queue and tasks have been */
- /* enqueued, and the master thread released this barrier. This */
- /* worker thread can now proceed and execute tasks. See also the */
- /* TQF_RELEASE_WORKERS which is used to handle this case. */
- *shareds =
- CCAST(kmpc_shared_vars_t *, tq->tq_root->tq_shareds[tid].ai_data);
- KE_TRACE(10, ("__kmpc_taskq return (%d)\n", global_tid));
-
- return NULL;
- }
- }
-
- /* master thread only executes this code */
- if (tq->tq_curr_thunk_capacity < nproc) {
- if (tq->tq_curr_thunk)
- __kmp_free(tq->tq_curr_thunk);
- else {
- /* only need to do this once at outer level, i.e. when tq_curr_thunk is
- * still NULL */
- __kmp_init_lock(&tq->tq_freelist_lck);
- }
-
- tq->tq_curr_thunk =
- (kmpc_thunk_t **)__kmp_allocate(nproc * sizeof(kmpc_thunk_t *));
- tq->tq_curr_thunk_capacity = nproc;
- }
-
- if (in_parallel)
- tq->tq_global_flags = TQF_RELEASE_WORKERS;
- }
-
- /* dkp: in future, if flags & TQF_HEURISTICS, will choose nslots based */
- /* on some heuristics (e.g., depth of queue nesting?). */
- nslots = (in_parallel) ? (2 * nproc) : 1;
-
- /* There must be nproc * __KMP_TASKQ_THUNKS_PER_TH extra slots for pending */
- /* jobs being executed by other threads, and one extra for taskq slot */
- nthunks = (in_parallel) ? (nslots + (nproc * __KMP_TASKQ_THUNKS_PER_TH) + 1)
- : nslots + 2;
-
- /* Only the root taskq gets a per-thread array of shareds. */
- /* The rest of the taskq's only get one copy of the shared vars. */
- nshareds = (!tq->tq_root && in_parallel) ? nproc : 1;
-
- /* create overall queue data structure and its components that require
- * allocation */
- new_queue = __kmp_alloc_taskq(tq, in_parallel, nslots, nthunks, nshareds,
- nproc, sizeof_thunk, sizeof_shareds,
- &new_taskq_thunk, global_tid);
-
- /* rest of new_queue initializations */
- new_queue->tq_flags = flags & TQF_INTERFACE_FLAGS;
-
- if (in_parallel) {
- new_queue->tq_tasknum_queuing = 0;
- new_queue->tq_tasknum_serving = 0;
- new_queue->tq_flags |= TQF_PARALLEL_CONTEXT;
- }
-
- new_queue->tq_taskq_slot = NULL;
- new_queue->tq_nslots = nslots;
- new_queue->tq_hiwat = HIGH_WATER_MARK(nslots);
- new_queue->tq_nfull = 0;
- new_queue->tq_head = 0;
- new_queue->tq_tail = 0;
- new_queue->tq_loc = loc;
-
- if ((new_queue->tq_flags & TQF_IS_ORDERED) && in_parallel) {
- /* prepare to serve the first-queued task's ORDERED directive */
- new_queue->tq_tasknum_serving = 1;
-
- /* Vector ORDERED SECTION to taskq version */
- th->th.th_dispatch->th_deo_fcn = __kmp_taskq_eo;
-
- /* Vector ORDERED SECTION to taskq version */
- th->th.th_dispatch->th_dxo_fcn = __kmp_taskq_xo;
- }
-
- /* create a new thunk for the taskq_task in the new_queue */
- *shareds = CCAST(kmpc_shared_vars_t *, new_queue->tq_shareds[0].ai_data);
-
- new_taskq_thunk->th.th_shareds = *shareds;
- new_taskq_thunk->th_task = taskq_task;
- new_taskq_thunk->th_flags = new_queue->tq_flags | TQF_TASKQ_TASK;
- new_taskq_thunk->th_status = 0;
-
- KMP_DEBUG_ASSERT(new_taskq_thunk->th_flags & TQF_TASKQ_TASK);
-
- // Make sure these inits complete before threads start using this queue
- /* KMP_MB(); */ // (necessary?)
-
- /* insert the new task queue into the tree, but only after all fields
- * initialized */
-
- if (in_parallel) {
- if (!tq->tq_root) {
- new_queue->tq.tq_parent = NULL;
- new_queue->tq_first_child = NULL;
- new_queue->tq_next_child = NULL;
- new_queue->tq_prev_child = NULL;
- new_queue->tq_ref_count = 1;
- tq->tq_root = new_queue;
- } else {
- curr_queue = tq->tq_curr_thunk[tid]->th.th_shareds->sv_queue;
- new_queue->tq.tq_parent = curr_queue;
- new_queue->tq_first_child = NULL;
- new_queue->tq_prev_child = NULL;
- new_queue->tq_ref_count =
- 1; /* for this the thread that built the queue */
-
- KMP_DEBUG_REF_CTS(("line %d gtid %d: Q %p alloc %d\n", __LINE__,
- global_tid, new_queue, new_queue->tq_ref_count));
-
- __kmp_acquire_lock(&curr_queue->tq_link_lck, global_tid);
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- new_queue->tq_next_child =
- CCAST(struct kmpc_task_queue_t *, curr_queue->tq_first_child);
-
- if (curr_queue->tq_first_child != NULL)
- curr_queue->tq_first_child->tq_prev_child = new_queue;
-
- curr_queue->tq_first_child = new_queue;
-
- __kmp_release_lock(&curr_queue->tq_link_lck, global_tid);
- }
-
- /* set up thunk stack only after code that determines curr_queue above */
- new_taskq_thunk->th_encl_thunk = tq->tq_curr_thunk[tid];
- tq->tq_curr_thunk[tid] = new_taskq_thunk;
-
- KF_DUMP(200, __kmp_dump_thunk_stack(tq->tq_curr_thunk[tid], global_tid));
- } else {
- new_taskq_thunk->th_encl_thunk = 0;
- new_queue->tq.tq_parent = NULL;
- new_queue->tq_first_child = NULL;
- new_queue->tq_next_child = NULL;
- new_queue->tq_prev_child = NULL;
- new_queue->tq_ref_count = 1;
- }
-
-#ifdef KMP_DEBUG
- KF_TRACE(150, ("Creating TaskQ Task on (%d):\n", global_tid));
- KF_DUMP(150, __kmp_dump_thunk(tq, new_taskq_thunk, global_tid));
-
- if (in_parallel) {
- KF_TRACE(25,
- ("After TaskQ at %p Creation on (%d):\n", new_queue, global_tid));
- } else {
- KF_TRACE(25, ("After Serial TaskQ at %p Creation on (%d):\n", new_queue,
- global_tid));
- }
-
- KF_DUMP(25, __kmp_dump_task_queue(tq, new_queue, global_tid));
-
- if (in_parallel) {
- KF_DUMP(50, __kmp_dump_task_queue_tree(tq, tq->tq_root, global_tid));
- }
-#endif /* KMP_DEBUG */
-
- if (__kmp_env_consistency_check)
- __kmp_push_workshare(global_tid, ct_taskq, new_queue->tq_loc);
-
- KE_TRACE(10, ("__kmpc_taskq return (%d)\n", global_tid));
-
- return new_taskq_thunk;
-}
-
-/* ends a taskq; last thread out destroys the queue */
-
-void __kmpc_end_taskq(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *taskq_thunk) {
-#ifdef KMP_DEBUG
- kmp_int32 i;
-#endif
- kmp_taskq_t *tq;
- int in_parallel;
- kmp_info_t *th;
- kmp_int32 is_outermost;
- kmpc_task_queue_t *queue;
- kmpc_thunk_t *thunk;
- int nproc;
-
- KE_TRACE(10, ("__kmpc_end_taskq called (%d)\n", global_tid));
-
- tq = &__kmp_threads[global_tid]->th.th_team->t.t_taskq;
- nproc = __kmp_threads[global_tid]->th.th_team->t.t_nproc;
-
- /* For the outermost taskq only, all but one thread will have taskq_thunk ==
- * NULL */
- queue = (taskq_thunk == NULL) ? tq->tq_root
- : taskq_thunk->th.th_shareds->sv_queue;
-
- KE_TRACE(50, ("__kmpc_end_taskq queue=%p (%d) \n", queue, global_tid));
- is_outermost = (queue == tq->tq_root);
- in_parallel = (queue->tq_flags & TQF_PARALLEL_CONTEXT);
-
- if (in_parallel) {
- kmp_uint32 spins;
-
- /* this is just a safeguard to release the waiting threads if */
- /* the outermost taskq never queues a task */
-
- if (is_outermost && (KMP_MASTER_GTID(global_tid))) {
- if (tq->tq_global_flags & TQF_RELEASE_WORKERS) {
- /* no lock needed, workers are still in spin mode */
- tq->tq_global_flags &= ~TQF_RELEASE_WORKERS;
-
- __kmp_end_split_barrier(bs_plain_barrier, global_tid);
- }
- }
-
- /* keep dequeueing work until all tasks are queued and dequeued */
-
- do {
- /* wait until something is available to dequeue */
- KMP_INIT_YIELD(spins);
-
- while ((queue->tq_nfull == 0) && (queue->tq_taskq_slot == NULL) &&
- (!__kmp_taskq_has_any_children(queue)) &&
- (!(queue->tq_flags & TQF_ALL_TASKS_QUEUED))) {
- KMP_YIELD_WHEN(TRUE, spins);
- }
-
- /* check to see if we can execute tasks in the queue */
- while (((queue->tq_nfull != 0) || (queue->tq_taskq_slot != NULL)) &&
- (thunk = __kmp_find_task_in_queue(global_tid, queue)) != NULL) {
- KF_TRACE(50, ("Found thunk: %p in primary queue %p (%d)\n", thunk,
- queue, global_tid));
- __kmp_execute_task_from_queue(tq, loc, global_tid, thunk, in_parallel);
- }
-
- /* see if work found can be found in a descendant queue */
- if ((__kmp_taskq_has_any_children(queue)) &&
- (thunk = __kmp_find_task_in_descendant_queue(global_tid, queue)) !=
- NULL) {
-
- KF_TRACE(50,
- ("Stole thunk: %p in descendant queue: %p while waiting in "
- "queue: %p (%d)\n",
- thunk, thunk->th.th_shareds->sv_queue, queue, global_tid));
-
- __kmp_execute_task_from_queue(tq, loc, global_tid, thunk, in_parallel);
- }
-
- } while ((!(queue->tq_flags & TQF_ALL_TASKS_QUEUED)) ||
- (queue->tq_nfull != 0));
-
- KF_TRACE(50, ("All tasks queued and dequeued in queue: %p (%d)\n", queue,
- global_tid));
-
- /* wait while all tasks are not finished and more work found
- in descendant queues */
-
- while ((!__kmp_taskq_tasks_finished(queue)) &&
- (thunk = __kmp_find_task_in_descendant_queue(global_tid, queue)) !=
- NULL) {
-
- KF_TRACE(50, ("Stole thunk: %p in descendant queue: %p while waiting in "
- "queue: %p (%d)\n",
- thunk, thunk->th.th_shareds->sv_queue, queue, global_tid));
-
- __kmp_execute_task_from_queue(tq, loc, global_tid, thunk, in_parallel);
- }
-
- KF_TRACE(50, ("No work found in descendent queues or all work finished in "
- "queue: %p (%d)\n",
- queue, global_tid));
-
- if (!is_outermost) {
- /* need to return if NOWAIT present and not outermost taskq */
-
- if (queue->tq_flags & TQF_IS_NOWAIT) {
- __kmp_acquire_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
- queue->tq_ref_count--;
- KMP_DEBUG_ASSERT(queue->tq_ref_count >= 0);
- __kmp_release_lock(&queue->tq.tq_parent->tq_link_lck, global_tid);
-
- KE_TRACE(
- 10, ("__kmpc_end_taskq return for nowait case (%d)\n", global_tid));
-
- return;
- }
-
- __kmp_find_and_remove_finished_child_taskq(tq, global_tid, queue);
-
- /* WAIT until all tasks are finished and no child queues exist before
- * proceeding */
- KMP_INIT_YIELD(spins);
-
- while (!__kmp_taskq_tasks_finished(queue) ||
- __kmp_taskq_has_any_children(queue)) {
- thunk = __kmp_find_task_in_ancestor_queue(tq, global_tid, queue);
-
- if (thunk != NULL) {
- KF_TRACE(50,
- ("Stole thunk: %p in ancestor queue: %p while waiting in "
- "queue: %p (%d)\n",
- thunk, thunk->th.th_shareds->sv_queue, queue, global_tid));
- __kmp_execute_task_from_queue(tq, loc, global_tid, thunk,
- in_parallel);
- }
-
- KMP_YIELD_WHEN(thunk == NULL, spins);
-
- __kmp_find_and_remove_finished_child_taskq(tq, global_tid, queue);
- }
-
- __kmp_acquire_lock(&queue->tq_queue_lck, global_tid);
- if (!(queue->tq_flags & TQF_DEALLOCATED)) {
- queue->tq_flags |= TQF_DEALLOCATED;
- }
- __kmp_release_lock(&queue->tq_queue_lck, global_tid);
-
- /* only the allocating thread can deallocate the queue */
- if (taskq_thunk != NULL) {
- __kmp_remove_queue_from_tree(tq, global_tid, queue, TRUE);
- }
-
- KE_TRACE(
- 10,
- ("__kmpc_end_taskq return for non_outermost queue, wait case (%d)\n",
- global_tid));
-
- return;
- }
-
- // Outermost Queue: steal work from descendants until all tasks are finished
-
- KMP_INIT_YIELD(spins);
-
- while (!__kmp_taskq_tasks_finished(queue)) {
- thunk = __kmp_find_task_in_descendant_queue(global_tid, queue);
-
- if (thunk != NULL) {
- KF_TRACE(50,
- ("Stole thunk: %p in descendant queue: %p while waiting in "
- "queue: %p (%d)\n",
- thunk, thunk->th.th_shareds->sv_queue, queue, global_tid));
-
- __kmp_execute_task_from_queue(tq, loc, global_tid, thunk, in_parallel);
- }
-
- KMP_YIELD_WHEN(thunk == NULL, spins);
- }
-
- /* Need this barrier to prevent destruction of queue before threads have all
- * executed above code */
- /* This may need to be done earlier when NOWAIT is implemented for the
- * outermost level */
-
- if (!__kmp_barrier(bs_plain_barrier, global_tid, TRUE, 0, NULL, NULL)) {
- /* the queue->tq_flags & TQF_IS_NOWAIT case is not yet handled here; */
- /* for right now, everybody waits, and the master thread destroys the */
- /* remaining queues. */
-
- __kmp_remove_all_child_taskq(tq, global_tid, queue);
-
- /* Now destroy the root queue */
- KF_TRACE(100, ("T#%d Before Deletion of top-level TaskQ at %p:\n",
- global_tid, queue));
- KF_DUMP(100, __kmp_dump_task_queue(tq, queue, global_tid));
-
-#ifdef KMP_DEBUG
- /* the root queue entry */
- KMP_DEBUG_ASSERT((queue->tq.tq_parent == NULL) &&
- (queue->tq_next_child == NULL));
-
- /* children must all be gone by now because of barrier above */
- KMP_DEBUG_ASSERT(queue->tq_first_child == NULL);
-
- for (i = 0; i < nproc; i++) {
- KMP_DEBUG_ASSERT(queue->tq_th_thunks[i].ai_data == 0);
- }
-
- for (i = 0, thunk = queue->tq_free_thunks; thunk != NULL;
- i++, thunk = thunk->th.th_next_free)
- ;
-
- KMP_DEBUG_ASSERT(i ==
- queue->tq_nslots + (nproc * __KMP_TASKQ_THUNKS_PER_TH));
-
- for (i = 0; i < nproc; i++) {
- KMP_DEBUG_ASSERT(!tq->tq_curr_thunk[i]);
- }
-#endif
- /* unlink the root queue entry */
- tq->tq_root = NULL;
-
- /* release storage for root queue entry */
- KF_TRACE(50, ("After Deletion of top-level TaskQ at %p on (%d):\n", queue,
- global_tid));
-
- queue->tq_flags |= TQF_DEALLOCATED;
- __kmp_free_taskq(tq, queue, in_parallel, global_tid);
-
- KF_DUMP(50, __kmp_dump_task_queue_tree(tq, tq->tq_root, global_tid));
-
- /* release the workers now that the data structures are up to date */
- __kmp_end_split_barrier(bs_plain_barrier, global_tid);
- }
-
- th = __kmp_threads[global_tid];
-
- /* Reset ORDERED SECTION to parallel version */
- th->th.th_dispatch->th_deo_fcn = 0;
-
- /* Reset ORDERED SECTION to parallel version */
- th->th.th_dispatch->th_dxo_fcn = 0;
- } else {
- /* in serial execution context, dequeue the last task */
- /* and execute it, if there were any tasks encountered */
-
- if (queue->tq_nfull > 0) {
- KMP_DEBUG_ASSERT(queue->tq_nfull == 1);
-
- thunk = __kmp_dequeue_task(global_tid, queue, in_parallel);
-
- if (queue->tq_flags & TQF_IS_LAST_TASK) {
- /* TQF_IS_LASTPRIVATE, one thing in queue, __kmpc_end_taskq_task() */
- /* has been run so this is last task, run with TQF_IS_LAST_TASK so */
- /* instrumentation does copy-out. */
-
- /* no need for test_then_or call since already locked */
- thunk->th_flags |= TQF_IS_LAST_TASK;
- }
-
- KF_TRACE(50, ("T#%d found thunk: %p in serial queue: %p\n", global_tid,
- thunk, queue));
-
- __kmp_execute_task_from_queue(tq, loc, global_tid, thunk, in_parallel);
- }
-
- // destroy the unattached serial queue now that there is no more work to do
- KF_TRACE(100, ("Before Deletion of Serialized TaskQ at %p on (%d):\n",
- queue, global_tid));
- KF_DUMP(100, __kmp_dump_task_queue(tq, queue, global_tid));
-
-#ifdef KMP_DEBUG
- i = 0;
- for (thunk = queue->tq_free_thunks; thunk != NULL;
- thunk = thunk->th.th_next_free)
- ++i;
- KMP_DEBUG_ASSERT(i == queue->tq_nslots + 1);
-#endif
- /* release storage for unattached serial queue */
- KF_TRACE(50,
- ("Serialized TaskQ at %p deleted on (%d).\n", queue, global_tid));
-
- queue->tq_flags |= TQF_DEALLOCATED;
- __kmp_free_taskq(tq, queue, in_parallel, global_tid);
- }
-
- KE_TRACE(10, ("__kmpc_end_taskq return (%d)\n", global_tid));
-}
-
-/* Enqueues a task for thunk previously created by __kmpc_task_buffer. */
-/* Returns nonzero if just filled up queue */
-
-kmp_int32 __kmpc_task(ident_t *loc, kmp_int32 global_tid, kmpc_thunk_t *thunk) {
- kmp_int32 ret;
- kmpc_task_queue_t *queue;
- int in_parallel;
- kmp_taskq_t *tq;
-
- KE_TRACE(10, ("__kmpc_task called (%d)\n", global_tid));
-
- KMP_DEBUG_ASSERT(!(thunk->th_flags &
- TQF_TASKQ_TASK)); /* thunk->th_task is a regular task */
-
- tq = &__kmp_threads[global_tid]->th.th_team->t.t_taskq;
- queue = thunk->th.th_shareds->sv_queue;
- in_parallel = (queue->tq_flags & TQF_PARALLEL_CONTEXT);
-
- if (in_parallel && (thunk->th_flags & TQF_IS_ORDERED))
- thunk->th_tasknum = ++queue->tq_tasknum_queuing;
-
- /* For serial execution dequeue the preceding task and execute it, if one
- * exists */
- /* This cannot be the last task. That one is handled in __kmpc_end_taskq */
-
- if (!in_parallel && queue->tq_nfull > 0) {
- kmpc_thunk_t *prev_thunk;
-
- KMP_DEBUG_ASSERT(queue->tq_nfull == 1);
-
- prev_thunk = __kmp_dequeue_task(global_tid, queue, in_parallel);
-
- KF_TRACE(50, ("T#%d found thunk: %p in serial queue: %p\n", global_tid,
- prev_thunk, queue));
-
- __kmp_execute_task_from_queue(tq, loc, global_tid, prev_thunk, in_parallel);
- }
-
- /* The instrumentation sequence is: __kmpc_task_buffer(), initialize private
- variables, __kmpc_task(). The __kmpc_task_buffer routine checks that the
- task queue is not full and allocates a thunk (which is then passed to
- __kmpc_task()). So, the enqueue below should never fail due to a full
- queue. */
-
- KF_TRACE(100, ("After enqueueing this Task on (%d):\n", global_tid));
- KF_DUMP(100, __kmp_dump_thunk(tq, thunk, global_tid));
-
- ret = __kmp_enqueue_task(tq, global_tid, queue, thunk, in_parallel);
-
- KF_TRACE(100, ("Task Queue looks like this on (%d):\n", global_tid));
- KF_DUMP(100, __kmp_dump_task_queue(tq, queue, global_tid));
-
- KE_TRACE(10, ("__kmpc_task return (%d)\n", global_tid));
-
- return ret;
-}
-
-/* enqueues a taskq_task for thunk previously created by __kmpc_taskq */
-/* this should never be called unless in a parallel context */
-
-void __kmpc_taskq_task(ident_t *loc, kmp_int32 global_tid, kmpc_thunk_t *thunk,
- kmp_int32 status) {
- kmpc_task_queue_t *queue;
- kmp_taskq_t *tq = &__kmp_threads[global_tid]->th.th_team->t.t_taskq;
- int tid = __kmp_tid_from_gtid(global_tid);
-
- KE_TRACE(10, ("__kmpc_taskq_task called (%d)\n", global_tid));
- KF_TRACE(100, ("TaskQ Task argument thunk on (%d):\n", global_tid));
- KF_DUMP(100, __kmp_dump_thunk(tq, thunk, global_tid));
-
- queue = thunk->th.th_shareds->sv_queue;
-
- if (__kmp_env_consistency_check)
- __kmp_pop_workshare(global_tid, ct_taskq, loc);
-
- /* thunk->th_task is the taskq_task */
- KMP_DEBUG_ASSERT(thunk->th_flags & TQF_TASKQ_TASK);
-
- /* not supposed to call __kmpc_taskq_task if it's already enqueued */
- KMP_DEBUG_ASSERT(queue->tq_taskq_slot == NULL);
-
- /* dequeue taskq thunk from curr_thunk stack */
- tq->tq_curr_thunk[tid] = thunk->th_encl_thunk;
- thunk->th_encl_thunk = NULL;
-
- KF_DUMP(200, __kmp_dump_thunk_stack(tq->tq_curr_thunk[tid], global_tid));
-
- thunk->th_status = status;
-
- // Flush thunk->th_status before taskq_task enqueued to avoid race condition
- KMP_MB();
-
- /* enqueue taskq_task in thunk into special slot in queue */
- /* GEH - probably don't need to lock taskq slot since only one */
- /* thread enqueues & already a lock set at dequeue point */
-
- queue->tq_taskq_slot = thunk;
-
- KE_TRACE(10, ("__kmpc_taskq_task return (%d)\n", global_tid));
-}
-
-/* ends a taskq_task; done generating tasks */
-
-void __kmpc_end_taskq_task(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *thunk) {
- kmp_taskq_t *tq;
- kmpc_task_queue_t *queue;
- int in_parallel;
- int tid;
-
- KE_TRACE(10, ("__kmpc_end_taskq_task called (%d)\n", global_tid));
-
- tq = &__kmp_threads[global_tid]->th.th_team->t.t_taskq;
- queue = thunk->th.th_shareds->sv_queue;
- in_parallel = (queue->tq_flags & TQF_PARALLEL_CONTEXT);
- tid = __kmp_tid_from_gtid(global_tid);
-
- if (__kmp_env_consistency_check)
- __kmp_pop_workshare(global_tid, ct_taskq, loc);
-
- if (in_parallel) {
-#if KMP_ARCH_X86 || KMP_ARCH_X86_64
- KMP_TEST_THEN_OR32(RCAST(volatile kmp_uint32 *, &queue->tq_flags),
- TQF_ALL_TASKS_QUEUED);
-#else
- {
- __kmp_acquire_lock(&queue->tq_queue_lck, global_tid);
-
- // Make sure data structures are in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- queue->tq_flags |= TQF_ALL_TASKS_QUEUED;
- __kmp_release_lock(&queue->tq_queue_lck, global_tid);
- }
-#endif
- }
-
- if (thunk->th_flags & TQF_IS_LASTPRIVATE) {
- /* Normally, __kmp_find_task_in_queue() refuses to schedule the last task in
- the queue if TQF_IS_LASTPRIVATE so we can positively identify that last
- task and run it with its TQF_IS_LAST_TASK bit turned on in th_flags.
- When __kmpc_end_taskq_task() is called we are done generating all the
- tasks, so we know the last one in the queue is the lastprivate task.
- Mark the queue as having gotten to this state via tq_flags &
- TQF_IS_LAST_TASK; when that task actually executes mark it via th_flags &
- TQF_IS_LAST_TASK (this th_flags bit signals the instrumented code to do
- copy-outs after execution). */
- if (!in_parallel) {
- /* No synchronization needed for serial context */
- queue->tq_flags |= TQF_IS_LAST_TASK;
- } else {
-#if KMP_ARCH_X86 || KMP_ARCH_X86_64
- KMP_TEST_THEN_OR32(RCAST(volatile kmp_uint32 *, &queue->tq_flags),
- TQF_IS_LAST_TASK);
-#else
- {
- __kmp_acquire_lock(&queue->tq_queue_lck, global_tid);
-
- // Make sure data structures in consistent state before querying them
- // Seems to work without this for digital/alpha, needed for IBM/RS6000
- KMP_MB();
-
- queue->tq_flags |= TQF_IS_LAST_TASK;
- __kmp_release_lock(&queue->tq_queue_lck, global_tid);
- }
-#endif
- /* to prevent race condition where last task is dequeued but */
- /* flag isn't visible yet (not sure about this) */
- KMP_MB();
- }
- }
-
- /* dequeue taskq thunk from curr_thunk stack */
- if (in_parallel) {
- tq->tq_curr_thunk[tid] = thunk->th_encl_thunk;
- thunk->th_encl_thunk = NULL;
-
- KF_DUMP(200, __kmp_dump_thunk_stack(tq->tq_curr_thunk[tid], global_tid));
- }
-
- KE_TRACE(10, ("__kmpc_end_taskq_task return (%d)\n", global_tid));
-}
-
-/* returns thunk for a regular task based on taskq_thunk */
-/* (__kmpc_taskq_task does the analogous thing for a TQF_TASKQ_TASK) */
-
-kmpc_thunk_t *__kmpc_task_buffer(ident_t *loc, kmp_int32 global_tid,
- kmpc_thunk_t *taskq_thunk, kmpc_task_t task) {
- kmp_taskq_t *tq;
- kmpc_task_queue_t *queue;
- kmpc_thunk_t *new_thunk;
- int in_parallel;
-
- KE_TRACE(10, ("__kmpc_task_buffer called (%d)\n", global_tid));
-
- KMP_DEBUG_ASSERT(
- taskq_thunk->th_flags &
- TQF_TASKQ_TASK); /* taskq_thunk->th_task is the taskq_task */
-
- tq = &__kmp_threads[global_tid]->th.th_team->t.t_taskq;
- queue = taskq_thunk->th.th_shareds->sv_queue;
- in_parallel = (queue->tq_flags & TQF_PARALLEL_CONTEXT);
-
- /* The instrumentation sequence is: __kmpc_task_buffer(), initialize private
- variables, __kmpc_task(). The __kmpc_task_buffer routine checks that the
- task queue is not full and allocates a thunk (which is then passed to
- __kmpc_task()). So, we can pre-allocate a thunk here assuming it will be
- the next to be enqueued in __kmpc_task(). */
-
- new_thunk = __kmp_alloc_thunk(queue, in_parallel, global_tid);
- new_thunk->th.th_shareds =
- CCAST(kmpc_shared_vars_t *, queue->tq_shareds[0].ai_data);
- new_thunk->th_encl_thunk = NULL;
- new_thunk->th_task = task;
-
- /* GEH - shouldn't need to lock the read of tq_flags here */
- new_thunk->th_flags = queue->tq_flags & TQF_INTERFACE_FLAGS;
-
- new_thunk->th_status = 0;
-
- KMP_DEBUG_ASSERT(!(new_thunk->th_flags & TQF_TASKQ_TASK));
-
- KF_TRACE(100, ("Creating Regular Task on (%d):\n", global_tid));
- KF_DUMP(100, __kmp_dump_thunk(tq, new_thunk, global_tid));
-
- KE_TRACE(10, ("__kmpc_task_buffer return (%d)\n", global_tid));
-
- return new_thunk;
-}
diff --git a/runtime/src/kmp_threadprivate.cpp b/runtime/src/kmp_threadprivate.cpp
index d1ca422092f2..87bfff39e70e 100644
--- a/runtime/src/kmp_threadprivate.cpp
+++ b/runtime/src/kmp_threadprivate.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_utility.cpp b/runtime/src/kmp_utility.cpp
index dc4c714f8d80..44a99d0455b3 100644
--- a/runtime/src/kmp_utility.cpp
+++ b/runtime/src/kmp_utility.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_version.cpp b/runtime/src/kmp_version.cpp
index e138e869208d..7464d1972684 100644
--- a/runtime/src/kmp_version.cpp
+++ b/runtime/src/kmp_version.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -50,9 +49,9 @@
#define KMP_COMPILER "Intel(R) C++ Compiler 17.0"
#elif __INTEL_COMPILER == 1800
#define KMP_COMPILER "Intel(R) C++ Compiler 18.0"
-#elif __INTEL_COMPILER == 9998
-#define KMP_COMPILER "Intel(R) C++ Compiler mainline"
-#elif __INTEL_COMPILER == 9999
+#elif __INTEL_COMPILER == 1900
+#define KMP_COMPILER "Intel(R) C++ Compiler 19.0"
+#elif __INTEL_COMPILER >= 9900
#define KMP_COMPILER "Intel(R) C++ Compiler mainline"
#endif
#elif KMP_COMPILER_CLANG
@@ -89,16 +88,7 @@
int const __kmp_version_major = KMP_VERSION_MAJOR;
int const __kmp_version_minor = KMP_VERSION_MINOR;
int const __kmp_version_build = KMP_VERSION_BUILD;
-int const __kmp_openmp_version =
-#if OMP_50_ENABLED
- 201611;
-#elif OMP_45_ENABLED
- 201511;
-#elif OMP_40_ENABLED
- 201307;
-#else
- 201107;
-#endif
+int const __kmp_openmp_version = 201611;
/* Do NOT change the format of this string! Intel(R) Thread Profiler checks for
a specific format some changes in the recognition routine there need to be
diff --git a/runtime/src/kmp_version.h b/runtime/src/kmp_version.h
index 18a248740a18..9e726b3805b2 100644
--- a/runtime/src/kmp_version.h
+++ b/runtime/src/kmp_version.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_wait_release.cpp b/runtime/src/kmp_wait_release.cpp
index 3ebec6b057f9..7d12c74bfcb1 100644
--- a/runtime/src/kmp_wait_release.cpp
+++ b/runtime/src/kmp_wait_release.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/kmp_wait_release.h b/runtime/src/kmp_wait_release.h
index dd56c88b0e43..bb6bdf5d8fa5 100644
--- a/runtime/src/kmp_wait_release.h
+++ b/runtime/src/kmp_wait_release.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -130,11 +129,13 @@ static void __ompt_implicit_task_end(kmp_info_t *this_thr,
void *codeptr = NULL;
if (ompt_enabled.ompt_callback_sync_region_wait) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region_wait)(
- ompt_sync_region_barrier, ompt_scope_end, NULL, tId, codeptr);
+ ompt_sync_region_barrier_implicit, ompt_scope_end, NULL, tId,
+ codeptr);
}
if (ompt_enabled.ompt_callback_sync_region) {
ompt_callbacks.ompt_callback(ompt_callback_sync_region)(
- ompt_sync_region_barrier, ompt_scope_end, NULL, tId, codeptr);
+ ompt_sync_region_barrier_implicit, ompt_scope_end, NULL, tId,
+ codeptr);
}
#endif
if (!KMP_MASTER_TID(ds_tid)) {
@@ -151,13 +152,14 @@ static void __ompt_implicit_task_end(kmp_info_t *this_thr,
}
#endif
-/* Spin wait loop that first does pause, then yield, then sleep. A thread that
- calls __kmp_wait_* must make certain that another thread calls __kmp_release
+/* Spin wait loop that first does pause/yield, then sleep. A thread that calls
+ __kmp_wait_* must make certain that another thread calls __kmp_release
to wake it back up to prevent deadlocks!
NOTE: We may not belong to a team at this point. */
-template <class C, int final_spin>
-static inline void
+template <class C, int final_spin, bool cancellable = false,
+ bool sleepable = true>
+static inline bool
__kmp_wait_template(kmp_info_t *this_thr,
C *flag USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
#if USE_ITT_BUILD && USE_ITT_NOTIFY
@@ -177,9 +179,14 @@ __kmp_wait_template(kmp_info_t *this_thr,
KMP_FSYNC_SPIN_INIT(spin, NULL);
if (flag->done_check()) {
KMP_FSYNC_SPIN_ACQUIRED(CCAST(void *, spin));
- return;
+ return false;
}
th_gtid = this_thr->th.th_info.ds.ds_gtid;
+ if (cancellable) {
+ kmp_team_t *team = this_thr->th.th_team;
+ if (team && team->t.t_cancel_request == cancel_parallel)
+ return true;
+ }
#if KMP_OS_UNIX
if (final_spin)
KMP_ATOMIC_ST_REL(&this_thr->th.th_blocking, true);
@@ -265,15 +272,16 @@ final_spin=FALSE)
}
#endif
- // Setup for waiting
- KMP_INIT_YIELD(spins);
+ KMP_INIT_YIELD(spins); // Setup for waiting
- if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME) {
+ if (__kmp_dflt_blocktime != KMP_MAX_BLOCKTIME ||
+ __kmp_pause_status == kmp_soft_paused) {
#if KMP_USE_MONITOR
// The worker threads cannot rely on the team struct existing at this point.
// Use the bt values cached in the thread struct instead.
#ifdef KMP_ADJUST_BLOCKTIME
- if (__kmp_zero_bt && !this_thr->th.th_team_bt_set)
+ if (__kmp_pause_status == kmp_soft_paused ||
+ (__kmp_zero_bt && !this_thr->th.th_team_bt_set))
// Force immediate suspend if not set by user and more threads than
// available procs
hibernate = 0;
@@ -296,7 +304,11 @@ final_spin=FALSE)
th_gtid, __kmp_global.g.g_time.dt.t_value, hibernate,
hibernate - __kmp_global.g.g_time.dt.t_value));
#else
- hibernate_goal = KMP_NOW() + this_thr->th.th_team_bt_intervals;
+ if (__kmp_pause_status == kmp_soft_paused) {
+ // Force immediate suspend
+ hibernate_goal = KMP_NOW();
+ } else
+ hibernate_goal = KMP_NOW() + this_thr->th.th_team_bt_intervals;
poll_count = 0;
#endif // KMP_USE_MONITOR
}
@@ -306,7 +318,6 @@ final_spin=FALSE)
// Main wait spin loop
while (flag->notdone_check()) {
- int in_pool;
kmp_task_team_t *task_team = NULL;
if (__kmp_tasking_mode != tskm_immediate_exec) {
task_team = this_thr->th.th_task_team;
@@ -349,34 +360,7 @@ final_spin=FALSE)
// If we are oversubscribed, or have waited a bit (and
// KMP_LIBRARY=throughput), then yield
- // TODO: Should it be number of cores instead of thread contexts? Like:
- // KMP_YIELD(TCR_4(__kmp_nth) > __kmp_ncores);
- // Need performance improvement data to make the change...
- if (oversubscribed) {
- KMP_YIELD(1);
- } else {
- KMP_YIELD_SPIN(spins);
- }
- // Check if this thread was transferred from a team
- // to the thread pool (or vice-versa) while spinning.
- in_pool = !!TCR_4(this_thr->th.th_in_pool);
- if (in_pool != !!this_thr->th.th_active_in_pool) {
- if (in_pool) { // Recently transferred from team to pool
- KMP_ATOMIC_INC(&__kmp_thread_pool_active_nth);
- this_thr->th.th_active_in_pool = TRUE;
- /* Here, we cannot assert that:
- KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) <=
- __kmp_thread_pool_nth);
- __kmp_thread_pool_nth is inc/dec'd by the master thread while the
- fork/join lock is held, whereas __kmp_thread_pool_active_nth is
- inc/dec'd asynchronously by the workers. The two can get out of sync
- for brief periods of time. */
- } else { // Recently transferred from pool to team
- KMP_ATOMIC_DEC(&__kmp_thread_pool_active_nth);
- KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) >= 0);
- this_thr->th.th_active_in_pool = FALSE;
- }
- }
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
#if KMP_STATS_ENABLED
// Check if thread has been signalled to idle state
@@ -387,9 +371,16 @@ final_spin=FALSE)
KMP_PUSH_PARTITIONED_TIMER(OMP_idle);
}
#endif
+ // Check if the barrier surrounding this wait loop has been cancelled
+ if (cancellable) {
+ kmp_team_t *team = this_thr->th.th_team;
+ if (team && team->t.t_cancel_request == cancel_parallel)
+ break;
+ }
// Don't suspend if KMP_BLOCKTIME is set to "infinite"
- if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME)
+ if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME &&
+ __kmp_pause_status != kmp_soft_paused)
continue;
// Don't suspend if there is a likelihood of new tasks being spawned.
@@ -404,8 +395,17 @@ final_spin=FALSE)
if (KMP_BLOCKING(hibernate_goal, poll_count++))
continue;
#endif
+ // Don't suspend if wait loop designated non-sleepable
+ // in template parameters
+ if (!sleepable)
+ continue;
+
+ if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME &&
+ __kmp_pause_status != kmp_soft_paused)
+ continue;
KF_TRACE(50, ("__kmp_wait_sleep: T#%d suspend time reached\n", th_gtid));
+
#if KMP_OS_UNIX
if (final_spin)
KMP_ATOMIC_ST_REL(&this_thr->th.th_blocking, false);
@@ -455,6 +455,21 @@ final_spin=FALSE)
KMP_ATOMIC_ST_REL(&this_thr->th.th_blocking, false);
#endif
KMP_FSYNC_SPIN_ACQUIRED(CCAST(void *, spin));
+ if (cancellable) {
+ kmp_team_t *team = this_thr->th.th_team;
+ if (team && team->t.t_cancel_request == cancel_parallel) {
+ if (tasks_completed) {
+ // undo the previous decrement of unfinished_threads so that the
+ // thread can decrement at the join barrier with no problem
+ kmp_task_team_t *task_team = this_thr->th.th_task_team;
+ std::atomic<kmp_int32> *unfinished_threads =
+ &(task_team->tt.tt_unfinished_threads);
+ KMP_ATOMIC_INC(unfinished_threads);
+ }
+ return true;
+ }
+ }
+ return false;
}
/* Release any threads specified as waiting on the flag by releasing the flag
@@ -772,6 +787,18 @@ public:
__kmp_wait_template<kmp_flag_64, FALSE>(
this_thr, this USE_ITT_BUILD_ARG(itt_sync_obj));
}
+ bool wait_cancellable_nosleep(kmp_info_t *this_thr,
+ int final_spin
+ USE_ITT_BUILD_ARG(void *itt_sync_obj)) {
+ bool retval = false;
+ if (final_spin)
+ retval = __kmp_wait_template<kmp_flag_64, TRUE, true, false>(
+ this_thr, this USE_ITT_BUILD_ARG(itt_sync_obj));
+ else
+ retval = __kmp_wait_template<kmp_flag_64, FALSE, true, false>(
+ this_thr, this USE_ITT_BUILD_ARG(itt_sync_obj));
+ return retval;
+ }
void release() { __kmp_release_template(this); }
flag_type get_ptr_type() { return flag64; }
};
diff --git a/runtime/src/kmp_wrapper_getpid.h b/runtime/src/kmp_wrapper_getpid.h
index 47e27282a747..70db857bcbae 100644
--- a/runtime/src/kmp_wrapper_getpid.h
+++ b/runtime/src/kmp_wrapper_getpid.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -24,6 +23,9 @@
#if KMP_OS_DARWIN
// OS X
#define __kmp_gettid() syscall(SYS_thread_selfid)
+#elif KMP_OS_FREEBSD
+#include <pthread_np.h>
+#define __kmp_gettid() pthread_getthreadid_np()
#elif KMP_OS_NETBSD
#include <lwp.h>
#define __kmp_gettid() _lwp_self()
diff --git a/runtime/src/kmp_wrapper_malloc.h b/runtime/src/kmp_wrapper_malloc.h
index c8d2c70c8092..a50387c7f7cc 100644
--- a/runtime/src/kmp_wrapper_malloc.h
+++ b/runtime/src/kmp_wrapper_malloc.h
@@ -5,10 +5,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/libomp.rc.var b/runtime/src/libomp.rc.var
index 32449e2b8d61..958cd045bfd5 100644
--- a/runtime/src/libomp.rc.var
+++ b/runtime/src/libomp.rc.var
@@ -3,10 +3,9 @@
//
////===----------------------------------------------------------------------===//
////
-//// The LLVM Compiler Infrastructure
-////
-//// This file is dual licensed under the MIT and the University of Illinois Open
-//// Source Licenses. See LICENSE.txt for details.
+//// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+//// See https://llvm.org/LICENSE.txt for license information.
+//// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
////
////===----------------------------------------------------------------------===//
//
diff --git a/runtime/src/ompt-event-specific.h b/runtime/src/ompt-event-specific.h
index a93e0f81ce9b..da6a0e424726 100644
--- a/runtime/src/ompt-event-specific.h
+++ b/runtime/src/ompt-event-specific.h
@@ -9,10 +9,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -77,14 +76,9 @@
#define ompt_callback_mutex_released_implemented ompt_event_MAY_ALWAYS_OPTIONAL
-#if OMP_40_ENABLED
#define ompt_callback_dependences_implemented \
ompt_event_MAY_ALWAYS_OPTIONAL
#define ompt_callback_task_dependence_implemented ompt_event_MAY_ALWAYS_OPTIONAL
-#else
-#define ompt_callback_dependences_implemented ompt_event_UNIMPLEMENTED
-#define ompt_callback_task_dependence_implemented ompt_event_UNIMPLEMENTED
-#endif /* OMP_40_ENABLED */
#define ompt_callback_work_implemented ompt_event_MAY_ALWAYS_OPTIONAL
diff --git a/runtime/src/ompt-general.cpp b/runtime/src/ompt-general.cpp
index cea00fff07ac..00bf606bb1d5 100644
--- a/runtime/src/ompt-general.cpp
+++ b/runtime/src/ompt-general.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -362,10 +361,11 @@ void ompt_post_init() {
ompt_thread_initial, __ompt_get_thread_data_internal());
}
ompt_data_t *task_data;
- __ompt_get_task_info_internal(0, NULL, &task_data, NULL, NULL, NULL);
- if (ompt_enabled.ompt_callback_task_create) {
- ompt_callbacks.ompt_callback(ompt_callback_task_create)(
- NULL, NULL, task_data, ompt_task_initial, 0, NULL);
+ ompt_data_t *parallel_data;
+ __ompt_get_task_info_internal(0, NULL, &task_data, NULL, &parallel_data, NULL);
+ if (ompt_enabled.ompt_callback_implicit_task) {
+ ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
+ ompt_scope_begin, parallel_data, task_data, 1, 1, ompt_task_initial);
}
ompt_set_thread_state(root_thread, ompt_state_work_serial);
@@ -524,8 +524,7 @@ OMPT_API_ROUTINE int ompt_get_task_info(int ancestor_level, int *type,
OMPT_API_ROUTINE int ompt_get_task_memory(void **addr, size_t *size,
int block) {
- // stub
- return 0;
+ return __ompt_get_task_memory_internal(addr, size, block);
}
/*****************************************************************************
@@ -700,9 +699,7 @@ OMPT_API_ROUTINE uint64_t ompt_get_unique_id(void) {
return __ompt_get_unique_id_internal();
}
-OMPT_API_ROUTINE void ompt_finalize_tool(void) {
- // stub
-}
+OMPT_API_ROUTINE void ompt_finalize_tool(void) { __kmp_internal_end_atexit(); }
/*****************************************************************************
* Target
diff --git a/runtime/src/ompt-internal.h b/runtime/src/ompt-internal.h
index 170a9ec5aecd..5a6beaf88cae 100644
--- a/runtime/src/ompt-internal.h
+++ b/runtime/src/ompt-internal.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -58,10 +57,8 @@ typedef struct {
ompt_data_t task_data;
struct kmp_taskdata *scheduling_parent;
int thread_num;
-#if OMP_40_ENABLED
int ndeps;
ompt_dependence_t *deps;
-#endif /* OMP_40_ENABLED */
} ompt_task_info_t;
typedef struct {
@@ -89,7 +86,7 @@ typedef struct {
extern ompt_callbacks_internal_t ompt_callbacks;
-#if OMP_40_ENABLED && OMPT_SUPPORT && OMPT_OPTIONAL
+#if OMPT_SUPPORT && OMPT_OPTIONAL
#if USE_FAST_MEMORY
#define KMP_OMPT_DEPS_ALLOC __kmp_fast_allocate
#define KMP_OMPT_DEPS_FREE __kmp_fast_free
@@ -97,7 +94,7 @@ extern ompt_callbacks_internal_t ompt_callbacks;
#define KMP_OMPT_DEPS_ALLOC __kmp_thread_malloc
#define KMP_OMPT_DEPS_FREE __kmp_thread_free
#endif
-#endif /* OMP_40_ENABLED && OMPT_SUPPORT && OMPT_OPTIONAL */
+#endif /* OMPT_SUPPORT && OMPT_OPTIONAL */
#ifdef __cplusplus
extern "C" {
diff --git a/runtime/src/ompt-specific.cpp b/runtime/src/ompt-specific.cpp
index a6d02ddb85e3..63153d274efb 100644
--- a/runtime/src/ompt-specific.cpp
+++ b/runtime/src/ompt-specific.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -211,7 +210,8 @@ ompt_data_t *__ompt_get_thread_data_internal() {
void __ompt_thread_assign_wait_id(void *variable) {
kmp_info_t *ti = ompt_get_thread();
- ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)variable;
+ if (ti)
+ ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)(uintptr_t)variable;
}
int __ompt_get_state_internal(ompt_wait_id_t *omp_wait_id) {
@@ -428,6 +428,38 @@ int __ompt_get_task_info_internal(int ancestor_level, int *type,
return 0;
}
+int __ompt_get_task_memory_internal(void **addr, size_t *size, int blocknum) {
+ if (blocknum != 0)
+ return 0; // support only a single block
+
+ kmp_info_t *thr = ompt_get_thread();
+ if (!thr)
+ return 0;
+
+ kmp_taskdata_t *taskdata = thr->th.th_current_task;
+ kmp_task_t *task = KMP_TASKDATA_TO_TASK(taskdata);
+
+ if (taskdata->td_flags.tasktype != TASK_EXPLICIT)
+ return 0; // support only explicit task
+
+ void *ret_addr;
+ int64_t ret_size = taskdata->td_size_alloc - sizeof(kmp_taskdata_t);
+
+ // kmp_task_t->data1 is an optional member
+ if (taskdata->td_flags.destructors_thunk)
+ ret_addr = &task->data1 + 1;
+ else
+ ret_addr = &task->part_id + 1;
+
+ ret_size -= (char *)(ret_addr) - (char *)(task);
+ if (ret_size < 0)
+ return 0;
+
+ *addr = ret_addr;
+ *size = ret_size;
+ return 1;
+}
+
//----------------------------------------------------------
// team support
//----------------------------------------------------------
@@ -449,3 +481,25 @@ static uint64_t __ompt_get_unique_id_internal() {
}
return ++ID;
}
+
+ompt_sync_region_t __ompt_get_barrier_kind(enum barrier_type bt,
+ kmp_info_t *thr) {
+ if (bt == bs_forkjoin_barrier)
+ return ompt_sync_region_barrier_implicit;
+
+ if (bt != bs_plain_barrier)
+ return ompt_sync_region_barrier_implementation;
+
+ if (!thr->th.th_ident)
+ return ompt_sync_region_barrier;
+
+ kmp_int32 flags = thr->th.th_ident->flags;
+
+ if ((flags & KMP_IDENT_BARRIER_EXPL) != 0)
+ return ompt_sync_region_barrier_explicit;
+
+ if ((flags & KMP_IDENT_BARRIER_IMPL) != 0)
+ return ompt_sync_region_barrier_implicit;
+
+ return ompt_sync_region_barrier_implementation;
+}
diff --git a/runtime/src/ompt-specific.h b/runtime/src/ompt-specific.h
index 317580fcf017..86fd928d0378 100644
--- a/runtime/src/ompt-specific.h
+++ b/runtime/src/ompt-specific.h
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -51,6 +50,8 @@ ompt_data_t *__ompt_get_thread_data_internal();
static uint64_t __ompt_get_get_unique_id_internal();
*/
+ompt_sync_region_t __ompt_get_barrier_kind(enum barrier_type, kmp_info_t *);
+
/*****************************************************************************
* macros
****************************************************************************/
diff --git a/runtime/src/test-touch.c b/runtime/src/test-touch.c
index 6ce529ae23aa..71e05e76683d 100644
--- a/runtime/src/test-touch.c
+++ b/runtime/src/test-touch.c
@@ -3,10 +3,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/thirdparty/ittnotify/disable_warnings.h b/runtime/src/thirdparty/ittnotify/disable_warnings.h
index 301901ca8338..6b06035b41fb 100644
--- a/runtime/src/thirdparty/ittnotify/disable_warnings.h
+++ b/runtime/src/thirdparty/ittnotify/disable_warnings.h
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/thirdparty/ittnotify/ittnotify.h b/runtime/src/thirdparty/ittnotify/ittnotify.h
index 3581dfa1f1e8..ed46cd7761c3 100644
--- a/runtime/src/thirdparty/ittnotify/ittnotify.h
+++ b/runtime/src/thirdparty/ittnotify/ittnotify.h
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/thirdparty/ittnotify/ittnotify_config.h b/runtime/src/thirdparty/ittnotify/ittnotify_config.h
index 59065f64c81a..cc494cb4db43 100644
--- a/runtime/src/thirdparty/ittnotify/ittnotify_config.h
+++ b/runtime/src/thirdparty/ittnotify/ittnotify_config.h
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/thirdparty/ittnotify/ittnotify_static.c b/runtime/src/thirdparty/ittnotify/ittnotify_static.c
index 63e1b0c6f672..a2a73ada2e0c 100644
--- a/runtime/src/thirdparty/ittnotify/ittnotify_static.c
+++ b/runtime/src/thirdparty/ittnotify/ittnotify_static.c
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/thirdparty/ittnotify/ittnotify_static.h b/runtime/src/thirdparty/ittnotify/ittnotify_static.h
index 5ef300faa90b..a2022263003d 100644
--- a/runtime/src/thirdparty/ittnotify/ittnotify_static.h
+++ b/runtime/src/thirdparty/ittnotify/ittnotify_static.h
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/thirdparty/ittnotify/ittnotify_types.h b/runtime/src/thirdparty/ittnotify/ittnotify_types.h
index babc50e9f132..88181612b23b 100644
--- a/runtime/src/thirdparty/ittnotify/ittnotify_types.h
+++ b/runtime/src/thirdparty/ittnotify/ittnotify_types.h
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/thirdparty/ittnotify/legacy/ittnotify.h b/runtime/src/thirdparty/ittnotify/legacy/ittnotify.h
index 66e50a876f02..eae33e0b1942 100644
--- a/runtime/src/thirdparty/ittnotify/legacy/ittnotify.h
+++ b/runtime/src/thirdparty/ittnotify/legacy/ittnotify.h
@@ -1,10 +1,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/tsan_annotations.cpp b/runtime/src/tsan_annotations.cpp
index 2629788ee915..5be17f8337ce 100644
--- a/runtime/src/tsan_annotations.cpp
+++ b/runtime/src/tsan_annotations.cpp
@@ -5,10 +5,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/tsan_annotations.h b/runtime/src/tsan_annotations.h
index 9abbfafe44ee..2b1debbcad4e 100644
--- a/runtime/src/tsan_annotations.h
+++ b/runtime/src/tsan_annotations.h
@@ -6,10 +6,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/z_Linux_asm.S b/runtime/src/z_Linux_asm.S
index c9fbc238c403..0d8885eca1c7 100644
--- a/runtime/src/z_Linux_asm.S
+++ b/runtime/src/z_Linux_asm.S
@@ -4,10 +4,9 @@
//
////===----------------------------------------------------------------------===//
////
-//// The LLVM Compiler Infrastructure
-////
-//// This file is dual licensed under the MIT and the University of Illinois Open
-//// Source Licenses. See LICENSE.txt for details.
+//// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+//// See https://llvm.org/LICENSE.txt for license information.
+//// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
////
////===----------------------------------------------------------------------===//
//
@@ -234,39 +233,6 @@ __kmp_unnamed_critical_addr:
DEBUG_INFO __kmp_x86_pause
-// void
-// __kmp_x86_cpuid( int mode, int mode2, void *cpuid_buffer );
-
- PROC __kmp_x86_cpuid
-
- pushl %ebp
- movl %esp,%ebp
- pushl %edi
- pushl %ebx
- pushl %ecx
- pushl %edx
-
- movl 8(%ebp), %eax
- movl 12(%ebp), %ecx
- cpuid // Query the CPUID for the current processor
-
- movl 16(%ebp), %edi
- movl %eax, 0(%edi)
- movl %ebx, 4(%edi)
- movl %ecx, 8(%edi)
- movl %edx, 12(%edi)
-
- popl %edx
- popl %ecx
- popl %ebx
- popl %edi
- movl %ebp, %esp
- popl %ebp
- ret
-
- DEBUG_INFO __kmp_x86_cpuid
-
-
# if !KMP_ASM_INTRINS
//------------------------------------------------------------------------
@@ -528,54 +494,6 @@ __kmp_unnamed_critical_addr:
# endif /* !KMP_ASM_INTRINS */
-
-//------------------------------------------------------------------------
-// FUNCTION __kmp_load_x87_fpu_control_word
-//
-// void
-// __kmp_load_x87_fpu_control_word( kmp_int16 *p );
-//
-// parameters:
-// p: 4(%esp)
- PROC __kmp_load_x87_fpu_control_word
-
- movl 4(%esp), %eax
- fldcw (%eax)
- ret
-
- DEBUG_INFO __kmp_load_x87_fpu_control_word
-
-
-//------------------------------------------------------------------------
-// FUNCTION __kmp_store_x87_fpu_control_word
-//
-// void
-// __kmp_store_x87_fpu_control_word( kmp_int16 *p );
-//
-// parameters:
-// p: 4(%esp)
- PROC __kmp_store_x87_fpu_control_word
-
- movl 4(%esp), %eax
- fstcw (%eax)
- ret
-
- DEBUG_INFO __kmp_store_x87_fpu_control_word
-
-
-//------------------------------------------------------------------------
-// FUNCTION __kmp_clear_x87_fpu_status_word
-//
-// void
-// __kmp_clear_x87_fpu_status_word();
- PROC __kmp_clear_x87_fpu_status_word
-
- fnclex
- ret
-
- DEBUG_INFO __kmp_clear_x87_fpu_status_word
-
-
//------------------------------------------------------------------------
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
//
@@ -688,41 +606,6 @@ KMP_LABEL(invoke_3):
// To prevent getting our code into .data section .text added to every routine
// definition for x86_64.
//------------------------------------------------------------------------
-// FUNCTION __kmp_x86_cpuid
-//
-// void
-// __kmp_x86_cpuid( int mode, int mode2, void *cpuid_buffer );
-//
-// parameters:
-// mode: %edi
-// mode2: %esi
-// cpuid_buffer: %rdx
- .text
- PROC __kmp_x86_cpuid
-
- pushq %rbp
- movq %rsp,%rbp
- pushq %rbx // callee-save register
-
- movl %esi, %ecx // "mode2"
- movl %edi, %eax // "mode"
- movq %rdx, %rsi // cpuid_buffer
- cpuid // Query the CPUID for the current processor
-
- movl %eax, 0(%rsi) // store results into buffer
- movl %ebx, 4(%rsi)
- movl %ecx, 8(%rsi)
- movl %edx, 12(%rsi)
-
- popq %rbx // callee-save register
- movq %rbp, %rsp
- popq %rbp
- ret
-
- DEBUG_INFO __kmp_x86_cpuid
-
-
-
# if !KMP_ASM_INTRINS
//------------------------------------------------------------------------
@@ -1107,63 +990,6 @@ KMP_LABEL(invoke_3):
# endif /* !KMP_ASM_INTRINS */
-
-//------------------------------------------------------------------------
-// FUNCTION __kmp_load_x87_fpu_control_word
-//
-// void
-// __kmp_load_x87_fpu_control_word( kmp_int16 *p );
-//
-// parameters:
-// p: %rdi
- .text
- PROC __kmp_load_x87_fpu_control_word
-
- fldcw (%rdi)
- ret
-
- DEBUG_INFO __kmp_load_x87_fpu_control_word
-
-
-//------------------------------------------------------------------------
-// FUNCTION __kmp_store_x87_fpu_control_word
-//
-// void
-// __kmp_store_x87_fpu_control_word( kmp_int16 *p );
-//
-// parameters:
-// p: %rdi
- .text
- PROC __kmp_store_x87_fpu_control_word
-
- fstcw (%rdi)
- ret
-
- DEBUG_INFO __kmp_store_x87_fpu_control_word
-
-
-//------------------------------------------------------------------------
-// FUNCTION __kmp_clear_x87_fpu_status_word
-//
-// void
-// __kmp_clear_x87_fpu_status_word();
- .text
- PROC __kmp_clear_x87_fpu_status_word
-
-#if KMP_MIC
-// TODO: remove the workaround for problem with fnclex instruction (no CQ known)
- fstenv -32(%rsp) // store FP env
- andw $~0x80ff, 4-32(%rsp) // clear 0-7,15 bits of FP SW
- fldenv -32(%rsp) // load FP env back
- ret
-#else
- fnclex
- ret
-#endif
-
- DEBUG_INFO __kmp_clear_x87_fpu_status_word
-
-
//------------------------------------------------------------------------
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
//
@@ -1359,7 +1185,6 @@ KMP_LABEL(kmp_1_exit):
DEBUG_INFO __kmp_bsr32
-
// -----------------------------------------------------------------------
#endif /* KMP_ARCH_X86_64 */
@@ -1417,7 +1242,7 @@ __tid = 8
orr w9, wzr, #1
add w9, w9, w3, lsr #1
- sub sp, sp, w9, lsl #4
+ sub sp, sp, w9, uxtw #4
mov x11, sp
mov x8, x0
diff --git a/runtime/src/z_Linux_util.cpp b/runtime/src/z_Linux_util.cpp
index aa0302c0fc37..1983fc2b9834 100644
--- a/runtime/src/z_Linux_util.cpp
+++ b/runtime/src/z_Linux_util.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -438,7 +437,7 @@ void __kmp_terminate_thread(int gtid) {
__kmp_msg_null);
}
#endif
- __kmp_yield(TRUE);
+ KMP_YIELD(TRUE);
} //
/* Set thread stack info according to values returned by pthread_getattr_np().
@@ -581,8 +580,6 @@ static void *__kmp_launch_monitor(void *thr) {
sigset_t new_set;
#endif /* KMP_BLOCK_SIGNALS */
struct timespec interval;
- int yield_count;
- int yield_cycles = 0;
KMP_MB(); /* Flush all pending memory write invalidates. */
@@ -666,13 +663,6 @@ static void *__kmp_launch_monitor(void *thr) {
KA_TRACE(10, ("__kmp_launch_monitor: #2 monitor\n"));
- if (__kmp_yield_cycle) {
- __kmp_yielding_on = 0; /* Start out with yielding shut off */
- yield_count = __kmp_yield_off_count;
- } else {
- __kmp_yielding_on = 1; /* Yielding is on permanently */
- }
-
while (!TCR_4(__kmp_global.g.g_done)) {
struct timespec now;
struct timeval tval;
@@ -708,22 +698,6 @@ static void *__kmp_launch_monitor(void *thr) {
status = pthread_mutex_unlock(&__kmp_wait_mx.m_mutex);
KMP_CHECK_SYSFAIL("pthread_mutex_unlock", status);
- if (__kmp_yield_cycle) {
- yield_cycles++;
- if ((yield_cycles % yield_count) == 0) {
- if (__kmp_yielding_on) {
- __kmp_yielding_on = 0; /* Turn it off now */
- yield_count = __kmp_yield_off_count;
- } else {
- __kmp_yielding_on = 1; /* Turn it on now */
- yield_count = __kmp_yield_on_count;
- }
- yield_cycles = 0;
- }
- } else {
- __kmp_yielding_on = 1;
- }
-
TCW_4(__kmp_global.g.g_time.dt.t_value,
TCR_4(__kmp_global.g.g_time.dt.t_value) + 1);
@@ -1012,8 +986,8 @@ retry:
// Wait for the monitor thread is really started and set its *priority*.
KMP_DEBUG_ASSERT(sizeof(kmp_uint32) ==
sizeof(__kmp_global.g.g_time.dt.t_value));
- __kmp_wait_yield_4((kmp_uint32 volatile *)&__kmp_global.g.g_time.dt.t_value,
- -1, &__kmp_neq_4, NULL);
+ __kmp_wait_4((kmp_uint32 volatile *)&__kmp_global.g.g_time.dt.t_value, -1,
+ &__kmp_neq_4, NULL);
#endif // KMP_REAL_TIME_FIX
#ifdef KMP_THREAD_ATTR
@@ -1290,11 +1264,9 @@ static void __kmp_atfork_child(void) {
// over-subscription after the fork and this can improve things for
// scripting languages that use OpenMP inside process-parallel code).
__kmp_affinity_type = affinity_none;
-#if OMP_40_ENABLED
if (__kmp_nested_proc_bind.bind_types != NULL) {
__kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
}
-#endif // OMP_40_ENABLED
#endif // KMP_AFFINITY_SUPPORTED
__kmp_init_runtime = FALSE;
@@ -1378,11 +1350,22 @@ void __kmp_suspend_initialize(void) {
KMP_CHECK_SYSFAIL("pthread_condattr_init", status);
}
-static void __kmp_suspend_initialize_thread(kmp_info_t *th) {
+void __kmp_suspend_initialize_thread(kmp_info_t *th) {
ANNOTATE_HAPPENS_AFTER(&th->th.th_suspend_init_count);
- if (th->th.th_suspend_init_count <= __kmp_fork_count) {
- /* this means we haven't initialized the suspension pthread objects for this
- thread in this instance of the process */
+ int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count);
+ int new_value = __kmp_fork_count + 1;
+ // Return if already initialized
+ if (old_value == new_value)
+ return;
+ // Wait, then return if being initialized
+ if (old_value == -1 ||
+ !__kmp_atomic_compare_store(&th->th.th_suspend_init_count, old_value,
+ -1)) {
+ while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) != new_value) {
+ KMP_CPU_PAUSE();
+ }
+ } else {
+ // Claim to be the initializer and do initializations
int status;
status = pthread_cond_init(&th->th.th_suspend_cv.c_cond,
&__kmp_suspend_cond_attr);
@@ -1390,13 +1373,13 @@ static void __kmp_suspend_initialize_thread(kmp_info_t *th) {
status = pthread_mutex_init(&th->th.th_suspend_mx.m_mutex,
&__kmp_suspend_mutex_attr);
KMP_CHECK_SYSFAIL("pthread_mutex_init", status);
- *(volatile int *)&th->th.th_suspend_init_count = __kmp_fork_count + 1;
+ KMP_ATOMIC_ST_REL(&th->th.th_suspend_init_count, new_value);
ANNOTATE_HAPPENS_BEFORE(&th->th.th_suspend_init_count);
}
}
void __kmp_suspend_uninitialize_thread(kmp_info_t *th) {
- if (th->th.th_suspend_init_count > __kmp_fork_count) {
+ if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init_count) > __kmp_fork_count) {
/* this means we have initialize the suspension pthread objects for this
thread in this instance of the process */
int status;
@@ -1410,10 +1393,26 @@ void __kmp_suspend_uninitialize_thread(kmp_info_t *th) {
KMP_SYSFAIL("pthread_mutex_destroy", status);
}
--th->th.th_suspend_init_count;
- KMP_DEBUG_ASSERT(th->th.th_suspend_init_count == __kmp_fork_count);
+ KMP_DEBUG_ASSERT(KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init_count) ==
+ __kmp_fork_count);
}
}
+// return true if lock obtained, false otherwise
+int __kmp_try_suspend_mx(kmp_info_t *th) {
+ return (pthread_mutex_trylock(&th->th.th_suspend_mx.m_mutex) == 0);
+}
+
+void __kmp_lock_suspend_mx(kmp_info_t *th) {
+ int status = pthread_mutex_lock(&th->th.th_suspend_mx.m_mutex);
+ KMP_CHECK_SYSFAIL("pthread_mutex_lock", status);
+}
+
+void __kmp_unlock_suspend_mx(kmp_info_t *th) {
+ int status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex);
+ KMP_CHECK_SYSFAIL("pthread_mutex_unlock", status);
+}
+
/* This routine puts the calling thread to sleep after setting the
sleep bit for the indicated flag variable to true. */
template <class C>
@@ -1437,7 +1436,13 @@ static inline void __kmp_suspend_template(int th_gtid, C *flag) {
/* TODO: shouldn't this use release semantics to ensure that
__kmp_suspend_initialize_thread gets called first? */
old_spin = flag->set_sleeping();
-
+ if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME &&
+ __kmp_pause_status != kmp_soft_paused) {
+ flag->unset_sleeping();
+ status = pthread_mutex_unlock(&th->th.th_suspend_mx.m_mutex);
+ KMP_CHECK_SYSFAIL("pthread_mutex_unlock", status);
+ return;
+ }
KF_TRACE(5, ("__kmp_suspend_template: T#%d set sleep bit for spin(%p)==%x,"
" was %x\n",
th_gtid, flag->get(), flag->load(), old_spin));
@@ -1666,18 +1671,7 @@ void __kmp_resume_monitor() {
}
#endif // KMP_USE_MONITOR
-void __kmp_yield(int cond) {
- if (!cond)
- return;
-#if KMP_USE_MONITOR
- if (!__kmp_yielding_on)
- return;
-#else
- if (__kmp_yield_cycle && !KMP_YIELD_NOW())
- return;
-#endif
- sched_yield();
-}
+void __kmp_yield() { sched_yield(); }
void __kmp_gtid_set_specific(int gtid) {
if (__kmp_init_gtid) {
@@ -1835,6 +1829,17 @@ void __kmp_runtime_initialize(void) {
__kmp_xproc = __kmp_get_xproc();
+#if ! KMP_32_BIT_ARCH
+ struct rlimit rlim;
+ // read stack size of calling thread, save it as default for worker threads;
+ // this should be done before reading environment variables
+ status = getrlimit(RLIMIT_STACK, &rlim);
+ if (status == 0) { // success?
+ __kmp_stksize = rlim.rlim_cur;
+ __kmp_check_stksize(&__kmp_stksize); // check value and adjust if needed
+ }
+#endif /* KMP_32_BIT_ARCH */
+
if (sysconf(_SC_THREADS)) {
/* Query the maximum number of threads */
diff --git a/runtime/src/z_Windows_NT-586_asm.asm b/runtime/src/z_Windows_NT-586_asm.asm
index eace71872121..7d0e32e107e4 100644
--- a/runtime/src/z_Windows_NT-586_asm.asm
+++ b/runtime/src/z_Windows_NT-586_asm.asm
@@ -4,10 +4,9 @@
;
;//===----------------------------------------------------------------------===//
;//
-;// The LLVM Compiler Infrastructure
-;//
-;// This file is dual licensed under the MIT and the University of Illinois Open
-;// Source Licenses. See LICENSE.txt for details.
+;// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+;// See https://llvm.org/LICENSE.txt for license information.
+;// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
;//
;//===----------------------------------------------------------------------===//
;
diff --git a/runtime/src/z_Windows_NT-586_util.cpp b/runtime/src/z_Windows_NT-586_util.cpp
index 9191c0296a65..b3728a5d975f 100644
--- a/runtime/src/z_Windows_NT-586_util.cpp
+++ b/runtime/src/z_Windows_NT-586_util.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
diff --git a/runtime/src/z_Windows_NT_util.cpp b/runtime/src/z_Windows_NT_util.cpp
index f3d667f19f51..c149dda56e8e 100644
--- a/runtime/src/z_Windows_NT_util.cpp
+++ b/runtime/src/z_Windows_NT_util.cpp
@@ -4,10 +4,9 @@
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.txt for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -159,6 +158,10 @@ void __kmp_win32_mutex_lock(kmp_win32_mutex_t *mx) {
EnterCriticalSection(&mx->cs);
}
+int __kmp_win32_mutex_trylock(kmp_win32_mutex_t *mx) {
+ return TryEnterCriticalSection(&mx->cs);
+}
+
void __kmp_win32_mutex_unlock(kmp_win32_mutex_t *mx) {
LeaveCriticalSection(&mx->cs);
}
@@ -190,8 +193,9 @@ void __kmp_win32_cond_destroy(kmp_win32_cond_t *cv) {
/* TODO associate cv with a team instead of a thread so as to optimize
the case where we wake up a whole team */
-void __kmp_win32_cond_wait(kmp_win32_cond_t *cv, kmp_win32_mutex_t *mx,
- kmp_info_t *th, int need_decrease_load) {
+template <class C>
+static void __kmp_win32_cond_wait(kmp_win32_cond_t *cv, kmp_win32_mutex_t *mx,
+ kmp_info_t *th, C *flag) {
int my_generation;
int last_waiter;
@@ -208,21 +212,46 @@ void __kmp_win32_cond_wait(kmp_win32_cond_t *cv, kmp_win32_mutex_t *mx,
__kmp_win32_mutex_unlock(mx);
for (;;) {
- int wait_done;
-
+ int wait_done = 0;
+ DWORD res, timeout = 5000; // just tried to quess an appropriate number
/* Wait until the event is signaled */
- WaitForSingleObject(cv->event_, INFINITE);
-
- __kmp_win32_mutex_lock(&cv->waiters_count_lock_);
-
- /* Exit the loop when the <cv->event_> is signaled and there are still
- waiting threads from this <wait_generation> that haven't been released
- from this wait yet. */
- wait_done = (cv->release_count_ > 0) &&
- (cv->wait_generation_count_ != my_generation);
-
- __kmp_win32_mutex_unlock(&cv->waiters_count_lock_);
-
+ res = WaitForSingleObject(cv->event_, timeout);
+
+ if (res == WAIT_OBJECT_0) {
+ // event signaled
+ __kmp_win32_mutex_lock(&cv->waiters_count_lock_);
+ /* Exit the loop when the <cv->event_> is signaled and there are still
+ waiting threads from this <wait_generation> that haven't been released
+ from this wait yet. */
+ wait_done = (cv->release_count_ > 0) &&
+ (cv->wait_generation_count_ != my_generation);
+ __kmp_win32_mutex_unlock(&cv->waiters_count_lock_);
+ } else if (res == WAIT_TIMEOUT || res == WAIT_FAILED) {
+ // check if the flag and cv counters are in consistent state
+ // as MS sent us debug dump whith inconsistent state of data
+ __kmp_win32_mutex_lock(mx);
+ typename C::flag_t old_f = flag->set_sleeping();
+ if (!flag->done_check_val(old_f & ~KMP_BARRIER_SLEEP_STATE)) {
+ __kmp_win32_mutex_unlock(mx);
+ continue;
+ }
+ // condition fulfilled, exiting
+ 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())));
+
+ __kmp_win32_mutex_lock(&cv->waiters_count_lock_);
+ KMP_DEBUG_ASSERT(cv->waiters_count_ > 0);
+ cv->release_count_ = cv->waiters_count_;
+ cv->wait_generation_count_++;
+ wait_done = 1;
+ __kmp_win32_mutex_unlock(&cv->waiters_count_lock_);
+
+ __kmp_win32_mutex_unlock(mx);
+ }
/* there used to be a semicolon after the if statement, it looked like a
bug, so i removed it */
if (wait_done)
@@ -280,26 +309,48 @@ void __kmp_disable(int *old_state) {
void __kmp_suspend_initialize(void) { /* do nothing */
}
-static void __kmp_suspend_initialize_thread(kmp_info_t *th) {
- if (!TCR_4(th->th.th_suspend_init)) {
- /* this means we haven't initialized the suspension pthread objects for this
- thread in this instance of the process */
+void __kmp_suspend_initialize_thread(kmp_info_t *th) {
+ int old_value = KMP_ATOMIC_LD_RLX(&th->th.th_suspend_init);
+ int new_value = TRUE;
+ // Return if already initialized
+ if (old_value == new_value)
+ return;
+ // Wait, then return if being initialized
+ if (old_value == -1 ||
+ !__kmp_atomic_compare_store(&th->th.th_suspend_init, old_value, -1)) {
+ while (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init) != new_value) {
+ KMP_CPU_PAUSE();
+ }
+ } else {
+ // Claim to be the initializer and do initializations
__kmp_win32_cond_init(&th->th.th_suspend_cv);
__kmp_win32_mutex_init(&th->th.th_suspend_mx);
- TCW_4(th->th.th_suspend_init, TRUE);
+ KMP_ATOMIC_ST_REL(&th->th.th_suspend_init, new_value);
}
}
void __kmp_suspend_uninitialize_thread(kmp_info_t *th) {
- if (TCR_4(th->th.th_suspend_init)) {
+ if (KMP_ATOMIC_LD_ACQ(&th->th.th_suspend_init)) {
/* this means we have initialize the suspension pthread objects for this
thread in this instance of the process */
__kmp_win32_cond_destroy(&th->th.th_suspend_cv);
__kmp_win32_mutex_destroy(&th->th.th_suspend_mx);
- TCW_4(th->th.th_suspend_init, FALSE);
+ KMP_ATOMIC_ST_REL(&th->th.th_suspend_init, FALSE);
}
}
+int __kmp_try_suspend_mx(kmp_info_t *th) {
+ return __kmp_win32_mutex_trylock(&th->th.th_suspend_mx);
+}
+
+void __kmp_lock_suspend_mx(kmp_info_t *th) {
+ __kmp_win32_mutex_lock(&th->th.th_suspend_mx);
+}
+
+void __kmp_unlock_suspend_mx(kmp_info_t *th) {
+ __kmp_win32_mutex_unlock(&th->th.th_suspend_mx);
+}
+
/* This routine puts the calling thread to sleep after setting the
sleep bit for the indicated flag variable to true. */
template <class C>
@@ -321,6 +372,12 @@ static inline void __kmp_suspend_template(int th_gtid, C *flag) {
/* TODO: shouldn't this use release semantics to ensure that
__kmp_suspend_initialize_thread gets called first? */
old_spin = flag->set_sleeping();
+ if (__kmp_dflt_blocktime == KMP_MAX_BLOCKTIME &&
+ __kmp_pause_status != kmp_soft_paused) {
+ flag->unset_sleeping();
+ __kmp_win32_mutex_unlock(&th->th.th_suspend_mx);
+ return;
+ }
KF_TRACE(5, ("__kmp_suspend_template: T#%d set sleep bit for flag's"
" loc(%p)==%d\n",
@@ -354,12 +411,11 @@ static inline void __kmp_suspend_template(int th_gtid, C *flag) {
KMP_DEBUG_ASSERT(TCR_4(__kmp_thread_pool_active_nth) >= 0);
}
deactivated = TRUE;
-
- __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, 0,
- 0);
+ __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, th,
+ flag);
} else {
- __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, 0,
- 0);
+ __kmp_win32_cond_wait(&th->th.th_suspend_cv, &th->th.th_suspend_mx, th,
+ flag);
}
#ifdef KMP_DEBUG
@@ -460,10 +516,7 @@ void __kmp_resume_oncore(int target_gtid, kmp_flag_oncore *flag) {
__kmp_resume_template(target_gtid, flag);
}
-void __kmp_yield(int cond) {
- if (cond)
- Sleep(0);
-}
+void __kmp_yield() { Sleep(0); }
void __kmp_gtid_set_specific(int gtid) {
if (__kmp_init_gtid) {
@@ -1222,8 +1275,8 @@ static void __kmp_reap_common(kmp_info_t *th) {
Right solution seems to be waiting for *either* thread termination *or*
ds_alive resetting. */
{
- // TODO: This code is very similar to KMP_WAIT_YIELD. Need to generalize
- // KMP_WAIT_YIELD to cover this usage also.
+ // TODO: This code is very similar to KMP_WAIT. Need to generalize
+ // KMP_WAIT to cover this usage also.
void *obj = NULL;
kmp_uint32 spins;
#if USE_ITT_BUILD
@@ -1235,8 +1288,7 @@ static void __kmp_reap_common(kmp_info_t *th) {
KMP_FSYNC_SPIN_PREPARE(obj);
#endif /* USE_ITT_BUILD */
__kmp_is_thread_alive(th, &exit_val);
- KMP_YIELD(TCR_4(__kmp_nth) > __kmp_avail_proc);
- KMP_YIELD_SPIN(spins);
+ KMP_YIELD_OVERSUB_ELSE_SPIN(spins);
} while (exit_val == STILL_ACTIVE && TCR_4(th->th.th_info.ds.ds_alive));
#if USE_ITT_BUILD
if (exit_val == STILL_ACTIVE) {