This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by jhuber6 on Jan 23 2023, 7:51 AM.

Details

Summary

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

Diff Detail

Event Timeline

jhuber6 created this revision.Jan 23 2023, 7:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 23 2023, 7:51 AM
jhuber6 requested review of this revision.Jan 23 2023, 7:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 23 2023, 7:51 AM
jhuber6 updated this revision to Diff 491381.Jan 23 2023, 7:55 AM

Cleanup unrelated lines.

How does the above message behaves when there is no GPU on the node.

How does the above message behaves when there is no GPU on the node.

This will fire anytime we fail with a mandatory offloading but there were no images registered to a plugin. Maybe this could happen if the plugin failed to load the x86 plugin. That plugin uses the architecture just like any other, but it's usually empty. I should maybe add a special string if it's empty.

jhuber6 updated this revision to Diff 491386.Jan 23 2023, 8:08 AM

Add special handling for if the Info is null or contains and empty string.

When libomptarget failed to load the amd plugin due to missing hsa runtime so files.
I got

yeluo@epyc-server:~$ clang++ -fopenmp --offload-arch=gfx90a main.cpp
yeluo@epyc-server:~$ OMP_TARGET_OFFLOAD=mandatory ./a.out 
Libomptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
Libomptarget error: None of the images found are compatible: gfx90a
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory

None of the images found are compatible: gfx90a this line is a bit hard to digest. Could you print a list of loaded plugins and a list of images.

When libomptarget failed to load the amd plugin due to missing hsa runtime so files.
I got

yeluo@epyc-server:~$ clang++ -fopenmp --offload-arch=gfx90a main.cpp
yeluo@epyc-server:~$ OMP_TARGET_OFFLOAD=mandatory ./a.out 
Libomptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
Libomptarget error: None of the images found are compatible: gfx90a
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory

None of the images found are compatible: gfx90a this line is a bit hard to digest. Could you print a list of loaded plugins and a list of images.

The following is the list of images found. I could try to make that more explicit. And by default we should have every plugin loaded.

When libomptarget failed to load the amd plugin due to missing hsa runtime so files.
I got

yeluo@epyc-server:~$ clang++ -fopenmp --offload-arch=gfx90a main.cpp
yeluo@epyc-server:~$ OMP_TARGET_OFFLOAD=mandatory ./a.out 
Libomptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
Libomptarget error: None of the images found are compatible: gfx90a
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory

None of the images found are compatible: gfx90a this line is a bit hard to digest. Could you print a list of loaded plugins and a list of images.

The following is the list of images found. I could try to make that more explicit. And by default we should have every plugin loaded.

By list all the successfully loaded plugins and images. I can figure out if the issue was caused by missing plugin or missing image.

By list all the successfully loaded plugins and images. I can figure out if the issue was caused by missing plugin or missing image.

It's tough to tell which image was intended for which plugin. The best we could do is print out every plugin, I guess this can happen if the library paths aren't set up correctly. Printing this would require making the RTLName present in every build. Maybe I can just print a special message if we didn't find any plugins. Since I think that's more likely to be the cause of failure vs. a single one.

jhuber6 updated this revision to Diff 491514.Jan 23 2023, 2:46 PM

Adding message if we didn't find any plugins. Usually happens if the paths are wrong.

It doesn't print well

$ OMP_TARGET_OFFLOAD=mandatory ./a.out 
Libomptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
Libomptarget error: None of the images ( gfx90a 
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory
jdoerfert added inline comments.Mar 16 2023, 10:48 AM
openmp/libomptarget/src/omptarget.cpp
275

None of the images, what?

jhuber6 updated this revision to Diff 506095.Mar 17 2023, 8:38 AM

Updating, error message now looks like this.

Libomptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
Libomptarget error: No images with a supported architecture found (sm_70)
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory
[1]    159574 IOT instruction (core dumped)  OMP_TARGET_OFFLOAD=mandatory ./a.out
ye-luo accepted this revision.Mar 17 2023, 9:29 AM

Still prefer a more clear message.

openmp/libomptarget/src/omptarget.cpp
275

FAILURE_MESSAGE("No images found compatible with the hardware. Found ");
fprintf(stderr, "(%s) images\n", llvm::join(Archs, ",").c_str());

This revision is now accepted and ready to land.Mar 17 2023, 9:29 AM
jhuber6 updated this revision to Diff 506116.Mar 17 2023, 9:32 AM

Changing message