[llvm] Error out when `LIBOMPTARGET_OMPT_SUPPORT` is requested but not supported (PR #146865)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 3 04:51:35 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Alexander Grund (Flamefire)
<details>
<summary>Changes</summary>
Currently a user could pass `-DLIBOMPTARGET_OMPT_SUPPORT=ON` but the build may ignore it
There is already a check for `LIBOMP_OMPT_SUPPORT AND NOT LIBOMP_HAVE_OMPT_SUPPORT` causing an error so a) There should be a similar error on mismatch of passed options and supported configuration b) The check for `LIBOMP_HAVE_OMPT_SUPPORT` is redundant
---
Full diff: https://github.com/llvm/llvm-project/pull/146865.diff
1 Files Affected:
- (modified) offload/CMakeLists.txt (+6-4)
``````````diff
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index 0a441c3bc5782..f5c39e9ebf4a3 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -326,15 +326,17 @@ endmacro()
# OMPT support for libomptarget
# Follow host OMPT support and check if host support has been requested.
-# LIBOMP_HAVE_OMPT_SUPPORT indicates whether host OMPT support has been implemented.
# LIBOMP_OMPT_SUPPORT indicates whether host OMPT support has been requested (default is ON).
-# LIBOMPTARGET_OMPT_SUPPORT indicates whether target OMPT support has been requested (default is ON).
set(OMPT_TARGET_DEFAULT FALSE)
-if ((LIBOMP_HAVE_OMPT_SUPPORT) AND (LIBOMP_OMPT_SUPPORT) AND (NOT WIN32))
+if (LIBOMP_OMPT_SUPPORT AND (NOT WIN32))
set (OMPT_TARGET_DEFAULT TRUE)
endif()
+# LIBOMPTARGET_OMPT_SUPPORT indicates whether target OMPT support has been requested.
set(LIBOMPTARGET_OMPT_SUPPORT ${OMPT_TARGET_DEFAULT} CACHE BOOL "OMPT-target-support?")
-if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
+if (LIBOMPTARGET_OMPT_SUPPORT)
+ if(NOT LIBOMP_OMPT_SUPPORT)
+ message(FATAL_ERROR "OMPT Target support requested but OMPT (host) support is not enabled")
+ endif()
add_definitions(-DOMPT_SUPPORT=1)
message(STATUS "OMPT target enabled")
else()
``````````
</details>
https://github.com/llvm/llvm-project/pull/146865
More information about the llvm-commits
mailing list