aboutsummaryrefslogtreecommitdiff
path: root/openmp/runtime
diff options
context:
space:
mode:
authordhruvachak <Dhruva.Chakrabarti@amd.com>2024-07-01 10:07:05 -0700
committerGitHub <noreply@github.com>2024-07-01 10:07:05 -0700
commit946f5d111d5e3cb19055dc78959d9ee5a19c163a (patch)
tree2835986fe23e06be77da6de80151317616a65170 /openmp/runtime
parent23e62243746a1c43e4e6251fcab178498afc3426 (diff)
downloadllvm-946f5d111d5e3cb19055dc78959d9ee5a19c163a.zip
llvm-946f5d111d5e3cb19055dc78959d9ee5a19c163a.tar.gz
llvm-946f5d111d5e3cb19055dc78959d9ee5a19c163a.tar.bz2
[OpenMP] [OMPT] Callback registration should not depend on the device init callback. (#96371)
Even if the device init callback is not registered, a tool should be allowed to register other callbacks.
Diffstat (limited to 'openmp/runtime')
-rw-r--r--openmp/runtime/src/ompt-general.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp
index 95aab6c..e07c5ff 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -915,22 +915,16 @@ _OMP_EXTERN void ompt_libomp_connect(ompt_start_tool_result_t *result) {
// Ensure libomp callbacks have been added if not already
__ompt_force_initialization();
- if (ompt_enabled.enabled &&
- // Callbacks are initiated only if the device initialize callback
- // has been registered by the tool
- ompt_callbacks.ompt_callback(ompt_callback_device_initialize)) {
- if (result) {
- OMPT_VERBOSE_INIT_PRINT(
- "libomp --> OMPT: Connecting with libomptarget\n");
- // Pass in the libomp lookup function so that the already registered
- // functions can be extracted and assigned to the callbacks in
- // libomptarget
- result->initialize(ompt_libomp_target_fn_lookup,
- /* initial_device_num */ 0, /* tool_data */ nullptr);
- // Track the object provided by libomptarget so that the finalizer can be
- // called during OMPT finalization
- libomptarget_ompt_result = result;
- }
+ if (ompt_enabled.enabled && result) {
+ OMPT_VERBOSE_INIT_PRINT("libomp --> OMPT: Connecting with libomptarget\n");
+ // Pass in the libomp lookup function so that the already registered
+ // functions can be extracted and assigned to the callbacks in
+ // libomptarget
+ result->initialize(ompt_libomp_target_fn_lookup,
+ /* initial_device_num */ 0, /* tool_data */ nullptr);
+ // Track the object provided by libomptarget so that the finalizer can be
+ // called during OMPT finalization
+ libomptarget_ompt_result = result;
}
OMPT_VERBOSE_INIT_PRINT("libomp --> OMPT: Exit ompt_libomp_connect\n");
}