Skip to content

Commit

Permalink
Revert "[OpenMP] [OMPT] [2/8] Implemented a connector for communicati…
Browse files Browse the repository at this point in the history
…on of OMPT callbacks between libraries."

This reverts commit f94c267.
  • Loading branch information
dhruvachak committed Nov 1, 2022
1 parent b124295 commit 88e557c
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 252 deletions.
17 changes: 0 additions & 17 deletions openmp/libomptarget/CMakeLists.txt
Expand Up @@ -69,24 +69,7 @@ if(LIBOMPTARGET_ENABLE_DEBUG)
add_definitions(-DOMPTARGET_DEBUG)
endif()

# OMPT support for libomptarget
set(OMPT_TARGET_DEFAULT FALSE)
if ((LIBOMP_HAVE_OMPT_SUPPORT) AND (NOT WIN32))
set (OMPT_TARGET_DEFAULT TRUE)
endif()
set(LIBOMPTARGET_OMPT_SUPPORT ${OMPT_TARGET_DEFAULT} CACHE BOOL "OMPT-target-support?")
if (LIBOMPTARGET_OMPT_SUPPORT)
add_definitions(-DOMPT_SUPPORT=1)
message(STATUS "OMPT target enabled")
else()
message(STATUS "OMPT target disabled")
endif()

pythonize_bool(LIBOMPTARGET_OMPT_SUPPORT)

