2 changes: 0 additions & 2 deletions openmp/runtime/src/kmp_taskdeps.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* kmp_taskdeps.h
*/


//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand All @@ -11,7 +10,6 @@
//
//===----------------------------------------------------------------------===//


#ifndef KMP_TASKDEPS_H
#define KMP_TASKDEPS_H

Expand Down
35 changes: 19 additions & 16 deletions openmp/runtime/src/kmp_tasking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,10 @@ static inline void __ompt_task_init(kmp_taskdata_t *task, int tid) {
task->ompt_task_info.task_data.value = 0;
task->ompt_task_info.frame.exit_frame = ompt_data_none;
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;
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;
}

// __ompt_task_start:
Expand Down Expand Up @@ -640,7 +642,8 @@ static void __kmpc_omp_task_begin_if0_template(ident_t *loc_ref, kmp_int32 gtid,
current_task->ompt_task_info.frame.enter_frame.ptr =
taskdata->ompt_task_info.frame.exit_frame.ptr = frame_address;
current_task->ompt_task_info.frame.enter_frame_flags =
taskdata->ompt_task_info.frame.exit_frame_flags = ompt_frame_application | ompt_frame_framepointer;
taskdata->ompt_task_info.frame.exit_frame_flags =
ompt_frame_application | ompt_frame_framepointer;
}
if (ompt_enabled.ompt_callback_task_create) {
ompt_task_info_t *parent_info = &(current_task->ompt_task_info);
Expand Down Expand Up @@ -957,7 +960,6 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t *task,
taskdata->td_flags.executing = 0; // suspend the finishing task
}


KA_TRACE(
20, ("__kmp_task_finish: T#%d finished task %p, %d incomplete children\n",
gtid, taskdata, children));
Expand Down Expand Up @@ -999,7 +1001,8 @@ static void __kmpc_omp_task_complete_if0_template(ident_t *loc_ref,
ompt_frame_t *ompt_frame;
__ompt_get_task_info_internal(0, NULL, NULL, &ompt_frame, NULL, NULL);
ompt_frame->enter_frame = ompt_data_none;
ompt_frame->enter_frame_flags = ompt_frame_runtime | ompt_frame_framepointer;
ompt_frame->enter_frame_flags =
ompt_frame_runtime | ompt_frame_framepointer;
}
#endif

Expand Down Expand Up @@ -1422,7 +1425,7 @@ kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
kmp_tasking_flags_t *input_flags = (kmp_tasking_flags_t *)&flags;
__kmp_assert_valid_gtid(gtid);
input_flags->native = FALSE;
// __kmp_task_alloc() sets up all other runtime flags
// __kmp_task_alloc() sets up all other runtime flags
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",
Expand Down Expand Up @@ -1632,7 +1635,6 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t *task,
KMP_FSYNC_CANCEL(taskdata); // destroy self (just executed)
KMP_FSYNC_RELEASING(taskdata->td_parent); // releasing parent
#endif

}

