File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 7
7
// ===----------------------------------------------------------------------===//
8
8
9
9
#include < CL/sycl/detail/defines.hpp>
10
+ #include < CL/sycl/detail/pi.hpp>
10
11
11
12
#include < dlfcn.h>
12
13
#include < string>
@@ -19,7 +20,12 @@ namespace pi {
19
20
void *loadOsLibrary (const std::string &PluginPath) {
20
21
// TODO: Check if the option RTLD_NOW is correct. Explore using
21
22
// 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;
23
29
}
24
30
25
31
int unloadOsLibrary (void *Library) { return dlclose (Library); }
Original file line number Diff line number Diff line change
1
+ // REQUIRES: linux
2
+ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
3
+ // RUN: env SYCL_PI_TRACE=-1 %t.out 2>&1 | FileCheck %s
4
+
5
+ // Checks pi traces on library loading
6
+ #include < CL/sycl.hpp>
7
+
8
+ using namespace cl ::sycl;
9
+
10
+ int main () {
11
+ // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(libpi_cuda.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_cuda.so)}}
12
+ // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(libpi_hip.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_hip.so)}}
13
+ // CHECK: {{(SYCL_PI_TRACE\[-1\]: dlopen\(libpi_esimd_emulator.so\) failed with)|(SYCL_PI_TRACE\[basic\]: Plugin found and successfully loaded: libpi_esimd_emulator.so)}}
14
+ queue q;
15
+ q.submit ([&](handler &cgh) {});
16
+ }
You can’t perform that action at this time.
0 commit comments