[llvm] [ExecutionEngine] Move IntelJITEventsWrapper to its own library. NFC (PR #81825)

Hongyu Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 22:20:34 PST 2024


https://github.com/yugier created https://github.com/llvm/llvm-project/pull/81825

Split IntelJITEventsWrapper away from IntelJITEvents and rename it into IntelJITProfiling.
NFC

>From e655d389b21d1149d376e87cd0d489ad940e2a31 Mon Sep 17 00:00:00 2001
From: Hongyu Chen <hongyc4 at uci.edu>
Date: Mon, 12 Feb 2024 20:12:51 -0800
Subject: [PATCH] [ExecutionEngine] Move IntelJITEventsWrapper to its own
 library. NFC

Split IntelJITEventsWrapper away from IntelJITEvents and rename it into
IntelJITProfiling.
NFC
---
 llvm/lib/ExecutionEngine/CMakeLists.txt       |  9 ++--
 .../IntelJITEvents/CMakeLists.txt             | 43 +----------------
 .../IntelJITEvents/IntelJITEventListener.cpp  |  2 +-
 .../IntelJITProfiling/CMakeLists.txt          | 47 +++++++++++++++++++
 .../IntelJITEventsWrapper.h                   |  0
 .../ittnotify_config.h                        |  0
 .../ittnotify_types.h                         |  0
 .../jitprofiling.c                            |  0
 .../jitprofiling.h                            |  0
 .../llvm-jitlistener/llvm-jitlistener.cpp     |  2 +-
 10 files changed, 56 insertions(+), 47 deletions(-)
 create mode 100644 llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt
 rename llvm/lib/ExecutionEngine/{IntelJITEvents => IntelJITProfiling}/IntelJITEventsWrapper.h (100%)
 rename llvm/lib/ExecutionEngine/{IntelJITEvents => IntelJITProfiling}/ittnotify_config.h (100%)
 rename llvm/lib/ExecutionEngine/{IntelJITEvents => IntelJITProfiling}/ittnotify_types.h (100%)
 rename llvm/lib/ExecutionEngine/{IntelJITEvents => IntelJITProfiling}/jitprofiling.c (100%)
 rename llvm/lib/ExecutionEngine/{IntelJITEvents => IntelJITProfiling}/jitprofiling.h (100%)

diff --git a/llvm/lib/ExecutionEngine/CMakeLists.txt b/llvm/lib/ExecutionEngine/CMakeLists.txt
index af6be62dd52531..02178ff526bf8e 100644
--- a/llvm/lib/ExecutionEngine/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/CMakeLists.txt
@@ -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)
@@ -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 )
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
index 0c5017c359d6ff..b4fd04d65e2631 100644
--- a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
@@ -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
@@ -51,6 +11,7 @@ add_llvm_component_library(LLVMIntelJITEvents
   Support
   Object
   ExecutionEngine
+  IntelJITProfiling
 )
 
 add_dependencies(LLVMIntelJITEvents LLVMCodeGen)
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp b/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
index 4afcf95e9e8e8d..b1e99df73b4839 100644
--- a/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
+++ b/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "IntelJITEventsWrapper.h"
+#include "IntelJITProfiling/IntelJITEventsWrapper.h"
 #include "ittnotify.h"
 #include "llvm-c/ExecutionEngine.h"
 #include "llvm/ADT/DenseMap.h"
diff --git a/llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt b/llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt
new file mode 100644
index 00000000000000..0aedadc65df05f
--- /dev/null
+++ b/llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt
@@ -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}
+
+)
+
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h b/llvm/lib/ExecutionEngine/IntelJITProfiling/IntelJITEventsWrapper.h
similarity index 100%
rename from llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventsWrapper.h
rename to llvm/lib/ExecutionEngine/IntelJITProfiling/IntelJITEventsWrapper.h
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h b/llvm/lib/ExecutionEngine/IntelJITProfiling/ittnotify_config.h
similarity index 100%
rename from llvm/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h
rename to llvm/lib/ExecutionEngine/IntelJITProfiling/ittnotify_config.h
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/ittnotify_types.h b/llvm/lib/ExecutionEngine/IntelJITProfiling/ittnotify_types.h
similarity index 100%
rename from llvm/lib/ExecutionEngine/IntelJITEvents/ittnotify_types.h
rename to llvm/lib/ExecutionEngine/IntelJITProfiling/ittnotify_types.h
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/jitprofiling.c b/llvm/lib/ExecutionEngine/IntelJITProfiling/jitprofiling.c
similarity index 100%
rename from llvm/lib/ExecutionEngine/IntelJITEvents/jitprofiling.c
rename to llvm/lib/ExecutionEngine/IntelJITProfiling/jitprofiling.c
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/jitprofiling.h b/llvm/lib/ExecutionEngine/IntelJITProfiling/jitprofiling.h
similarity index 100%
rename from llvm/lib/ExecutionEngine/IntelJITEvents/jitprofiling.h
rename to llvm/lib/ExecutionEngine/IntelJITProfiling/jitprofiling.h
diff --git a/llvm/tools/llvm-jitlistener/llvm-jitlistener.cpp b/llvm/tools/llvm-jitlistener/llvm-jitlistener.cpp
index bd25a000c75331..59949435f9ca44 100644
--- a/llvm/tools/llvm-jitlistener/llvm-jitlistener.cpp
+++ b/llvm/tools/llvm-jitlistener/llvm-jitlistener.cpp
@@ -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"



More information about the llvm-commits mailing list