Skip to content

Commit e3fa64a

Browse files
committed
[SYCL] Add SYCL_PI_TRACE on loadOsLibrary
1 parent b390cdb commit e3fa64a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sycl/source/detail/posix_pi.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <CL/sycl/detail/defines.hpp>
10+
#include <CL/sycl/detail/pi.hpp>
1011

1112
#include <dlfcn.h>
1213
#include <string>
@@ -19,7 +20,12 @@ namespace pi {
1920
void *loadOsLibrary(const std::string &PluginPath) {
2021
// TODO: Check if the option RTLD_NOW is correct. Explore using
2122
// RTLD_DEEPBIND option when there are multiple plugins.
22-
return dlopen(PluginPath.c_str(), RTLD_NOW);
23+
void *so = dlopen(PluginPath.c_str(), RTLD_NOW);
24+
if (!so && trace(TraceLevel::PI_TRACE_ALL)) {
25+
std::cerr << "SYCL_PI_TRACE[-1]: dlopen(" << PluginPath << ") failed with <"
26+
<< dlerror() << ">" << std::endl;
27+
}
28+
return so;
2329
}
2430

2531
int unloadOsLibrary(void *Library) { return dlclose(Library); }

0 commit comments

Comments
 (0)