[clang] [clang-repl] Load the HIP runtime from the detected ROCm installation (PR #246462)

Aditya Sinha via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 3 22:19:17 PST 2026


================
@@ -360,12 +360,12 @@ int main(int argc, const char **argv) {
         std::move(CI), std::move(DeviceCI), OffloadKind));
 
     const char *RuntimeLib = UseHip ? "libamdhip64.so" : "libcudart.so";
-    if (DevicePath.empty()) {
-      ExitOnErr(Interp->LoadDynamicLibrary(RuntimeLib));
-    } else {
-      std::string RuntimeLibPath = DevicePath + "/lib/" + RuntimeLib;
-      ExitOnErr(Interp->LoadDynamicLibrary(RuntimeLibPath.c_str()));
-    }
+    std::string RuntimeLibPath = RuntimeLib;
+    if (UseHip && !CB.getHIPRuntimePath().empty())
+      RuntimeLibPath = CB.getHIPRuntimePath().str();
----------------
AdityaSinha149 wrote:

Changed the code to have a `vector` of `CompilationCBs` and added a `SetDriverCompilationCallback` in `ClangRepl.cpp` so that there is no need of adding an extra member in `interpreter.h`. Please re-review.

https://github.com/llvm/llvm-project/pull/246462


More information about the cfe-commits mailing list