[Openmp-commits] [PATCH] D142369: [Libomptarget] Emit a special warning when no images are found

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 23 07:51:52 PST 2023

jhuber6 created this revision.
jhuber6 added reviewers: ye-luo, jdoerfert, tianshilei1992.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.

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

  rG LLVM Github Monorepo



Index: openmp/libomptarget/src/omptarget.cpp
--- openmp/libomptarget/src/omptarget.cpp
+++ openmp/libomptarget/src/omptarget.cpp
@@ -266,14 +266,27 @@
                         "for debugging options.\n");
       SourceInfo Info(Loc);
+      if (PM->RTLs.UsedRTLs.empty()) {
+        if (Info.isAvailible())
+          fprintf(stderr, "%s:%d:%d: ", Info.getFilename(), Info.getLine(),
+                  Info.getColumn());
+        FAILURE_MESSAGE("None of the images found are compatible: ");
+        for (auto &[Image, Info] : PM->Images)
+          fprintf(stderr, "%s ", Info.Arch);
+        fprintf(stderr, "\n");
+      }
       if (Info.isAvailible())
         fprintf(stderr, "%s:%d:%d: ", Info.getFilename(), Info.getLine(),
         FAILURE_MESSAGE("Source location information not present. Compile with "
                         "-g or -gline-tables-only.\n");
           1, "failure of target construct while offloading is mandatory");
     } else {
       if (getInfoLevel() & OMP_INFOTYPE_DUMP_TABLE)
         for (auto &Device : PM->Devices)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142369.491379.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230123/0f866052/attachment.bin>

More information about the Openmp-commits mailing list