depot/third_party/nixpkgs/pkgs/development/libraries/rocm-runtime/rocr-ext-dir.diff
Default email 1ffc76754d Project import generated by Copybara.
GitOrigin-RevId: a5cc7d3197705f933d88e97c0c61849219ce76c1
2020-07-18 18:06:22 +02:00

23 lines
1,014 B
Diff

diff --git a/src/core/runtime/runtime.cpp b/src/core/runtime/runtime.cpp
index dd6a15c..fb6de49 100644
--- a/src/core/runtime/runtime.cpp
+++ b/src/core/runtime/runtime.cpp
@@ -1358,7 +1358,17 @@ void Runtime::LoadExtensions() {
core::HsaApiTable::HSA_EXT_FINALIZER_API_TABLE_ID);
// Update Hsa Api Table with handle of Image extension Apis
- extensions_.LoadImage(kImageLib[os_index(os::current_os)]);
+ //
+ // Use ROCR_EXT_DIR when it is non-empty. Otherwise, try to load the
+ // library from the OpenGL driver path.
+ std::string extDirVar = os::GetEnvVar("ROCR_EXT_DIR");
+ if (!extDirVar.empty()) {
+ extensions_.LoadImage(extDirVar + "/" + kImageLib[os_index(os::current_os)]);
+ } else {
+ std::string globalDriverDir("@rocrExtDir@");
+ extensions_.LoadImage(globalDriverDir + "/" + kImageLib[os_index(os::current_os)]);
+ }
+
hsa_api_table_.LinkExts(&extensions_.image_api,
core::HsaApiTable::HSA_EXT_IMAGE_API_TABLE_ID);
}