// Proxy tasks are not handled by the runtime
Expand Down Expand Up @@ -1775,7 +1777,8 @@ kmp_int32 __kmpc_omp_task(ident_t *loc_ref, kmp_int32 gtid,
OMPT_STORE_RETURN_ADDRESS(gtid);
parent = new_taskdata->td_parent;
if (!parent->ompt_task_info.frame.enter_frame.ptr) {
parent->ompt_task_info.frame.enter_frame.ptr = OMPT_GET_FRAME_ADDRESS(0);
parent->ompt_task_info.frame.enter_frame.ptr =
OMPT_GET_FRAME_ADDRESS(0);
}
if (ompt_enabled.ompt_callback_task_create) {
ompt_data_t task_data = ompt_data_none;
Expand Down Expand Up @@ -3341,7 +3344,7 @@ static int __kmp_realloc_task_threads_data(kmp_info_t *thread,
__kmp_init_task_stack(__kmp_gtid_from_thread(thread), thread_data);
}
#endif // BUILD_TIED_TASK_STACK
// Install the new data and free the old data
// Install the new data and free the old data
(*threads_data_p) = new_data;
__kmp_free(old_data);
} else {
Expand Down Expand Up @@ -4261,8 +4264,8 @@ void __kmp_taskloop_linear(ident_t *loc, int gtid, kmp_task_t *task,
kmp_task_t *next_task;
kmp_int32 lastpriv = 0;

KMP_DEBUG_ASSERT(
tc == num_tasks * grainsize + (last_chunk < 0 ? last_chunk : extras));
KMP_DEBUG_ASSERT(tc == num_tasks * grainsize +
(last_chunk < 0 ? last_chunk : extras));
KMP_DEBUG_ASSERT(num_tasks > extras);
KMP_DEBUG_ASSERT(num_tasks > 0);
KA_TRACE(20, ("__kmp_taskloop_linear: T#%d: %lld tasks, grainsize %lld, "
Expand Down Expand Up @@ -4322,7 +4325,7 @@ void __kmp_taskloop_linear(ident_t *loc, int gtid, kmp_task_t *task,
next_task_bounds.get_upper_offset()));
#if OMPT_SUPPORT
__kmp_omp_taskloop_task(NULL, gtid, next_task,
codeptr_ra); // schedule new task
codeptr_ra); // schedule new task
#else
__kmp_omp_task(gtid, next_task, true); // schedule new task
#endif
Expand Down Expand Up @@ -4458,8 +4461,8 @@ void __kmp_taskloop_recur(ident_t *loc, int gtid, kmp_task_t *task,
size_t upper_offset =
(char *)ub - (char *)task; // remember offset of ub in the task structure

KMP_DEBUG_ASSERT(
tc == num_tasks * grainsize + (last_chunk < 0 ? last_chunk : extras));
KMP_DEBUG_ASSERT(tc == num_tasks * grainsize +
(last_chunk < 0 ? last_chunk : extras));
KMP_DEBUG_ASSERT(num_tasks > extras);
KMP_DEBUG_ASSERT(num_tasks > 0);

Expand Down Expand Up @@ -4653,8 +4656,8 @@ static void __kmp_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
KMP_ASSERT2(0, "unknown scheduling of taskloop");
}

KMP_DEBUG_ASSERT(
tc == num_tasks * grainsize + (last_chunk < 0 ? last_chunk : extras));
KMP_DEBUG_ASSERT(tc == num_tasks * grainsize +
(last_chunk < 0 ? last_chunk : extras));
KMP_DEBUG_ASSERT(num_tasks > extras);
KMP_DEBUG_ASSERT(num_tasks > 0);
// =========================================================================
Expand Down
2 changes: 1 addition & 1 deletion openmp/runtime/src/kmp_threadprivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ struct private_common *kmp_threadprivate_insert(int gtid, void *pc_addr,
}

__kmp_release_lock(&__kmp_global_lock, gtid);
/* +++++++++ END OF CRITICAL SECTION +++++++++ */
/* +++++++++ END OF CRITICAL SECTION +++++++++ */

#ifdef USE_CHECKS_COMMON
if (pc_size > d_tn->cmn_size) {
Expand Down
2 changes: 1 addition & 1 deletion openmp/runtime/src/kmp_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int __kmp_get_logical_id(int log_per_phy, int apic_id) {

static kmp_uint64 __kmp_parse_frequency( // R: Frequency in Hz.
char const *frequency // I: Float number and unit: MHz, GHz, or TGz.
) {
) {

double value = 0.0;
char *unit = NULL;
Expand Down
2 changes: 1 addition & 1 deletion openmp/runtime/src/kmp_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void __kmp_print_version_1(void) {
#else
"no"
#endif
);
);
__kmp_printf("%s", buffer.str);
__kmp_str_buf_free(&buffer);
K_DIAG(1, ("KMP_VERSION is true\n"));
Expand Down
2 changes: 1 addition & 1 deletion openmp/runtime/src/kmp_wait_release.h
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ class kmp_flag_oncore : public kmp_flag_native<kmp_uint64> {
else if (flag_switch) {
this_thr->th.th_bar[bt].bb.wait_flag = KMP_BARRIER_SWITCHING;
kmp_flag_64<> flag(&this_thr->th.th_bar[bt].bb.b_go,
(kmp_uint64)KMP_BARRIER_STATE_BUMP);
(kmp_uint64)KMP_BARRIER_STATE_BUMP);
__kmp_wait_64(this_thr, &flag, TRUE USE_ITT_BUILD_ARG(itt_sync_obj));
}
return false;
Expand Down
3 changes: 1 addition & 2 deletions openmp/runtime/src/ompt-event-specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@

#define ompt_callback_mutex_released_implemented ompt_event_MAY_ALWAYS_OPTIONAL

#define ompt_callback_dependences_implemented \
ompt_event_MAY_ALWAYS_OPTIONAL
#define ompt_callback_dependences_implemented ompt_event_MAY_ALWAYS_OPTIONAL
#define ompt_callback_task_dependence_implemented ompt_event_MAY_ALWAYS_OPTIONAL

#define ompt_callback_work_implemented ompt_event_MAY_ALWAYS_OPTIONAL
Expand Down
19 changes: 11 additions & 8 deletions openmp/runtime/src/ompt-general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ ompt_try_start_tool(unsigned int omp_version, const char *runtime_version) {
#else
#error Activation of OMPT is not supported on this platform.
#endif
{// if (start_tool)
{ // if (start_tool)
ret = (*start_tool)(omp_version, runtime_version);
if (ret) {
OMPT_VERBOSE_INIT_CONTINUED_PRINT("Success.\n");
Expand Down Expand Up @@ -428,9 +428,10 @@ void ompt_pre_init() {
break;

case omp_tool_error:
fprintf(stderr, "Warning: OMP_TOOL has invalid value \"%s\".\n"
" legal values are (NULL,\"\",\"disabled\","
"\"enabled\").\n",
fprintf(stderr,
"Warning: OMP_TOOL has invalid value \"%s\".\n"
" legal values are (NULL,\"\",\"disabled\","
"\"enabled\").\n",
ompt_env_var);
break;
}
Expand Down Expand Up @@ -459,7 +460,8 @@ void ompt_post_init() {
//--------------------------------------------------
if (ompt_start_tool_result) {
ompt_enabled.enabled = !!ompt_start_tool_result->initialize(
ompt_fn_lookup, omp_get_initial_device(), &(ompt_start_tool_result->tool_data));
ompt_fn_lookup, omp_get_initial_device(),
&(ompt_start_tool_result->tool_data));

if (!ompt_enabled.enabled) {
// tool not enabled, zero out the bitmap, and done
Expand All @@ -477,7 +479,8 @@ void ompt_post_init() {
}
ompt_data_t *task_data;
ompt_data_t *parallel_data;
__ompt_get_task_info_internal(0, NULL, &task_data, NULL, &parallel_data, NULL);
__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);
Expand Down Expand Up @@ -540,7 +543,7 @@ OMPT_API_ROUTINE int ompt_enumerate_mutex_impls(int current_impl,
****************************************************************************/

OMPT_API_ROUTINE ompt_set_result_t ompt_set_callback(ompt_callbacks_t which,
ompt_callback_t callback) {
ompt_callback_t callback) {
switch (which) {

#define ompt_event_macro(event_name, callback_type, event_id) \
Expand Down Expand Up @@ -782,7 +785,7 @@ OMPT_API_ROUTINE int ompt_get_ompt_version() { return OMPT_VERSION; }
*/

/*****************************************************************************
* application-facing API
* application-facing API
****************************************************************************/

/*----------------------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions openmp/runtime/src/ompt-specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
void __ompt_team_assign_id(kmp_team_t *team, ompt_data_t ompt_pid);
void __ompt_thread_assign_wait_id(void *variable);

void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr,
int gtid, ompt_data_t *ompt_pid, void *codeptr);
void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int gtid,
ompt_data_t *ompt_pid, void *codeptr);

void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, kmp_info_t *thr,
int on_heap, bool always = false);
Expand Down Expand Up @@ -85,9 +85,9 @@ inline void *__ompt_load_return_address(int gtid) {
#define OMPT_LOAD_RETURN_ADDRESS(gtid) __ompt_load_return_address(gtid)
#define OMPT_LOAD_OR_GET_RETURN_ADDRESS(gtid) \
((ompt_enabled.enabled && gtid >= 0 && __kmp_threads[gtid] && \
__kmp_threads[gtid]->th.ompt_thread_info.return_address)? \
__ompt_load_return_address(gtid): \
__builtin_return_address(0))
__kmp_threads[gtid]->th.ompt_thread_info.return_address) \
? __ompt_load_return_address(gtid) \
: __builtin_return_address(0))

//******************************************************************************
// inline functions
Expand Down
14 changes: 6 additions & 8 deletions openmp/runtime/src/test-touch.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// test-touch.c //


//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand All @@ -9,22 +8,21 @@
//
//===----------------------------------------------------------------------===//


#ifdef __cplusplus
extern "C" {
#endif
extern double omp_get_wtime();
extern int omp_get_num_threads();
extern int omp_get_max_threads();
extern int omp_get_num_threads();
extern int omp_get_max_threads();
#ifdef __cplusplus
}
#endif

int main() {
omp_get_wtime();
omp_get_num_threads();
omp_get_max_threads();
return 0;
omp_get_wtime();
omp_get_num_threads();
omp_get_max_threads();
return 0;
}

// end of file //
23 changes: 12 additions & 11 deletions openmp/runtime/src/thirdparty/ittnotify/disable_warnings.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// clang-format off
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand All @@ -7,23 +7,24 @@
//
//===----------------------------------------------------------------------===//


#include "ittnotify_config.h"

#if ITT_PLATFORM==ITT_PLATFORM_WIN
#if ITT_PLATFORM == ITT_PLATFORM_WIN

#pragma warning (disable: 593) /* parameter "XXXX" was set but never used */
#pragma warning (disable: 344) /* typedef name has already been declared (with same type) */
#pragma warning (disable: 174) /* expression has no effect */
#pragma warning (disable: 4127) /* conditional expression is constant */
#pragma warning (disable: 4306) /* conversion from '?' to '?' of greater size */
#pragma warning(disable: 593) /* parameter "XXXX" was set but never used */
#pragma warning(disable: 344) /* typedef name has already been declared (with
same type) */
#pragma warning(disable: 174) /* expression has no effect */
#pragma warning(disable: 4127) /* conditional expression is constant */
#pragma warning(disable: 4306) /* conversion from '?' to '?' of greater size */

#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */

#if defined __INTEL_COMPILER

#pragma warning (disable: 869) /* parameter "XXXXX" was never referenced */
#pragma warning (disable: 1418) /* external function definition with no prior declaration */
#pragma warning (disable: 1419) /* external declaration in primary source file */
#pragma warning(disable: 869) /* parameter "XXXXX" was never referenced */
#pragma warning(disable: 1418) /* external function definition with no prior
declaration */
#pragma warning(disable: 1419) /* external declaration in primary source file */

#endif /* __INTEL_COMPILER */
3,060 changes: 1,725 additions & 1,335 deletions openmp/runtime/src/thirdparty/ittnotify/ittnotify.h

Large diffs are not rendered by default.

774 changes: 393 additions & 381 deletions openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h

Large diffs are not rendered by default.

1,809 changes: 921 additions & 888 deletions openmp/runtime/src/thirdparty/ittnotify/ittnotify_static.cpp

Large diffs are not rendered by default.

927 changes: 672 additions & 255 deletions openmp/runtime/src/thirdparty/ittnotify/ittnotify_static.h

Large diffs are not rendered by default.

85 changes: 40 additions & 45 deletions openmp/runtime/src/thirdparty/ittnotify/ittnotify_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,56 @@
//
//===----------------------------------------------------------------------===//


#ifndef _ITTNOTIFY_TYPES_H_
#define _ITTNOTIFY_TYPES_H_

typedef enum ___itt_group_id
{
__itt_group_none = 0,
__itt_group_legacy = 1<<0,
__itt_group_control = 1<<1,
__itt_group_thread = 1<<2,
__itt_group_mark = 1<<3,
__itt_group_sync = 1<<4,
__itt_group_fsync = 1<<5,
__itt_group_jit = 1<<6,
__itt_group_model = 1<<7,
__itt_group_splitter_min = 1<<7,
__itt_group_counter = 1<<8,
__itt_group_frame = 1<<9,
__itt_group_stitch = 1<<10,
__itt_group_heap = 1<<11,
__itt_group_splitter_max = 1<<12,
__itt_group_structure = 1<<12,
__itt_group_suppress = 1<<13,
__itt_group_arrays = 1<<14,
__itt_group_all = -1
typedef enum ___itt_group_id {
__itt_group_none = 0,
__itt_group_legacy = 1 << 0,
__itt_group_control = 1 << 1,
__itt_group_thread = 1 << 2,
__itt_group_mark = 1 << 3,
__itt_group_sync = 1 << 4,
__itt_group_fsync = 1 << 5,
__itt_group_jit = 1 << 6,
__itt_group_model = 1 << 7,
__itt_group_splitter_min = 1 << 7,
__itt_group_counter = 1 << 8,
__itt_group_frame = 1 << 9,
__itt_group_stitch = 1 << 10,
__itt_group_heap = 1 << 11,
__itt_group_splitter_max = 1 << 12,
__itt_group_structure = 1 << 12,
__itt_group_suppress = 1 << 13,
__itt_group_arrays = 1 << 14,
__itt_group_all = -1
} __itt_group_id;

#pragma pack(push, 8)

typedef struct ___itt_group_list
{
__itt_group_id id;
const char* name;
typedef struct ___itt_group_list {
__itt_group_id id;
const char *name;
} __itt_group_list;

#pragma pack(pop)

#define ITT_GROUP_LIST(varname) \
static __itt_group_list varname[] = { \
{ __itt_group_all, "all" }, \
{ __itt_group_control, "control" }, \
{ __itt_group_thread, "thread" }, \
{ __itt_group_mark, "mark" }, \
{ __itt_group_sync, "sync" }, \
{ __itt_group_fsync, "fsync" }, \
{ __itt_group_jit, "jit" }, \
{ __itt_group_model, "model" }, \
{ __itt_group_counter, "counter" }, \
{ __itt_group_frame, "frame" }, \
{ __itt_group_stitch, "stitch" }, \
{ __itt_group_heap, "heap" }, \
{ __itt_group_structure, "structure" }, \
{ __itt_group_suppress, "suppress" }, \
{ __itt_group_arrays, "arrays" }, \
{ __itt_group_none, NULL } \
}
#define ITT_GROUP_LIST(varname) \
static __itt_group_list varname[] = {{__itt_group_all, "all"}, \
{__itt_group_control, "control"}, \
{__itt_group_thread, "thread"}, \
{__itt_group_mark, "mark"}, \
{__itt_group_sync, "sync"}, \
{__itt_group_fsync, "fsync"}, \
{__itt_group_jit, "jit"}, \
{__itt_group_model, "model"}, \
{__itt_group_counter, "counter"}, \
{__itt_group_frame, "frame"}, \
{__itt_group_stitch, "stitch"}, \
{__itt_group_heap, "heap"}, \
{__itt_group_structure, "structure"}, \
{__itt_group_suppress, "suppress"}, \
{__itt_group_arrays, "arrays"}, \
{__itt_group_none, NULL}}

#endif /* _ITTNOTIFY_TYPES_H_ */
677 changes: 374 additions & 303 deletions openmp/runtime/src/thirdparty/ittnotify/legacy/ittnotify.h

Large diffs are not rendered by default.

75 changes: 37 additions & 38 deletions openmp/runtime/src/z_Linux_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,14 @@ void __kmp_affinity_bind_thread(int which) {
* Linux* OS by checking __NR_sched_{get,set}affinity system calls, and set
* __kmp_affin_mask_size to the appropriate value (0 means not capable). */
void __kmp_affinity_determine_capable(const char *env_var) {
// Check and see if the OS supports thread affinity.
// Check and see if the OS supports thread affinity.

#if KMP_OS_LINUX
#define KMP_CPU_SET_SIZE_LIMIT (1024 * 1024)
#elif KMP_OS_FREEBSD
#define KMP_CPU_SET_SIZE_LIMIT (sizeof(cpuset_t))
#endif


#if KMP_OS_LINUX
// If Linux* OS:
// If the syscall fails or returns a suggestion for the size,
Expand Down Expand Up @@ -281,15 +280,16 @@ void __kmp_affinity_determine_capable(const char *env_var) {
long gCode;
unsigned char *buf;
buf = (unsigned char *)KMP_INTERNAL_MALLOC(KMP_CPU_SET_SIZE_LIMIT);
gCode = pthread_getaffinity_np(pthread_self(), KMP_CPU_SET_SIZE_LIMIT, reinterpret_cast<cpuset_t *>(buf));
gCode = pthread_getaffinity_np(pthread_self(), KMP_CPU_SET_SIZE_LIMIT,
reinterpret_cast<cpuset_t *>(buf));
KA_TRACE(30, ("__kmp_affinity_determine_capable: "
"initial getaffinity call returned %d errno = %d\n",
gCode, errno));
if (gCode == 0) {
KMP_AFFINITY_ENABLE(KMP_CPU_SET_SIZE_LIMIT);
KA_TRACE(10, ("__kmp_affinity_determine_capable: "
"affinity supported (mask size %d)\n",
(int)__kmp_affin_mask_size));
(int)__kmp_affin_mask_size));
KMP_INTERNAL_FREE(buf);
return;
}
Expand Down Expand Up @@ -474,7 +474,7 @@ void __kmp_terminate_thread(int gtid) {
static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) {
int stack_data;
#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
KMP_OS_HURD
KMP_OS_HURD
pthread_attr_t attr;
int status;
size_t size = 0;
Expand Down Expand Up @@ -512,8 +512,8 @@ static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) {
TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE);
return TRUE;
}
#endif /* KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD ||
KMP_OS_HURD */
#endif /* KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD \
|| KMP_OS_HURD */
/* Use incremental refinement starting from initial conservative estimate */
TCW_PTR(th->th.th_info.ds.ds_stacksize, 0);
TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data);
Expand All @@ -528,7 +528,7 @@ static void *__kmp_launch_worker(void *thr) {
#endif /* KMP_BLOCK_SIGNALS */
void *exit_val;
#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
KMP_OS_OPENBSD || KMP_OS_HURD
KMP_OS_OPENBSD || KMP_OS_HURD
void *volatile padding = 0;
#endif
int gtid;
Expand Down Expand Up @@ -577,7 +577,7 @@ static void *__kmp_launch_worker(void *thr) {
#endif /* KMP_BLOCK_SIGNALS */

#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
KMP_OS_OPENBSD
KMP_OS_OPENBSD
if (__kmp_stkoffset > 0 && gtid > 0) {
padding = KMP_ALLOCA(gtid * __kmp_stkoffset);
}
Expand Down Expand Up @@ -830,10 +830,10 @@ void __kmp_create_worker(int gtid, kmp_info_t *th, size_t stack_size) {
stack_size += gtid * __kmp_stkoffset * 2;

#if defined(__ANDROID__) && __ANDROID_API__ < 19
// Round the stack size to a multiple of the page size. Older versions of
// Android (until KitKat) would fail pthread_attr_setstacksize with EINVAL
// if the stack size was not a multiple of the page size.
stack_size = (stack_size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
// Round the stack size to a multiple of the page size. Older versions of
// Android (until KitKat) would fail pthread_attr_setstacksize with EINVAL
// if the stack size was not a multiple of the page size.
stack_size = (stack_size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
#endif

KA_TRACE(10, ("__kmp_create_worker: T#%d, default stacksize = %lu bytes, "
Expand Down Expand Up @@ -1395,9 +1395,8 @@ void __kmp_suspend_initialize_thread(kmp_info_t *th) {
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)) {
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();
}
Expand Down Expand Up @@ -1807,7 +1806,7 @@ static int __kmp_get_xproc(void) {
int r = 0;

#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
KMP_OS_OPENBSD || KMP_OS_HURD
KMP_OS_OPENBSD || KMP_OS_HURD

__kmp_type_convert(sysconf(_SC_NPROCESSORS_ONLN), &(r));

Expand Down Expand Up @@ -1870,7 +1869,7 @@ void __kmp_runtime_initialize(void) {

__kmp_xproc = __kmp_get_xproc();

#if ! KMP_32_BIT_ARCH
#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
Expand Down Expand Up @@ -2015,8 +2014,8 @@ int __kmp_is_address_mapped(void *addr) {

#if KMP_OS_LINUX || KMP_OS_HURD

/* On GNUish OSes, read the /proc/<pid>/maps pseudo-file to get all the address
ranges mapped into the address space. */
/* On GNUish OSes, read the /proc/<pid>/maps pseudo-file to get all the
address ranges mapped into the address space. */

char *name = __kmp_str_format("/proc/%d/maps", getpid());
FILE *file = NULL;
Expand Down Expand Up @@ -2057,36 +2056,36 @@ int __kmp_is_address_mapped(void *addr) {
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
rc = sysctl(mib, 4, NULL, &lstsz, NULL, 0);
if (rc < 0)
return 0;
return 0;
// We pass from number of vm entry's semantic
// to size of whole entry map list.
lstsz = lstsz * 4 / 3;
buf = reinterpret_cast<char *>(kmpc_malloc(lstsz));
rc = sysctl(mib, 4, buf, &lstsz, NULL, 0);
if (rc < 0) {
kmpc_free(buf);
return 0;
kmpc_free(buf);
return 0;
}

char *lw = buf;
char *up = buf + lstsz;

while (lw < up) {
struct kinfo_vmentry *cur = reinterpret_cast<struct kinfo_vmentry *>(lw);
size_t cursz = cur->kve_structsize;
if (cursz == 0)
break;
void *start = reinterpret_cast<void *>(cur->kve_start);
void *end = reinterpret_cast<void *>(cur->kve_end);
// Readable/Writable addresses within current map entry
if ((addr >= start) && (addr < end)) {
if ((cur->kve_protection & KVME_PROT_READ) != 0 &&
(cur->kve_protection & KVME_PROT_WRITE) != 0) {
found = 1;
break;
}
struct kinfo_vmentry *cur = reinterpret_cast<struct kinfo_vmentry *>(lw);
size_t cursz = cur->kve_structsize;
if (cursz == 0)
break;
void *start = reinterpret_cast<void *>(cur->kve_start);
void *end = reinterpret_cast<void *>(cur->kve_end);
// Readable/Writable addresses within current map entry
if ((addr >= start) && (addr < end)) {
if ((cur->kve_protection & KVME_PROT_READ) != 0 &&
(cur->kve_protection & KVME_PROT_WRITE) != 0) {
found = 1;
break;
}
lw += cursz;
}
lw += cursz;
}
kmpc_free(buf);

Expand All @@ -2103,7 +2102,7 @@ int __kmp_is_address_mapped(void *addr) {
1, // Number of bytes to be read.
(vm_address_t)(&buffer), // Address of buffer to save read bytes in.
&count // Address of var to save number of read bytes in.
);
);
if (rc == 0) {
// Memory successfully read.
found = 1;
Expand Down
2 changes: 0 additions & 2 deletions openmp/tools/archer/ompt-tsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,6 @@ static void ompt_tsan_sync_region(ompt_sync_region_t kind,
case ompt_sync_region_reduction:
// should never be reached
break;

}
if (endpoint == ompt_scope_begin)
break;
Expand Down Expand Up @@ -683,7 +682,6 @@ static void ompt_tsan_sync_region(ompt_sync_region_t kind,
// Should not occur according to OpenMP 5.1
// Tested in OMPT tests
break;

}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion openmp/tools/multiplex/ompt-multiplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
#define _GNU_SOURCE
#endif
#include <dlfcn.h>
#include <errno.h>
#include <execinfo.h>
#include <inttypes.h>
#include <omp-tools.h>
#include <omp.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

static ompt_set_callback_t ompt_multiplex_set_callback;
static ompt_get_task_info_t ompt_multiplex_get_task_info;
Expand Down