rocm-runtime: make ROCR_EXT_DIR handling more local
This commit is contained in:
parent
5ecf942c11
commit
6d00504061
@ -1,24 +1,23 @@
|
|||||||
diff --git a/src/core/util/lnx/os_linux.cpp b/src/core/util/lnx/os_linux.cpp
|
diff --git a/src/core/runtime/runtime.cpp b/src/core/runtime/runtime.cpp
|
||||||
index fdbe19a..42d4ef8 100644
|
index dd6a15c..fb6de49 100644
|
||||||
--- a/src/core/util/lnx/os_linux.cpp
|
--- a/src/core/runtime/runtime.cpp
|
||||||
+++ b/src/core/util/lnx/os_linux.cpp
|
+++ b/src/core/runtime/runtime.cpp
|
||||||
@@ -161,8 +161,17 @@ static_assert(sizeof(Mutex) == sizeof(pthread_mutex_t*), "OS abstraction size mi
|
@@ -1358,7 +1358,17 @@ void Runtime::LoadExtensions() {
|
||||||
static_assert(sizeof(Thread) == sizeof(os_thread*), "OS abstraction size mismatch");
|
core::HsaApiTable::HSA_EXT_FINALIZER_API_TABLE_ID);
|
||||||
|
|
||||||
LibHandle LoadLib(std::string filename) {
|
// Update Hsa Api Table with handle of Image extension Apis
|
||||||
- void* ret = dlopen(filename.c_str(), RTLD_LAZY);
|
- extensions_.LoadImage(kImageLib[os_index(os::current_os)]);
|
||||||
- if (ret == nullptr) debug_print("LoadLib(%s) failed: %s\n", filename.c_str(), dlerror());
|
+ //
|
||||||
+ std::string extDirFilename = GetEnvVar("ROCR_EXT_DIR") + "/" + filename;
|
+ // Use ROCR_EXT_DIR when it is non-empty. Otherwise, try to load the
|
||||||
+ void* ret = dlopen(extDirFilename.c_str(), RTLD_LAZY);
|
+ // library from the OpenGL driver path.
|
||||||
+
|
+ std::string extDirVar = os::GetEnvVar("ROCR_EXT_DIR");
|
||||||
+ // Attempt to load from the directory hardcoded by rocrExtDir.
|
+ if (!extDirVar.empty()) {
|
||||||
+ if (ret == nullptr) {
|
+ extensions_.LoadImage(extDirVar + "/" + kImageLib[os_index(os::current_os)]);
|
||||||
+ std::string runpathFilename = std::string("@rocrExtDir@") + "/" + filename;
|
+ } else {
|
||||||
+ ret = dlopen(runpathFilename.c_str(), RTLD_LAZY);
|
+ std::string globalDriverDir("@rocrExtDir@");
|
||||||
+
|
+ extensions_.LoadImage(globalDriverDir + "/" + kImageLib[os_index(os::current_os)]);
|
||||||
+ if (ret == nullptr) debug_print("LoadLib(%s) failed: %s\n", filename.c_str(), dlerror());
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
return *(LibHandle*)&ret;
|
hsa_api_table_.LinkExts(&extensions_.image_api,
|
||||||
|
core::HsaApiTable::HSA_EXT_IMAGE_API_TABLE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user