Skip to content

[ExecutionEngine] Move IntelJITEventsWrapper to its own library. NFC #81825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions llvm/lib/ExecutionEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ if(BUILD_SHARED_LIBS)
target_link_libraries(LLVMExecutionEngine PUBLIC LLVMRuntimeDyld)
endif()

if( LLVM_USE_INTEL_JITEVENTS )
add_subdirectory(IntelJITProfiling)
add_subdirectory(IntelJITEvents)
endif( LLVM_USE_INTEL_JITEVENTS )

add_subdirectory(Interpreter)
add_subdirectory(JITLink)
add_subdirectory(MCJIT)
Expand All @@ -38,10 +43,6 @@ if( LLVM_USE_OPROFILE )
add_subdirectory(OProfileJIT)
endif( LLVM_USE_OPROFILE )

if( LLVM_USE_INTEL_JITEVENTS )
add_subdirectory(IntelJITEvents)
endif( LLVM_USE_INTEL_JITEVENTS )

if( LLVM_USE_PERF )
add_subdirectory(PerfJITEvents)
endif( LLVM_USE_PERF )
43 changes: 2 additions & 41 deletions llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,8 @@
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. )

if(NOT DEFINED ITTAPI_GIT_REPOSITORY)
set(ITTAPI_GIT_REPOSITORY https://github.com/intel/ittapi.git)
endif()

if(NOT DEFINED ITTAPI_GIT_TAG)
set(ITTAPI_GIT_TAG v3.18.12)
endif()

if(NOT DEFINED ITTAPI_SOURCE_DIR)
set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR})
endif()

if(NOT EXISTS ${ITTAPI_SOURCE_DIR}/ittapi)
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ITTAPI_GIT_REPOSITORY}
WORKING_DIRECTORY ${ITTAPI_SOURCE_DIR}
RESULT_VARIABLE GIT_CLONE_RESULT)
if(NOT GIT_CLONE_RESULT EQUAL "0")
message(FATAL_ERROR "git clone ${ITTAPI_GIT_REPOSITORY} failed with ${GIT_CLONE_RESULT}, please clone ${ITTAPI_GIT_REPOSITORY}")
endif()
endif()

execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${ITTAPI_GIT_TAG}
WORKING_DIRECTORY ${ITTAPI_SOURCE_DIR}/ittapi
RESULT_VARIABLE GIT_CHECKOUT_RESULT)
if(NOT GIT_CHECKOUT_RESULT EQUAL "0")
message(FATAL_ERROR "git checkout ${ITTAPI_GIT_TAG} failed with ${GIT_CHECKOUT_RESULT}, please checkout ${ITTAPI_GIT_TAG} at ${ITTAPI_SOURCE_DIR}/ittapi")
endif()

include_directories( ${ITTAPI_SOURCE_DIR}/ittapi/include/ )

if( HAVE_LIBDL )
set(LLVM_INTEL_JIT_LIBS ${CMAKE_DL_LIBS})
endif()

set(LLVM_INTEL_JIT_LIBS ${LLVM_PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS})


include_directories( ${PROJECT_BINARY_DIR}/ittapi/include/ )
add_llvm_component_library(LLVMIntelJITEvents
IntelJITEventListener.cpp
jitprofiling.c
${ITTAPI_SOURCE_DIR}/ittapi/src/ittnotify/ittnotify_static.c

LINK_LIBS ${LLVM_INTEL_JIT_LIBS}

LINK_COMPONENTS
CodeGen
Expand All @@ -51,6 +11,7 @@ add_llvm_component_library(LLVMIntelJITEvents
Support
Object
ExecutionEngine
IntelJITProfiling
)

add_dependencies(LLVMIntelJITEvents LLVMCodeGen)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//

#include "IntelJITEventsWrapper.h"
#include "IntelJITProfiling/IntelJITEventsWrapper.h"
#include "ittnotify.h"
#include "llvm-c/ExecutionEngine.h"
#include "llvm/ADT/DenseMap.h"
Expand Down
47 changes: 47 additions & 0 deletions llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. )

if(NOT DEFINED ITTAPI_GIT_REPOSITORY)
set(ITTAPI_GIT_REPOSITORY https://github.com/intel/ittapi.git)
endif()

if(NOT DEFINED ITTAPI_GIT_TAG)
set(ITTAPI_GIT_TAG v3.18.12)
endif()

if(NOT DEFINED ITTAPI_SOURCE_DIR)
set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR})
endif()

if(NOT EXISTS ${ITTAPI_SOURCE_DIR}/ittapi)
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ITTAPI_GIT_REPOSITORY}
WORKING_DIRECTORY ${ITTAPI_SOURCE_DIR}
RESULT_VARIABLE GIT_CLONE_RESULT)
if(NOT GIT_CLONE_RESULT EQUAL "0")
message(FATAL_ERROR "git clone ${ITTAPI_GIT_REPOSITORY} failed with ${GIT_CLONE_RESULT}, please clone ${ITTAPI_GIT_REPOSITORY}")
endif()
endif()

execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${ITTAPI_GIT_TAG}
WORKING_DIRECTORY ${ITTAPI_SOURCE_DIR}/ittapi
RESULT_VARIABLE GIT_CHECKOUT_RESULT)
if(NOT GIT_CHECKOUT_RESULT EQUAL "0")
message(FATAL_ERROR "git checkout ${ITTAPI_GIT_TAG} failed with ${GIT_CHECKOUT_RESULT}, please checkout ${ITTAPI_GIT_TAG} at ${ITTAPI_SOURCE_DIR}/ittapi")
endif()

include_directories( ${ITTAPI_SOURCE_DIR}/ittapi/include/ )

if( HAVE_LIBDL )
set(LLVM_INTEL_JIT_LIBS ${CMAKE_DL_LIBS})
endif()

set(LLVM_INTEL_JIT_LIBS ${LLVM_PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS})


add_llvm_component_library(LLVMIntelJITProfiling
jitprofiling.c
${ITTAPI_SOURCE_DIR}/ittapi/src/ittnotify/ittnotify_static.c

LINK_LIBS ${LLVM_INTEL_JIT_LIBS}

)

2 changes: 1 addition & 1 deletion llvm/tools/llvm-jitlistener/llvm-jitlistener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

#include "../../lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h"
#include "../../lib/ExecutionEngine/IntelJITProfiling/IntelJITEventsWrapper.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
Expand Down