forked from OSchip/llvm-project
[OMPT] Fix parallel_id and task_id in loop_end with schedule static
For serialized parallel regions, wrong ids were reported. Now the same code is used as in kmp_dispatch.cpp which emits the correct ids. Differential Revision: http://reviews.llvm.org/D18348 llvm-svn: 264266
This commit is contained in:
parent
801fe9bbe2
commit
e46a494a50
|
@ -1559,13 +1559,10 @@ __kmpc_for_static_fini( ident_t *loc, kmp_int32 global_tid )
|
|||
#if OMPT_SUPPORT && OMPT_TRACE
|
||||
if (ompt_enabled &&
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_end)) {
|
||||
kmp_info_t *this_thr = __kmp_threads[ global_tid ];
|
||||
kmp_team_t *team = this_thr -> th.th_team;
|
||||
int tid = __kmp_tid_from_gtid( global_tid );
|
||||
|
||||
ompt_team_info_t *team_info = __ompt_get_teaminfo(0, NULL);
|
||||
ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
|
||||
ompt_callbacks.ompt_callback(ompt_event_loop_end)(
|
||||
team->t.ompt_team_info.parallel_id,
|
||||
team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id);
|
||||
team_info->parallel_id, task_info->task_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# Configuration file for the 'lit' test runner.
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import lit.formats
|
||||
|
||||
|
@ -47,6 +48,11 @@ config.test_cflags = config.test_openmp_flag + \
|
|||
" -L " + config.library_dir + \
|
||||
" " + config.test_extra_cflags
|
||||
|
||||
# Allow XFAIL to work
|
||||
config.target_triple = [ ]
|
||||
if re.search('gcc', config.test_compiler) is not None:
|
||||
config.available_features.add('gcc')
|
||||
|
||||
# Setup environment to find dynamic library at runtime
|
||||
append_dynamic_library_path(config.library_dir)
|
||||
if config.using_hwloc:
|
||||
|
|
|
@ -43,6 +43,23 @@ on_ompt_event_implicit_task_end(
|
|||
printf("%" PRIu64 ": ompt_event_implicit_task_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 "\n", ompt_get_thread_id(), parallel_id, task_id);
|
||||
}
|
||||
|
||||
static void
|
||||
on_ompt_event_loop_begin(
|
||||
ompt_parallel_id_t parallel_id,
|
||||
ompt_task_id_t parent_task_id,
|
||||
void *workshare_function)
|
||||
{
|
||||
printf("%" PRIu64 ": ompt_event_loop_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", workshare_function=%p\n", ompt_get_thread_id(), parallel_id, parent_task_id, workshare_function);
|
||||
}
|
||||
|
||||
static void
|
||||
on_ompt_event_loop_end(
|
||||
ompt_parallel_id_t parallel_id,
|
||||
ompt_task_id_t task_id)
|
||||
{
|
||||
printf("%" PRIu64 ": ompt_event_loop_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 "\n", ompt_get_thread_id(), parallel_id, task_id);
|
||||
}
|
||||
|
||||
static void
|
||||
on_ompt_event_parallel_begin(
|
||||
ompt_task_id_t parent_task_id,
|
||||
|
@ -79,6 +96,8 @@ void ompt_initialize(
|
|||
ompt_set_callback(ompt_event_barrier_end, (ompt_callback_t) &on_ompt_event_barrier_end);
|
||||
ompt_set_callback(ompt_event_implicit_task_begin, (ompt_callback_t) &on_ompt_event_implicit_task_begin);
|
||||
ompt_set_callback(ompt_event_implicit_task_end, (ompt_callback_t) &on_ompt_event_implicit_task_end);
|
||||
ompt_set_callback(ompt_event_loop_begin, (ompt_callback_t) &on_ompt_event_loop_begin);
|
||||
ompt_set_callback(ompt_event_loop_end, (ompt_callback_t) &on_ompt_event_loop_end);
|
||||
ompt_set_callback(ompt_event_parallel_begin, (ompt_callback_t) &on_ompt_event_parallel_begin);
|
||||
ompt_set_callback(ompt_event_parallel_end, (ompt_callback_t) &on_ompt_event_parallel_end);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h
|
||||
// REQUIRES: ompt
|
||||
// GCC doesn't call runtime for auto = static schedule
|
||||
// XFAIL: gcc
|
||||
|
||||
#define SCHEDULE auto
|
||||
#include "base.h"
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h
|
||||
// REQUIRES: ompt
|
||||
// GCC doesn't call runtime for auto = static schedule
|
||||
// XFAIL: gcc
|
||||
|
||||
#define SCHEDULE auto
|
||||
#include "base_serialized.h"
|
|
@ -0,0 +1,35 @@
|
|||
#include "callback.h"
|
||||
#include <omp.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
#pragma omp parallel for num_threads(4) schedule(SCHEDULE)
|
||||
for (i = 0; i < 4; i++) {
|
||||
}
|
||||
|
||||
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame=0x{{[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=0x{{[0-f]+}}, invoker={{.*}}
|
||||
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}}
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
|
||||
// CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}}
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
|
||||
// CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}}
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
|
||||
// CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}}
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#include "callback.h"
|
||||
#include <omp.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
#pragma omp parallel for num_threads(1) schedule(SCHEDULE)
|
||||
for (i = 0; i < 1; i++) {
|
||||
}
|
||||
|
||||
// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame=0x{{[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=1, parallel_function=0x{{[0-f]+}}, invoker={{.+}}
|
||||
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], workshare_function=0x{{[0-f]+}}
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
// CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h
|
||||
// REQUIRES: ompt
|
||||
|
||||
#define SCHEDULE dynamic
|
||||
#include "base.h"
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h
|
||||
// REQUIRES: ompt
|
||||
|
||||
#define SCHEDULE dynamic
|
||||
#include "base_serialized.h"
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h
|
||||
// REQUIRES: ompt
|
||||
|
||||
#define SCHEDULE guided
|
||||
#include "base.h"
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h
|
||||
// REQUIRES: ompt
|
||||
|
||||
#define SCHEDULE guided
|
||||
#include "base_serialized.h"
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h
|
||||
// REQUIRES: ompt
|
||||
|
||||
#define SCHEDULE runtime
|
||||
#include "base.h"
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h
|
||||
// REQUIRES: ompt
|
||||
|
||||
#define SCHEDULE runtime
|
||||
#include "base_serialized.h"
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h
|
||||
// REQUIRES: ompt
|
||||
// GCC doesn't call runtime for static schedule
|
||||
// XFAIL: gcc
|
||||
|
||||
#define SCHEDULE static
|
||||
#include "base.h"
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h
|
||||
// REQUIRES: ompt
|
||||
// GCC doesn't call runtime for static schedule
|
||||
// XFAIL: gcc
|
||||
|
||||
#define SCHEDULE static
|
||||
#include "base_serialized.h"
|
Loading…
Reference in New Issue