diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt --- a/mlir/lib/ExecutionEngine/CMakeLists.txt +++ b/mlir/lib/ExecutionEngine/CMakeLists.txt @@ -13,6 +13,16 @@ JitRunner.cpp ) +if(LLVM_USE_INTEL_JITEVENTS) + set(LLVM_JIT_LISTENER_LIB + IntelJITEvents) +endif(LLVM_USE_INTEL_JITEVENTS) + +if(LLVM_USE_PERF) + set(LLVM_JIT_LISTENER_LIB + PerfJITEvents) +endif(LLVM_USE_PERF) + add_mlir_library(MLIRExecutionEngine ExecutionEngine.cpp OptUtils.cpp @@ -42,6 +52,7 @@ TransformUtils nativecodegen IPO + ${LLVM_JIT_LISTENER_LIB} LINK_LIBS PUBLIC MLIRLLVMIR diff --git a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp --- a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp @@ -217,9 +217,15 @@ gdbListener(enableGDBNotificationListener ? llvm::JITEventListener::createGDBRegistrationListener() : nullptr), - perfListener(enablePerfNotificationListener - ? llvm::JITEventListener::createPerfJITEventListener() - : nullptr) {} + perfListener(nullptr) { + if (enablePerfNotificationListener) { + if (auto *listener = llvm::JITEventListener::createPerfJITEventListener()) + perfListener = listener; + else if (auto *listener = + llvm::JITEventListener::createIntelJITEventListener()) + perfListener = listener; + } +} Expected> ExecutionEngine::create( ModuleOp m,