mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-21 06:52:10 +00:00
[OMPT] Cleanup reset of exit_frame pointer
This is done at call-site and does not need to be handled in __kmp_invoke_microtask. It was already absent from the x86 and x86_64 assembly, this patch removes it from the generic implementation in z_Linux_util.cpp and adds documentation for AArch64 and PPC64 that it's actually not needed. I can't test on these architectures, so I don't want to change the code just because it looks right :) While at it, rename some variables for consistency and add a check in test/ompt/parallel/normal.c that the pointer was reset before entering the barrier. Differential Revision: https://reviews.llvm.org/D64442 llvm-svn: 366721
This commit is contained in:
parent
06b8fe8d03
commit
a2748c74d6
@ -1517,14 +1517,14 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
parent_team->t.t_serialized--;
|
||||
#if OMPT_SUPPORT
|
||||
void *dummy;
|
||||
void **exit_runtime_p;
|
||||
void **exit_frame_p;
|
||||
|
||||
ompt_lw_taskteam_t lw_taskteam;
|
||||
|
||||
if (ompt_enabled.enabled) {
|
||||
__ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid,
|
||||
&ompt_parallel_data, return_address);
|
||||
exit_runtime_p = &(lw_taskteam.ompt_task_info.frame.exit_frame.ptr);
|
||||
exit_frame_p = &(lw_taskteam.ompt_task_info.frame.exit_frame.ptr);
|
||||
|
||||
__ompt_lw_taskteam_link(&lw_taskteam, master_th, 0);
|
||||
// don't use lw_taskteam after linking. content was swaped
|
||||
@ -1542,7 +1542,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
/* OMPT state */
|
||||
master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
} else {
|
||||
exit_runtime_p = &dummy;
|
||||
exit_frame_p = &dummy;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1552,14 +1552,14 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
__kmp_invoke_microtask(microtask, gtid, 0, argc, parent_team->t.t_argv
|
||||
#if OMPT_SUPPORT
|
||||
,
|
||||
exit_runtime_p
|
||||
exit_frame_p
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
*exit_runtime_p = NULL;
|
||||
if (ompt_enabled.enabled) {
|
||||
*exit_frame_p = NULL;
|
||||
OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none;
|
||||
if (ompt_enabled.ompt_callback_implicit_task) {
|
||||
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
|
||||
@ -1714,7 +1714,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
void *dummy;
|
||||
void **exit_runtime_p;
|
||||
void **exit_frame_p;
|
||||
ompt_task_info_t *task_info;
|
||||
|
||||
ompt_lw_taskteam_t lw_taskteam;
|
||||
@ -1727,7 +1727,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
// don't use lw_taskteam after linking. content was swaped
|
||||
|
||||
task_info = OMPT_CUR_TASK_INFO(master_th);
|
||||
exit_runtime_p = &(task_info->frame.exit_frame.ptr);
|
||||
exit_frame_p = &(task_info->frame.exit_frame.ptr);
|
||||
if (ompt_enabled.ompt_callback_implicit_task) {
|
||||
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
|
||||
ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
|
||||
@ -1739,7 +1739,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
/* OMPT state */
|
||||
master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
} else {
|
||||
exit_runtime_p = &dummy;
|
||||
exit_frame_p = &dummy;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1750,14 +1750,14 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
parent_team->t.t_argv
|
||||
#if OMPT_SUPPORT
|
||||
,
|
||||
exit_runtime_p
|
||||
exit_frame_p
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_enabled.enabled) {
|
||||
exit_runtime_p = NULL;
|
||||
*exit_frame_p = NULL;
|
||||
if (ompt_enabled.ompt_callback_implicit_task) {
|
||||
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
|
||||
ompt_scope_end, NULL, &(task_info->task_data), 1,
|
||||
@ -1813,7 +1813,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
void *dummy;
|
||||
void **exit_runtime_p;
|
||||
void **exit_frame_p;
|
||||
ompt_task_info_t *task_info;
|
||||
|
||||
ompt_lw_taskteam_t lw_taskteam;
|
||||
@ -1824,7 +1824,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
__ompt_lw_taskteam_link(&lw_taskteam, master_th, 0);
|
||||
// don't use lw_taskteam after linking. content was swaped
|
||||
task_info = OMPT_CUR_TASK_INFO(master_th);
|
||||
exit_runtime_p = &(task_info->frame.exit_frame.ptr);
|
||||
exit_frame_p = &(task_info->frame.exit_frame.ptr);
|
||||
|
||||
/* OMPT implicit task begin */
|
||||
implicit_task_data = OMPT_CUR_TASK_DATA(master_th);
|
||||
@ -1839,7 +1839,7 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
/* OMPT state */
|
||||
master_th->th.ompt_thread_info.state = ompt_state_work_parallel;
|
||||
} else {
|
||||
exit_runtime_p = &dummy;
|
||||
exit_frame_p = &dummy;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1849,14 +1849,14 @@ int __kmp_fork_call(ident_t *loc, int gtid,
|
||||
__kmp_invoke_microtask(microtask, gtid, 0, argc, args
|
||||
#if OMPT_SUPPORT
|
||||
,
|
||||
exit_runtime_p
|
||||
exit_frame_p
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
if (ompt_enabled.enabled) {
|
||||
*exit_runtime_p = NULL;
|
||||
*exit_frame_p = NULL;
|
||||
if (ompt_enabled.ompt_callback_implicit_task) {
|
||||
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
|
||||
ompt_scope_end, NULL, &(task_info->task_data), 1,
|
||||
@ -6956,16 +6956,16 @@ int __kmp_invoke_task_func(int gtid) {
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
void *dummy;
|
||||
void **exit_runtime_p;
|
||||
void **exit_frame_p;
|
||||
ompt_data_t *my_task_data;
|
||||
ompt_data_t *my_parallel_data;
|
||||
int ompt_team_size;
|
||||
|
||||
if (ompt_enabled.enabled) {
|
||||
exit_runtime_p = &(
|
||||
exit_frame_p = &(
|
||||
team->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_frame.ptr);
|
||||
} else {
|
||||
exit_runtime_p = &dummy;
|
||||
exit_frame_p = &dummy;
|
||||
}
|
||||
|
||||
my_task_data =
|
||||
@ -6994,11 +6994,11 @@ int __kmp_invoke_task_func(int gtid) {
|
||||
tid, (int)team->t.t_argc, (void **)team->t.t_argv
|
||||
#if OMPT_SUPPORT
|
||||
,
|
||||
exit_runtime_p
|
||||
exit_frame_p
|
||||
#endif
|
||||
);
|
||||
#if OMPT_SUPPORT
|
||||
*exit_runtime_p = NULL;
|
||||
*exit_frame_p = NULL;
|
||||
#endif
|
||||
|
||||
#if KMP_STATS_ENABLED
|
||||
|
@ -495,13 +495,21 @@ __kmp_unnamed_critical_addr:
|
||||
# endif /* !KMP_ASM_INTRINS */
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||
//
|
||||
// int
|
||||
// __kmp_invoke_microtask( microtask_t pkfn, int gtid, int tid,
|
||||
// int argc, void *p_argv[] ) {
|
||||
// (*pkfn)( & gtid, & gtid, argv[0], ... );
|
||||
// return 1;
|
||||
// __kmp_invoke_microtask( void (*pkfn) (int gtid, int tid, ...),
|
||||
// int gtid, int tid,
|
||||
// int argc, void *p_argv[]
|
||||
// #if OMPT_SUPPORT
|
||||
// ,
|
||||
// void **exit_frame_ptr
|
||||
// #endif
|
||||
// ) {
|
||||
// #if OMPT_SUPPORT
|
||||
// *exit_frame_ptr = OMPT_GET_FRAME_ADDRESS(0);
|
||||
// #endif
|
||||
//
|
||||
// (*pkfn)( & gtid, & tid, argv[0], ... );
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
// -- Begin __kmp_invoke_microtask
|
||||
@ -991,14 +999,21 @@ KMP_LABEL(invoke_3):
|
||||
# endif /* !KMP_ASM_INTRINS */
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||
//
|
||||
// int
|
||||
// __kmp_invoke_microtask( void (*pkfn) (int gtid, int tid, ...),
|
||||
// int gtid, int tid,
|
||||
// int argc, void *p_argv[] ) {
|
||||
// (*pkfn)( & gtid, & tid, argv[0], ... );
|
||||
// return 1;
|
||||
// int gtid, int tid,
|
||||
// int argc, void *p_argv[]
|
||||
// #if OMPT_SUPPORT
|
||||
// ,
|
||||
// void **exit_frame_ptr
|
||||
// #endif
|
||||
// ) {
|
||||
// #if OMPT_SUPPORT
|
||||
// *exit_frame_ptr = OMPT_GET_FRAME_ADDRESS(0);
|
||||
// #endif
|
||||
//
|
||||
// (*pkfn)( & gtid, & tid, argv[0], ... );
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// note: at call to pkfn must have %rsp 128-byte aligned for compiler
|
||||
@ -1192,15 +1207,27 @@ KMP_LABEL(kmp_1_exit):
|
||||
#if (KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||
//
|
||||
// int
|
||||
// __kmp_invoke_microtask( void (*pkfn) (int gtid, int tid, ...),
|
||||
// int gtid, int tid,
|
||||
// int argc, void *p_argv[] ) {
|
||||
// (*pkfn)( & gtid, & tid, argv[0], ... );
|
||||
// return 1;
|
||||
// int gtid, int tid,
|
||||
// int argc, void *p_argv[]
|
||||
// #if OMPT_SUPPORT
|
||||
// ,
|
||||
// void **exit_frame_ptr
|
||||
// #endif
|
||||
// ) {
|
||||
// #if OMPT_SUPPORT
|
||||
// *exit_frame_ptr = OMPT_GET_FRAME_ADDRESS(0);
|
||||
// #endif
|
||||
//
|
||||
// (*pkfn)( & gtid, & tid, argv[0], ... );
|
||||
//
|
||||
// // FIXME: This is done at call-site and can be removed here.
|
||||
// #if OMPT_SUPPORT
|
||||
// *exit_frame_ptr = 0;
|
||||
// #endif
|
||||
//
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// parameters:
|
||||
@ -1306,15 +1333,27 @@ KMP_LABEL(kmp_1):
|
||||
#if KMP_ARCH_PPC64
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// typedef void (*microtask_t)( int *gtid, int *tid, ... );
|
||||
//
|
||||
// int
|
||||
// __kmp_invoke_microtask( void (*pkfn) (int gtid, int tid, ...),
|
||||
// int gtid, int tid,
|
||||
// int argc, void *p_argv[] ) {
|
||||
// (*pkfn)( & gtid, & tid, argv[0], ... );
|
||||
// return 1;
|
||||
// int gtid, int tid,
|
||||
// int argc, void *p_argv[]
|
||||
// #if OMPT_SUPPORT
|
||||
// ,
|
||||
// void **exit_frame_ptr
|
||||
// #endif
|
||||
// ) {
|
||||
// #if OMPT_SUPPORT
|
||||
// *exit_frame_ptr = OMPT_GET_FRAME_ADDRESS(0);
|
||||
// #endif
|
||||
//
|
||||
// (*pkfn)( & gtid, & tid, argv[0], ... );
|
||||
//
|
||||
// // FIXME: This is done at call-site and can be removed here.
|
||||
// #if OMPT_SUPPORT
|
||||
// *exit_frame_ptr = 0;
|
||||
// #endif
|
||||
//
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// parameters:
|
||||
|
@ -2415,10 +2415,6 @@ int __kmp_invoke_microtask(microtask_t pkfn, int gtid, int tid, int argc,
|
||||
break;
|
||||
}
|
||||
|
||||
#if OMPT_SUPPORT
|
||||
*exit_frame_ptr = 0;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,9 @@ int main() {
|
||||
// THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin
|
||||
// THREADS-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
// THREADS-SAME: codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}}
|
||||
// THREADS: {{^}}[[MASTER_ID]]: task level 0
|
||||
// THREADS-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
// THREADS-SAME: exit_frame=[[NULL]], reenter_frame=[[NULL]]
|
||||
// THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_end
|
||||
// parallel_id is 0 because the region ended in the barrier!
|
||||
// THREADS-SAME: parallel_id=0, task_id=[[IMPLICIT_TASK_ID]]
|
||||
|
Loading…
Reference in New Issue
Block a user