diff --git a/openmp/libomptarget/include/OmptCallback.h b/openmp/libomptarget/include/OmptCallback.h --- a/openmp/libomptarget/include/OmptCallback.h +++ b/openmp/libomptarget/include/OmptCallback.h @@ -33,6 +33,10 @@ ompt_callback_##CallbackName##_fn(__VA_ARGS__); \ } while (0) +/// Function type def used for maintaining unique target region, target +/// operations ids +typedef uint64_t (*IdInterfaceTy)(); + namespace llvm { namespace omp { namespace target { diff --git a/openmp/libomptarget/src/OmptCallback.cpp b/openmp/libomptarget/src/OmptCallback.cpp --- a/openmp/libomptarget/src/OmptCallback.cpp +++ b/openmp/libomptarget/src/OmptCallback.cpp @@ -21,6 +21,7 @@ #include "Debug.h" #include "OmptCallback.h" #include "OmptConnector.h" +#include "OmptInterface.h" #undef DEBUG_PREFIX #define DEBUG_PREFIX "OMPT" @@ -34,6 +35,338 @@ FOREACH_OMPT_EMI_EVENT(defineOmptCallback) #undef defineOmptCallback +/// Thread local state for target region and associated metadata +thread_local llvm::omp::target::ompt::Interface OmptInterface; + +/// Define function pointers +ompt_get_task_data_t ompt_get_task_data_fn = nullptr; +ompt_get_target_task_data_t ompt_get_target_task_data_fn = nullptr; + +/// Unique correlation id +static std::atomic IdCounter(1); + +/// Used to create a new correlation id +static uint64_t createId() { return IdCounter.fetch_add(1); } + +/// Create a new correlation id and update the operations id +static uint64_t createOpId() { + uint64_t NewId = createId(); + OmptInterface.setHostOpId(NewId); + return NewId; +} + +/// Create a new correlation id and update the target region id +static uint64_t createRegionId() { + uint64_t NewId = createId(); + OmptInterface.setTargetDataValue(NewId); + return NewId; +} + +void Interface::beginTargetDataAlloc(int64_t DeviceId, void *HstPtrBegin, + size_t Size, void *Code) { + beginTargetDataOperation(); + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn(ompt_scope_begin, TargetTaskData, + &TargetData, &TargetRegionOpId, + ompt_target_data_alloc, HstPtrBegin, + DeviceId, /* TgtPtrBegin */ nullptr, + /* TgtDeviceNum */ 0, Size, Code); + } else if (ompt_callback_target_data_op_fn) { + // HostOpId is set by the runtime + HostOpId = createOpId(); + // Invoke the tool supplied data op callback + ompt_callback_target_data_op_fn( + TargetData.value, HostOpId, ompt_target_data_alloc, HstPtrBegin, + DeviceId, /* TgtPtrBegin */ nullptr, /* TgtDeviceNum */ 0, Size, Code); + } +} + +void Interface::endTargetDataAlloc(int64_t DeviceId, void *HstPtrBegin, + size_t Size, void *Code) { + // Only EMI callback handles end scope + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn(ompt_scope_end, TargetTaskData, + &TargetData, &TargetRegionOpId, + ompt_target_data_alloc, HstPtrBegin, + DeviceId, /* TgtPtrBegin */ nullptr, + /* TgtDeviceNum */ 0, Size, Code); + } + endTargetDataOperation(); +} + +void Interface::beginTargetDataSubmit(int64_t DeviceId, void *TgtPtrBegin, + void *HstPtrBegin, size_t Size, + void *Code) { + beginTargetDataOperation(); + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn( + ompt_scope_begin, TargetTaskData, &TargetData, &TargetRegionOpId, + ompt_target_data_transfer_to_device, HstPtrBegin, + /* SrcDeviceNum */ 0, TgtPtrBegin, DeviceId, Size, Code); + } else if (ompt_callback_target_data_op_fn) { + // HostOpId is set by the runtime + HostOpId = createOpId(); + // Invoke the tool supplied data op callback + ompt_callback_target_data_op_fn( + TargetData.value, HostOpId, ompt_target_data_transfer_to_device, + HstPtrBegin, /* SrcDeviceNum */ 0, TgtPtrBegin, DeviceId, Size, Code); + } +} + +void Interface::endTargetDataSubmit(int64_t DeviceId, void *TgtPtrBegin, + void *HstPtrBegin, size_t Size, + void *Code) { + // Only EMI callback handles end scope + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn( + ompt_scope_end, TargetTaskData, &TargetData, &TargetRegionOpId, + ompt_target_data_transfer_to_device, HstPtrBegin, + /* SrcDeviceNum */ 0, TgtPtrBegin, DeviceId, Size, Code); + } + endTargetDataOperation(); +} + +void Interface::beginTargetDataDelete(int64_t DeviceId, void *TgtPtrBegin, + void *Code) { + beginTargetDataOperation(); + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn( + ompt_scope_begin, TargetTaskData, &TargetData, &TargetRegionOpId, + ompt_target_data_delete, TgtPtrBegin, DeviceId, + /* TgtPtrBegin */ nullptr, /* TgtDeviceNum */ 0, /* Bytes */ 0, Code); + } else if (ompt_callback_target_data_op_fn) { + // HostOpId is set by the runtime + HostOpId = createOpId(); + // Invoke the tool supplied data op callback + ompt_callback_target_data_op_fn(TargetData.value, HostOpId, + ompt_target_data_delete, TgtPtrBegin, + DeviceId, /* TgtPtrBegin */ nullptr, + /* TgtDeviceNum */ 0, /* Bytes */ 0, Code); + } +} + +void Interface::endTargetDataDelete(int64_t DeviceId, void *TgtPtrBegin, + void *Code) { + // Only EMI callback handles end scope + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn( + ompt_scope_end, TargetTaskData, &TargetData, &TargetRegionOpId, + ompt_target_data_delete, TgtPtrBegin, DeviceId, + /* TgtPtrBegin */ nullptr, /* TgtDeviceNum */ 0, /* Bytes */ 0, Code); + } + endTargetDataOperation(); +} + +void Interface::beginTargetDataRetrieve(int64_t DeviceId, void *HstPtrBegin, + void *TgtPtrBegin, size_t Size, + void *Code) { + beginTargetDataOperation(); + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn(ompt_scope_begin, TargetTaskData, + &TargetData, &TargetRegionOpId, + ompt_target_data_transfer_from_device, + TgtPtrBegin, DeviceId, HstPtrBegin, + /* TgtDeviceNum */ 0, Size, Code); + } else if (ompt_callback_target_data_op_fn) { + // HostOpId is set by the runtime + HostOpId = createOpId(); + // Invoke the tool supplied data op callback + ompt_callback_target_data_op_fn(TargetData.value, HostOpId, + ompt_target_data_transfer_from_device, + TgtPtrBegin, DeviceId, HstPtrBegin, + /* TgtDeviceNum */ 0, Size, Code); + } +} + +void Interface::endTargetDataRetrieve(int64_t DeviceId, void *HstPtrBegin, + void *TgtPtrBegin, size_t Size, + void *Code) { + // Only EMI callback handles end scope + if (ompt_callback_target_data_op_emi_fn) { + // HostOpId will be set by the tool. Invoke the tool supplied data op EMI + // callback + ompt_callback_target_data_op_emi_fn(ompt_scope_end, TargetTaskData, + &TargetData, &TargetRegionOpId, + ompt_target_data_transfer_from_device, + TgtPtrBegin, DeviceId, HstPtrBegin, + /* TgtDeviceNum */ 0, Size, Code); + } + endTargetDataOperation(); +} + +void Interface::beginTargetSubmit(unsigned int numTeams) { + if (ompt_callback_target_submit_emi_fn) { + // HostOpId is set by the tool. Invoke the tool supplied target submit EMI + // callback + ompt_callback_target_submit_emi_fn(ompt_scope_begin, &TargetData, &HostOpId, + numTeams); + } else if (ompt_callback_target_submit_fn) { + // HostOpId is set by the runtime + HostOpId = createOpId(); + ompt_callback_target_submit_fn(TargetData.value, HostOpId, numTeams); + } +} + +void Interface::endTargetSubmit(unsigned int numTeams) { + // Only EMI callback handles end scope + if (ompt_callback_target_submit_emi_fn) { + // HostOpId is set by the tool. Invoke the tool supplied target submit EMI + // callback + ompt_callback_target_submit_emi_fn(ompt_scope_end, &TargetData, &HostOpId, + numTeams); + } +} +void Interface::beginTargetDataEnter(int64_t DeviceId, void *Code) { + beginTargetRegion(); + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target_enter_data, ompt_scope_begin, + DeviceId, TaskData, TargetTaskData, &TargetData, + Code); + } else if (ompt_callback_target_fn) { + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target_enter_data, ompt_scope_begin, DeviceId, + TaskData, TargetData.value, Code); + } +} + +void Interface::endTargetDataEnter(int64_t DeviceId, void *Code) { + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target_enter_data, ompt_scope_end, + DeviceId, TaskData, TargetTaskData, &TargetData, + Code); + } else if (ompt_callback_target_fn) { + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target_enter_data, ompt_scope_end, DeviceId, + TaskData, TargetData.value, Code); + } + endTargetRegion(); +} + +void Interface::beginTargetDataExit(int64_t DeviceId, void *Code) { + beginTargetRegion(); + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target_exit_data, ompt_scope_begin, + DeviceId, TaskData, TargetTaskData, &TargetData, + Code); + } else if (ompt_callback_target_fn) { + TargetData.value = createRegionId(); + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target_exit_data, ompt_scope_begin, DeviceId, + TaskData, TargetData.value, Code); + } +} + +void Interface::endTargetDataExit(int64_t DeviceId, void *Code) { + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target_exit_data, ompt_scope_end, DeviceId, + TaskData, TargetTaskData, &TargetData, Code); + } else if (ompt_callback_target_fn) { + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target_exit_data, ompt_scope_end, DeviceId, + TaskData, TargetData.value, Code); + } + endTargetRegion(); +} + +void Interface::beginTargetUpdate(int64_t DeviceId, void *Code) { + beginTargetRegion(); + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target_update, ompt_scope_begin, DeviceId, + TaskData, TargetTaskData, &TargetData, Code); + } else if (ompt_callback_target_fn) { + TargetData.value = createRegionId(); + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target_update, ompt_scope_begin, DeviceId, + TaskData, TargetData.value, Code); + } +} + +void Interface::endTargetUpdate(int64_t DeviceId, void *Code) { + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target_update, ompt_scope_end, DeviceId, + TaskData, TargetTaskData, &TargetData, Code); + } else if (ompt_callback_target_fn) { + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target_update, ompt_scope_end, DeviceId, + TaskData, TargetData.value, Code); + } + endTargetRegion(); +} + +void Interface::beginTarget(int64_t DeviceId, void *Code) { + beginTargetRegion(); + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target, ompt_scope_begin, DeviceId, + TaskData, TargetTaskData, &TargetData, Code); + } else if (ompt_callback_target_fn) { + TargetData.value = createRegionId(); + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target, ompt_scope_begin, DeviceId, TaskData, + TargetData.value, Code); + } +} + +void Interface::endTarget(int64_t DeviceId, void *Code) { + if (ompt_callback_target_emi_fn) { + // Invoke the tool supplied target EMI callback + ompt_callback_target_emi_fn(ompt_target, ompt_scope_end, DeviceId, TaskData, + TargetTaskData, &TargetData, Code); + } else if (ompt_callback_target_fn) { + // Invoke the tool supplied target callback + ompt_callback_target_fn(ompt_target, ompt_scope_end, DeviceId, TaskData, + TargetData.value, Code); + } + endTargetRegion(); +} + +void Interface::beginTargetDataOperation() { + DP("in ompt_target_region_begin (TargetRegionOpId = %lu)\n", + TargetData.value); +} + +void Interface::endTargetDataOperation() { + DP("in ompt_target_region_end (TargetRegionOpId = %lu)\n", TargetData.value); +} + +void Interface::beginTargetRegion() { + // Set up task state + assert(ompt_get_task_data_fn && "Calling a null task data function"); + TaskData = ompt_get_task_data_fn(); + // Set up target task state + assert(ompt_get_target_task_data_fn && + "Calling a null target task data function"); + TargetTaskData = ompt_get_target_task_data_fn(); + // Target state will be set later + TargetData = ompt_data_none; +} + +void Interface::endTargetRegion() { + TaskData = 0; + TargetTaskData = 0; + TargetData = ompt_data_none; +} + /// Used to maintain the finalization functions that are received /// from the plugins during connect. /// Note: Currently, there are no plugin-specific finalizations, so each plugin @@ -74,6 +407,8 @@ ((void *)(uint64_t)DestinationFunction)); bindOmptFunctionName(ompt_get_callback, lookupCallbackByCode); + bindOmptFunctionName(ompt_get_task_data, ompt_get_task_data_fn); + bindOmptFunctionName(ompt_get_target_task_data, ompt_get_target_task_data_fn); #undef bindOmptFunctionName // Store pointer of 'ompt_libomp_target_fn_lookup' for use by libomptarget diff --git a/openmp/libomptarget/src/OmptInterface.h b/openmp/libomptarget/src/OmptInterface.h new file mode 100644 --- /dev/null +++ b/openmp/libomptarget/src/OmptInterface.h @@ -0,0 +1,157 @@ +//===-------- OmptInterface.h - Target independent OpenMP target RTL ------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Declarations for OpenMP Tool callback dispatchers +// +//===----------------------------------------------------------------------===// + +#ifndef _OMPTARGET_OMPTINTERFACE_H +#define _OMPTARGET_OMPTINTERFACE_H + +#include "omp-tools.h" + +// If target OMPT support is compiled in +#ifdef OMPT_SUPPORT +#define OMPT_IF_BUILT(stmt) stmt +#else +#define OMPT_IF_BUILT(stmt) +#endif + +/// Callbacks for target regions require task_data representing the +/// encountering task. +/// Callbacks for target regions and target data ops require +/// target_task_data representing the target task region. +typedef ompt_data_t *(*ompt_get_task_data_t)(); +typedef ompt_data_t *(*ompt_get_target_task_data_t)(); + +namespace llvm { +namespace omp { +namespace target { +namespace ompt { + +/// Function pointers that will be used to track task_data and +/// target_task_data. +static ompt_get_task_data_t ompt_get_task_data_fn; +static ompt_get_target_task_data_t ompt_get_target_task_data_fn; + +/// Used to maintain execution state for this thread +class Interface { +public: + /// Top-level function for invoking callback before device data allocation + void beginTargetDataAlloc(int64_t DeviceId, void *TgtPtrBegin, size_t Size, + void *Code); + + /// Top-level function for invoking callback after device data allocation + void endTargetDataAlloc(int64_t DeviceId, void *TgtPtrBegin, size_t Size, + void *Code); + + /// Top-level function for invoking callback before data submit + void beginTargetDataSubmit(int64_t DeviceId, void *HstPtrBegin, + void *TgtPtrBegin, size_t Size, void *Code); + + /// Top-level function for invoking callback after data submit + void endTargetDataSubmit(int64_t DeviceId, void *HstPtrBegin, + void *TgtPtrBegin, size_t Size, void *Code); + + /// Top-level function for invoking callback before device data deallocation + void beginTargetDataDelete(int64_t DeviceId, void *TgtPtrBegin, void *Code); + + /// Top-level function for invoking callback after device data deallocation + void endTargetDataDelete(int64_t DeviceId, void *TgtPtrBegin, void *Code); + + /// Top-level function for invoking callback before data retrieve + void beginTargetDataRetrieve(int64_t DeviceId, void *HstPtrBegin, + void *TgtPtrBegin, size_t Size, void *Code); + + /// Top-level function for invoking callback after data retrieve + void endTargetDataRetrieve(int64_t DeviceId, void *HstPtrBegin, + void *TgtPtrBegin, size_t Size, void *Code); + + /// Top-level function for invoking callback before kernel dispatch + void beginTargetSubmit(unsigned int NumTeams = 1); + + /// Top-level function for invoking callback after kernel dispatch + void endTargetSubmit(unsigned int NumTeams = 1); + + // Target region callbacks + + /// Top-level function for invoking callback before target enter data + /// construct + void beginTargetDataEnter(int64_t DeviceId, void *Code); + + /// Top-level function for invoking callback after target enter data + /// construct + void endTargetDataEnter(int64_t DeviceId, void *Code); + + /// Top-level function for invoking callback before target exit data + /// construct + void beginTargetDataExit(int64_t DeviceId, void *Code); + + /// Top-level function for invoking callback after target exit data + /// construct + void endTargetDataExit(int64_t DeviceId, void *Code); + + /// Top-level function for invoking callback before target update construct + void beginTargetUpdate(int64_t DeviceId, void *Code); + + /// Top-level function for invoking callback after target update construct + void endTargetUpdate(int64_t DeviceId, void *Code); + + /// Top-level function for invoking callback before target construct + void beginTarget(int64_t DeviceId, void *Code); + + /// Top-level function for invoking callback after target construct + void endTarget(int64_t DeviceId, void *Code); + + /// Setters for target region and target operation correlation ids + void setTargetDataValue(uint64_t DataValue) { TargetData.value = DataValue; } + void setTargetDataPtr(void *DataPtr) { TargetData.ptr = DataPtr; } + void setHostOpId(ompt_id_t OpId) { HostOpId = OpId; } + + /// Getters for target region and target operation correlation ids + uint64_t getTargetDataValue() { return TargetData.value; } + void *getTargetDataPtr() { return TargetData.ptr; } + ompt_id_t getHostOpId() { return HostOpId; } + +private: + /// Target operations id + ompt_id_t HostOpId = 0; + + /// Target region data + ompt_data_t TargetData = ompt_data_none; + + /// Task data representing the encountering task + ompt_data_t *TaskData = nullptr; + + /// Target task data representing the target task region + ompt_data_t *TargetTaskData = nullptr; + + /// Correlation id that is incremented with target operations + uint64_t TargetRegionOpId = 1; + + /// Used for marking begin of a data operation + void beginTargetDataOperation(); + + /// Used for marking end of a data operation + void endTargetDataOperation(); + + /// Used for marking begin of a target region + void beginTargetRegion(); + + /// Used for marking end of a target region + void endTargetRegion(); +}; + +} // namespace ompt +} // namespace target +} // namespace omp +} // namespace llvm + +extern thread_local llvm::omp::target::ompt::Interface OmptInterface; + +#endif // _OMPTARGET_OMPTINTERFACE_H diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp --- a/openmp/runtime/src/ompt-general.cpp +++ b/openmp/runtime/src/ompt-general.cpp @@ -498,8 +498,8 @@ ompt_callbacks.ompt_callback(ompt_callback_thread_begin)( ompt_thread_initial, __ompt_get_thread_data_internal()); } - ompt_data_t *task_data; - ompt_data_t *parallel_data; + ompt_data_t *task_data = nullptr; + ompt_data_t *parallel_data = nullptr; __ompt_get_task_info_internal(0, NULL, &task_data, NULL, ¶llel_data, NULL); if (ompt_enabled.ompt_callback_implicit_task) { @@ -878,6 +878,12 @@ return NULL; } +static ompt_data_t *ompt_get_task_data() { return __ompt_get_task_data(); } + +static ompt_data_t *ompt_get_target_task_data() { + return __ompt_get_target_task_data(); +} + /// Lookup function to query libomp callbacks registered by the tool static ompt_interface_fn_t ompt_libomp_target_fn_lookup(const char *s) { #define provide_fn(fn) \ @@ -885,6 +891,8 @@ return (ompt_interface_fn_t)fn; provide_fn(ompt_get_callback); + provide_fn(ompt_get_task_data); + provide_fn(ompt_get_target_task_data); #undef provide_fn #define ompt_interface_fn(fn, type, code) \ diff --git a/openmp/runtime/src/ompt-internal.h b/openmp/runtime/src/ompt-internal.h --- a/openmp/runtime/src/ompt-internal.h +++ b/openmp/runtime/src/ompt-internal.h @@ -76,6 +76,7 @@ ompt_data_t thread_data; ompt_data_t task_data; /* stored here from implicit barrier-begin until implicit-task-end */ + ompt_data_t target_task_data; /* required by target support */ void *return_address; /* stored here on entry of runtime */ ompt_state_t state; ompt_wait_id_t wait_id; diff --git a/openmp/runtime/src/ompt-specific.h b/openmp/runtime/src/ompt-specific.h --- a/openmp/runtime/src/ompt-specific.h +++ b/openmp/runtime/src/ompt-specific.h @@ -37,6 +37,10 @@ ompt_team_info_t *__ompt_get_teaminfo(int depth, int *size); +ompt_data_t *__ompt_get_task_data(); + +ompt_data_t *__ompt_get_target_task_data(); + ompt_task_info_t *__ompt_get_task_info_object(int depth); int __ompt_get_parallel_info_internal(int ancestor_level, @@ -61,12 +65,12 @@ * macros ****************************************************************************/ -#define OMPT_CUR_TASK_INFO(thr) (&(thr->th.th_current_task->ompt_task_info)) +#define OMPT_CUR_TASK_INFO(thr) (&((thr)->th.th_current_task->ompt_task_info)) #define OMPT_CUR_TASK_DATA(thr) \ - (&(thr->th.th_current_task->ompt_task_info.task_data)) -#define OMPT_CUR_TEAM_INFO(thr) (&(thr->th.th_team->t.ompt_team_info)) + (&((thr)->th.th_current_task->ompt_task_info.task_data)) +#define OMPT_CUR_TEAM_INFO(thr) (&((thr)->th.th_team->t.ompt_team_info)) #define OMPT_CUR_TEAM_DATA(thr) \ - (&(thr->th.th_team->t.ompt_team_info.parallel_data)) + (&((thr)->th.th_team->t.ompt_team_info.parallel_data)) #define OMPT_HAVE_WEAK_ATTRIBUTE KMP_HAVE_WEAK_ATTRIBUTE #define OMPT_HAVE_PSAPI KMP_HAVE_PSAPI diff --git a/openmp/runtime/src/ompt-specific.cpp b/openmp/runtime/src/ompt-specific.cpp --- a/openmp/runtime/src/ompt-specific.cpp +++ b/openmp/runtime/src/ompt-specific.cpp @@ -344,6 +344,16 @@ // task support //---------------------------------------------------------- +ompt_data_t *__ompt_get_task_data() { + kmp_info_t *thr = ompt_get_thread(); + ompt_data_t *task_data = thr ? OMPT_CUR_TASK_DATA(thr) : NULL; + return task_data; +} + +ompt_data_t *__ompt_get_target_task_data() { + return &__kmp_threads[__kmp_get_gtid()]->th.ompt_thread_info.target_task_data; +} + int __ompt_get_task_info_internal(int ancestor_level, int *type, ompt_data_t **task_data, ompt_frame_t **task_frame,