set(LIBOMPTARGET_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
message(STATUS "OpenMP tools dir in libomptarget: ${LIBOMP_OMP_TOOLS_INCLUDE_DIR}")
include_directories(${LIBOMP_OMP_TOOLS_INCLUDE_DIR})

# Build target agnostic offloading library.
set(LIBOMPTARGET_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
Expand Down
89 changes: 0 additions & 89 deletions openmp/libomptarget/include/ompt-connector.h

This file was deleted.

1 change: 0 additions & 1 deletion openmp/libomptarget/src/CMakeLists.txt
Expand Up @@ -20,7 +20,6 @@ add_llvm_library(omptarget
interface.cpp
interop.cpp
omptarget.cpp
ompt_callback.cpp
rtl.cpp
LegacyAPI.cpp

Expand Down
75 changes: 0 additions & 75 deletions openmp/libomptarget/src/ompt_callback.cpp

This file was deleted.

1 change: 0 additions & 1 deletion openmp/runtime/CMakeLists.txt
Expand Up @@ -419,7 +419,6 @@ add_subdirectory(test)
# make these variables available for tools:
set(LIBOMP_LIBRARY_DIR ${LIBOMP_LIBRARY_DIR} PARENT_SCOPE)
set(LIBOMP_INCLUDE_DIR ${LIBOMP_INCLUDE_DIR} PARENT_SCOPE)
set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${LIBOMP_OMP_TOOLS_INCLUDE_DIR} PARENT_SCOPE)
# make these variables available for tools/libompd:
set(LIBOMP_SRC_DIR ${LIBOMP_SRC_DIR} PARENT_SCOPE)
set(LIBOMP_OMPD_SUPPORT ${LIBOMP_OMPD_SUPPORT} PARENT_SCOPE)
2 changes: 0 additions & 2 deletions openmp/runtime/cmake/config-ix.cmake
Expand Up @@ -330,8 +330,6 @@ else()
endif()
endif()

set(LIBOMP_HAVE_OMPT_SUPPORT ${LIBOMP_HAVE_OMPT_SUPPORT} PARENT_SCOPE)

# Check if HWLOC support is available
if(${LIBOMP_USE_HWLOC})
find_path(LIBOMP_HWLOC_INCLUDE_DIR NAMES hwloc.h HINTS ${LIBOMP_HWLOC_INSTALL_DIR} PATH_SUFFIXES include)
Expand Down
1 change: 0 additions & 1 deletion openmp/runtime/src/CMakeLists.txt
Expand Up @@ -391,7 +391,6 @@ if(${LIBOMP_OMPT_SUPPORT})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH})
# install under legacy name ompt.h
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/omp-tools.h DESTINATION ${LIBOMP_HEADERS_INSTALL_PATH} RENAME ompt.h)
set(LIBOMP_OMP_TOOLS_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
endif()
if(${LIBOMP_FORTRAN_MODULES})
install(FILES
Expand Down
1 change: 0 additions & 1 deletion openmp/runtime/src/exports_so.txt
Expand Up @@ -26,7 +26,6 @@ VERSION {
# OMPT API
#
ompt_start_tool; # OMPT start interface
ompt_libomp_connect; # OMPT libomptarget interface

ompc_*; # omp.h renames some standard functions to ompc_*.
kmp_*; # Intel extensions.
Expand Down
63 changes: 7 additions & 56 deletions openmp/runtime/src/ompt-general.cpp
Expand Up @@ -110,9 +110,6 @@ static void *ompt_tool_module = NULL;
#define OMPT_DLCLOSE(Lib) dlclose(Lib)
#endif

/// Used to track the initializer and the finalizer provided by libomptarget
static ompt_start_tool_result_t *libomptarget_ompt_result = NULL;

/*****************************************************************************
* forward declarations
****************************************************************************/
Expand Down Expand Up @@ -459,7 +456,7 @@ void ompt_pre_init() {
if (verbose_init && verbose_file != stderr && verbose_file != stdout)
fclose(verbose_file);
#if OMPT_DEBUG
printf("ompt_pre_init(): ompt_enabled = %d\n", ompt_enabled.enabled);
printf("ompt_pre_init(): ompt_enabled = %d\n", ompt_enabled);
#endif
}

Expand Down Expand Up @@ -512,13 +509,12 @@ void ompt_post_init() {
}

void ompt_fini() {
if (ompt_enabled.enabled) {
if (ompt_start_tool_result && ompt_start_tool_result->finalize) {
ompt_start_tool_result->finalize(&(ompt_start_tool_result->tool_data));
}
if (libomptarget_ompt_result && libomptarget_ompt_result->finalize) {
libomptarget_ompt_result->finalize(NULL);
}
if (ompt_enabled.enabled
#if OMPD_SUPPORT
&& ompt_start_tool_result && ompt_start_tool_result->finalize
#endif
) {
ompt_start_tool_result->finalize(&(ompt_start_tool_result->tool_data));
}

if (ompt_tool_module)
Expand Down Expand Up @@ -873,50 +869,5 @@ static ompt_interface_fn_t ompt_fn_lookup(const char *s) {

FOREACH_OMPT_INQUIRY_FN(ompt_interface_fn)

#undef ompt_interface_fn

return NULL;
}

/// Lookup function to query libomp callbacks registered by the tool
static ompt_interface_fn_t ompt_libomp_target_fn_lookup(const char *s) {
#define ompt_interface_fn(fn, type, code) \
if (strcmp(s, #fn) == 0) \
return (ompt_interface_fn_t)ompt_callbacks.ompt_callback(fn);

FOREACH_OMPT_DEVICE_EVENT(ompt_interface_fn)
FOREACH_OMPT_EMI_EVENT(ompt_interface_fn)
FOREACH_OMPT_NOEMI_EVENT(ompt_interface_fn)

#undef ompt_interface_fn

return (ompt_interface_fn_t)0;
}

/// This function is called by the libomptarget connector to assign
/// callbacks already registered with libomp.
_OMP_EXTERN void ompt_libomp_connect(ompt_start_tool_result_t *result) {
OMPT_VERBOSE_INIT_PRINT("libomp --> OMPT: Enter libomp_ompt_connect\n");

// 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,
0 /* initial_device_num */, nullptr /* tool_data */);
// 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 libomp_ompt_connect\n");
}
5 changes: 0 additions & 5 deletions openmp/runtime/src/ompt-specific.cpp
Expand Up @@ -188,11 +188,6 @@ ompt_task_info_t *__ompt_get_scheduling_taskinfo(int depth) {
//******************************************************************************
// interface operations
//******************************************************************************
//----------------------------------------------------------
// initialization support
//----------------------------------------------------------

void __ompt_force_initialization() { __kmp_serial_initialize(); }

//----------------------------------------------------------
// thread support
Expand Down
4 changes: 0 additions & 4 deletions openmp/runtime/src/ompt-specific.h
Expand Up @@ -20,10 +20,6 @@
* forward declarations
****************************************************************************/

/// Entrypoint used by libomptarget to register callbacks in libomp, if not
/// done already
void __ompt_force_initialization();

void __ompt_team_assign_id(kmp_team_t *team, ompt_data_t ompt_pid);
void __ompt_thread_assign_wait_id(void *variable);

Expand Down

0 comments on commit 88e557c

Please sign in to comment.