Skip to content

Commit

Permalink
[Libomptarget] Emit a special warning when no images are found
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jhuber6 committed Mar 17, 2023
1 parent 962c306 commit 27a2940
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions openmp/libomptarget/src/omptarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 27a2940

Please sign in to comment.