This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][cuda] Gracefully handle missing cuda library
ClosedPublic

Authored by JonChesterfield on Jan 25 2021, 6:26 PM.

Details

Summary

[libomptarget][cuda] Gracefully handle missing cuda library

If using dynamic cuda, and it failed to load, it is not safe to call
cuGetErrorString.

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Jan 25 2021, 6:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2021, 6:26 PM
JonChesterfield added a comment.EditedJan 25 2021, 6:29 PM

Noticed when running offloading on a system with no cuda available. Failing to load cuda from the global constructor didn't matter, but the segv on calling cuGetErrorString did.

An existing hazard, this plugin doesn't record whether the constructor initialisation succeeded (aside from debug messages). If it failed, but there are nvptx offloading images present, I think libomptarget will call back into this library despite the constructor failing, and I'm not sure that will reliably report an error instead of crash. Reading the code suggests it'll deference nullptr for the StreamManager.

This revision is now accepted and ready to land.Jan 25 2021, 6:32 PM
This revision was landed with ongoing or failed builds.Jan 25 2021, 6:54 PM
This revision was automatically updated to reflect the committed changes.

This has failed a CI run, libomp::nested.c, but I don't understand the test output. Going to revert this for now.

JonChesterfield reopened this revision.Jan 25 2021, 7:15 PM
This revision is now accepted and ready to land.Jan 25 2021, 7:15 PM

The failure was probably a symptom of the error fixed at D95467.