From 27a2940b8cae6838517afd6227e38ca25fc3ce13 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 17 Mar 2023 10:37:29 -0500 Subject: [PATCH] [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 --- openmp/libomptarget/src/omptarget.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp index 9d800d7..392a9f7 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 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(), -- 2.7.4