Skip to content

Commit 51b7969

Browse files
authored
[SYCL] Improve plugins loading (#6658)
1 parent 1c9ddba commit 51b7969

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sycl/source/detail/pi.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,15 @@ static void initializePlugins(std::vector<plugin> &Plugins) {
387387
std::cerr << "SYCL_PI_TRACE[all]: "
388388
<< "No Plugins Found." << std::endl;
389389

390+
const std::string LibSYCLDir =
391+
sycl::detail::OSUtil::getCurrentDSODir() + sycl::detail::OSUtil::DirSep;
392+
390393
for (unsigned int I = 0; I < PluginNames.size(); I++) {
391394
std::shared_ptr<PiPlugin> PluginInformation = std::make_shared<PiPlugin>(
392395
PiPlugin{_PI_H_VERSION_STRING, _PI_H_VERSION_STRING,
393396
/*Targets=*/nullptr, /*FunctionPointers=*/{}});
394397

395-
void *Library = loadPlugin(PluginNames[I].first);
398+
void *Library = loadPlugin(LibSYCLDir + PluginNames[I].first);
396399

397400
if (!Library) {
398401
if (trace(PI_TRACE_ALL)) {

sycl/test/basic_tests/library_loading.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
using namespace sycl;
99

1010
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)}}
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)}}
1414
queue q;
1515
q.submit([&](handler &cgh) {});
1616
}

0 commit comments

Comments
 (0)