Skip to content

Commit 27a2940

Browse files
committed
[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 llvm#60221 Reviewed By: ye-luo Differential Revision: https://reviews.llvm.org/D142369
1 parent 962c306 commit 27a2940

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

openmp/libomptarget/src/omptarget.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,17 @@ void handleTargetOutcome(bool Success, ident_t *Loc) {
274274
FAILURE_MESSAGE("Consult https://openmp.llvm.org/design/Runtimes.html "
275275
"for debugging options.\n");
276276

277+
if (PM->RTLs.UsedRTLs.empty()) {
278+
llvm::SmallVector<llvm::StringRef> Archs;
279+
llvm::transform(PM->Images, std::back_inserter(Archs),
280+
[](const auto &x) {
281+
return !x.second.Arch ? "empty" : x.second.Arch;
282+
});
283+
FAILURE_MESSAGE(
284+
"No images found compatible with the installed hardware. ");
285+
fprintf(stderr, "Found (%s)\n", llvm::join(Archs, ",").c_str());
286+
}
287+
277288
SourceInfo Info(Loc);
278289
if (Info.isAvailible())
279290
fprintf(stderr, "%s:%d:%d: ", Info.getFilename(), Info.getLine(),

0 commit comments

Comments
 (0)