[OpenMP][Tools] clang-format Archer (NFC)

This commit is contained in:
Joachim Protze 2020-11-03 16:31:50 +01:00
parent cf637a69e7
commit eaed9e6b56
1 changed files with 130 additions and 140 deletions

View File

@ -10,7 +10,6 @@
//
//===----------------------------------------------------------------------===//
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
@ -34,8 +33,8 @@
#include <dlfcn.h>
#endif
#include <sys/resource.h>
#include "omp-tools.h"
#include <sys/resource.h>
static int runOnTsan;
static int hasReductionCallback;
@ -498,8 +497,7 @@ static void ompt_tsan_thread_end(ompt_data_t *thread_data) {
static void ompt_tsan_parallel_begin(ompt_data_t *parent_task_data,
const ompt_frame_t *parent_task_frame,
ompt_data_t *parallel_data,
uint32_t requested_team_size,
int flag,
uint32_t requested_team_size, int flag,
const void *codeptr_ra) {
ParallelData *Data = new ParallelData(codeptr_ra);
parallel_data->ptr = Data;
@ -508,8 +506,7 @@ static void ompt_tsan_parallel_begin(ompt_data_t *parent_task_data,
}
static void ompt_tsan_parallel_end(ompt_data_t *parallel_data,
ompt_data_t *task_data,
int flag,
ompt_data_t *task_data, int flag,
const void *codeptr_ra) {
ParallelData *Data = ToParallelData(parallel_data);
TsanHappensAfter(Data->GetBarrierPtr(0));
@ -523,15 +520,13 @@ static void ompt_tsan_parallel_end(ompt_data_t *parallel_data,
__tsan_flush_memory();
}
#endif
}
static void ompt_tsan_implicit_task(ompt_scope_endpoint_t endpoint,
ompt_data_t *parallel_data,
ompt_data_t *task_data,
unsigned int team_size,
unsigned int thread_num,
int type) {
unsigned int thread_num, int type) {
switch (endpoint) {
case ompt_scope_begin:
if (type & ompt_task_initial) {
@ -791,7 +786,8 @@ static void ompt_tsan_task_schedule(ompt_data_t *first_task_data,
// in dependencies block following inout and out dependencies!
TsanHappensBefore(ToInAddr(Dependency->variable.ptr));
if (Dependency->dependence_type == ompt_dependence_type_out || Dependency->dependence_type == ompt_dependence_type_inout) {
if (Dependency->dependence_type == ompt_dependence_type_out ||
Dependency->dependence_type == ompt_dependence_type_inout) {
TsanHappensBefore(Dependency->variable.ptr);
}
}
@ -842,14 +838,12 @@ static void ompt_tsan_task_schedule(ompt_data_t *first_task_data,
}
static void ompt_tsan_dependences(ompt_data_t *task_data,
const ompt_dependence_t *deps,
int ndeps) {
const ompt_dependence_t *deps, int ndeps) {
if (ndeps > 0) {
// Copy the data to use it in task_switch and task_end.
TaskData *Data = ToTaskData(task_data);
Data->Dependencies = new ompt_dependence_t[ndeps];
std::memcpy(Data->Dependencies, deps,
sizeof(ompt_dependence_t) * ndeps);
std::memcpy(Data->Dependencies, deps, sizeof(ompt_dependence_t) * ndeps);
Data->DependencyCount = ndeps;
// This callback is executed before this task is first started.
@ -858,8 +852,7 @@ static void ompt_tsan_dependences(ompt_data_t *task_data,
}
/// OMPT event callbacks for handling locking.
static void ompt_tsan_mutex_acquired(ompt_mutex_t kind,
ompt_wait_id_t wait_id,
static void ompt_tsan_mutex_acquired(ompt_mutex_t kind, ompt_wait_id_t wait_id,
const void *codeptr_ra) {
// Acquire our own lock to make sure that
@ -873,8 +866,7 @@ static void ompt_tsan_mutex_acquired(ompt_mutex_t kind,
TsanHappensAfter(&Lock);
}
static void ompt_tsan_mutex_released(ompt_mutex_t kind,
ompt_wait_id_t wait_id,
static void ompt_tsan_mutex_released(ompt_mutex_t kind, ompt_wait_id_t wait_id,
const void *codeptr_ra) {
LocksMutex.lock();
std::mutex &Lock = Locks[wait_id];
@ -891,7 +883,8 @@ static void ompt_tsan_mutex_released(ompt_mutex_t kind,
result = ompt_set_callback(ompt_callback_##event, \
(ompt_callback_t)tsan_##event); \
if (result < level) \
printf("Registered callback '" #event "' is not supported at " #level " (%i)\n", \
printf("Registered callback '" #event "' is not supported at " #level \
" (%i)\n", \
result); \
} while (0)
@ -903,8 +896,7 @@ static void ompt_tsan_mutex_released(ompt_mutex_t kind,
#define SET_CALLBACK(event) SET_CALLBACK_T(event, event)
static int ompt_tsan_initialize(ompt_function_lookup_t lookup,
int device_num,
static int ompt_tsan_initialize(ompt_function_lookup_t lookup, int device_num,
ompt_data_t *tool_data) {
const char *options = getenv("TSAN_OPTIONS");
TsanFlags tsan_flags(options);
@ -938,12 +930,13 @@ static int ompt_tsan_initialize(ompt_function_lookup_t lookup,
SET_CALLBACK_T(mutex_acquired, mutex);
SET_CALLBACK_T(mutex_released, mutex);
SET_OPTIONAL_CALLBACK_T(reduction, sync_region, hasReductionCallback, ompt_set_never);
SET_OPTIONAL_CALLBACK_T(reduction, sync_region, hasReductionCallback,
ompt_set_never);
if (!tsan_flags.ignore_noninstrumented_modules)
fprintf(
stderr,
"Warning: please export TSAN_OPTIONS='ignore_noninstrumented_modules=1' "
fprintf(stderr,
"Warning: please export "
"TSAN_OPTIONS='ignore_noninstrumented_modules=1' "
"to avoid false positive reports from the OpenMP runtime!\n");
return 1; // success
}
@ -959,16 +952,13 @@ static void ompt_tsan_finalize(ompt_data_t *tool_data) {
delete archer_flags;
}
extern "C"
ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
const char *runtime_version) {
extern "C" ompt_start_tool_result_t *
ompt_start_tool(unsigned int omp_version, const char *runtime_version) {
const char *options = getenv("ARCHER_OPTIONS");
archer_flags = new ArcherFlags(options);
if (!archer_flags->enabled)
{
if (!archer_flags->enabled) {
if (archer_flags->verbose)
std::cout << "Archer disabled, stopping operation"
<< std::endl;
std::cout << "Archer disabled, stopping operation" << std::endl;
delete archer_flags;
return NULL;
}