[Openmp-commits] [openmp] 27a2940 - [Libomptarget] Emit a special warning when no images are found

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Fri Mar 17 09:37:53 PDT 2023


Author: Joseph Huber
Date: 2023-03-17T11:37:43-05:00
New Revision: 27a2940b8cae6838517afd6227e38ca25fc3ce13

URL: https://github.com/llvm/llvm-project/commit/27a2940b8cae6838517afd6227e38ca25fc3ce13
DIFF: https://github.com/llvm/llvm-project/commit/27a2940b8cae6838517afd6227e38ca25fc3ce13.diff

LOG: [Libomptarget] Emit a special warning when no images are found

When offloading is mandatory we can emit a more helpful message if we
did not find any compatible images with the user's system.

Fixes #60221

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D142369

Added: 
    

Modified: 
    openmp/libomptarget/src/omptarget.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp
index 9d800d75f0f49..392a9f79bd760 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -274,6 +274,17 @@ void handleTargetOutcome(bool Success, ident_t *Loc) {
         FAILURE_MESSAGE("Consult https://openmp.llvm.org/design/Runtimes.html "
                         "for debugging options.\n");
 
+      if (PM->RTLs.UsedRTLs.empty()) {
+        llvm::SmallVector<llvm::StringRef> Archs;
+        llvm::transform(PM->Images, std::back_inserter(Archs),
+                        [](const auto &x) {
+                          return !x.second.Arch ? "empty" : x.second.Arch;
+                        });
+        FAILURE_MESSAGE(
+            "No images found compatible with the installed hardware. ");
+        fprintf(stderr, "Found (%s)\n", llvm::join(Archs, ",").c_str());
+      }
+
       SourceInfo Info(Loc);
       if (Info.isAvailible())
         fprintf(stderr, "%s:%d:%d: ", Info.getFilename(), Info.getLine(),


        


More information about the Openmp-commits mailing list