diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -71,15 +71,8 @@ set(ENABLE_LIBOMPTARGET OFF) endif() -set(ENABLE_LIBOMPTARGET_PROFILING OFF) -if (ENABLE_LIBOMPTARGET AND NOT LLVM_RUNTIMES_BUILD) - set(ENABLE_LIBOMPTARGET_PROFILING ON) -endif() - option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading." ${ENABLE_LIBOMPTARGET}) -option(OPENMP_ENABLE_LIBOMPTARGET_PROFILING "Enable time profiling for libomptarget." - ${ENABLE_LIBOMPTARGET_PROFILING}) option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF) # Build host runtime library, after LIBOMPTARGET variables are set since they are needed diff --git a/openmp/docs/design/Runtimes.rst b/openmp/docs/design/Runtimes.rst --- a/openmp/docs/design/Runtimes.rst +++ b/openmp/docs/design/Runtimes.rst @@ -707,16 +707,15 @@ LIBOMPTARGET_PROFILE """""""""""""""""""" + ``LIBOMPTARGET_PROFILE`` allows ``libomptarget`` to generate time profile output similar to Clang's ``-ftime-trace`` option. This generates a JSON file based on `Chrome Tracing`_ that can be viewed with ``chrome://tracing`` or the -`Speedscope App`_. Building this feature depends on the `LLVM Support Library`_ -for time trace output. Using this library is enabled by default when building -using the CMake option ``OPENMP_ENABLE_LIBOMPTARGET_PROFILING``. The output will -be saved to the filename specified by the environment variable. For multi-threaded -applications, profiling in ``libomp`` is also needed. Setting the CMake option -``OPENMP_ENABLE_LIBOMP_PROFILING=ON`` to enable the feature. Note that this will -turn ``libomp`` into a C++ library. +`Speedscope App`_. The output will be saved to the filename specified by the +environment variable. For multi-threaded applications, profiling in ``libomp`` +is also needed. Setting the CMake option ``OPENMP_ENABLE_LIBOMP_PROFILING=ON`` +to enable the feature. This feature depends on the `LLVM Support Library`_ +for time trace output. Note that this will turn ``libomp`` into a C++ library. .. _`Chrome Tracing`: https://www.chromium.org/developers/how-tos/trace-event-profiling-tool diff --git a/openmp/libomptarget/src/private.h b/openmp/libomptarget/src/private.h --- a/openmp/libomptarget/src/private.h +++ b/openmp/libomptarget/src/private.h @@ -187,7 +187,6 @@ } } -#ifdef OMPTARGET_PROFILE_ENABLED #include "llvm/Support/TimeProfiler.h" #define TIMESCOPE() llvm::TimeTraceScope TimeScope(__FUNCTION__) #define TIMESCOPE_WITH_IDENT(IDENT) \ @@ -200,6 +199,5 @@ #define TIMESCOPE() #define TIMESCOPE_WITH_IDENT(IDENT) #define TIMESCOPE_WITH_NAME_AND_IDENT(NAME, IDENT) -#endif #endif diff --git a/openmp/libomptarget/src/rtl.cpp b/openmp/libomptarget/src/rtl.cpp --- a/openmp/libomptarget/src/rtl.cpp +++ b/openmp/libomptarget/src/rtl.cpp @@ -38,9 +38,7 @@ PluginManager *PM; -#if OMPTARGET_PROFILE_ENABLED static char *ProfileTraceFile = nullptr; -#endif __attribute__((constructor(101))) void init() { DP("Init target library!\n"); @@ -59,12 +57,10 @@ PM = new PluginManager(UseEventsForAtomicTransfers); -#ifdef OMPTARGET_PROFILE_ENABLED ProfileTraceFile = getenv("LIBOMPTARGET_PROFILE"); // TODO: add a configuration option for time granularity if (ProfileTraceFile) timeTraceProfilerInitialize(500 /* us */, "libomptarget"); -#endif } __attribute__((destructor(101))) void deinit() { @@ -88,7 +84,6 @@ delete PM; -#ifdef OMPTARGET_PROFILE_ENABLED if (ProfileTraceFile) { // TODO: add env var for file output if (auto E = timeTraceProfilerWrite(ProfileTraceFile, "-")) @@ -96,7 +91,6 @@ timeTraceProfilerCleanup(); } -#endif } void RTLsTy::loadRTLs() {