fix(rocr): load thunk libraries from the runtime directory#8912
fix(rocr): load thunk libraries from the runtime directory#8912fcui-amd wants to merge 1 commit into
Conversation
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
kentrussell
left a comment
There was a problem hiding this comment.
Thunk part is fine. Will let David/Chris give the approval for the ROCr side
cfreeamd
left a comment
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd)
The adjacent-path loader fallback in thunk_loader.cpp and the new os::GetAdjacentLibraryPath implementations (Linux dladdr, Windows GetModuleHandleExA/GetModuleFileNameA) look correct — self-locating via the runtime's own address, with sane truncation handling on Windows and a null-guard on DlError(). Two inline notes below (one Question on the bundled .ver exports, one Nit on the success log). Noting the PR is labeled "Not ready to Review," so this is early feedback.
| hsaKmtGetRuntimeCapabilities; | ||
| hsaKmtDebugTrapIoctl; | ||
| hsaKmtGetCoreRuntimeInfo; | ||
| hsaKmtGetCoreDeviceInfo; |
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd)
[Question] These three exports (hsaKmtGetKernelQueueId, hsaKmtGetCoreRuntimeInfo, hsaKmtGetCoreDeviceInfo, mirrored in librocdxg.ver) come from the separate "export missing libhsakmt symbols" commit and are unrelated to the adjacent-path loader change. Two things worth confirming: (a) are all three actually defined in libhsakmt? A .ver entry for an undefined symbol is a silent no-op. (b) Is widening the public export surface intended as part of this PR, or would it be cleaner to split it out? The ABI change and the loader change have independent risk/review profiles.
There was a problem hiding this comment.
Sorry, this commit belongs to another PR and was included here by mistake.
| } | ||
| } | ||
| if (thunk_handle != nullptr) { | ||
| debug_print("Load %s successully!\n", library_name.c_str()); |
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd)
[Nit] When the library is loaded via the adjacent-path fallback, this success message still prints library_name (the original name), so the log won't reveal that the fallback path was actually used. Consider logging the path that succeeded to aid diagnosis. (Also a pre-existing typo here while the line is nearby: "successully" → "successfully".)
Signed-off-by: Flora Cui <flora.cui@amd.com>
5495cc3 to
ed7768a
Compare
Motivation
rocminfo
WSL environment detected.
Cannot load librocdxg.so, failed:librocdxg.so: cannot open shared object file: No such file or directory
GetExportAddress failed: /opt/venv/lib/python3.14/site-packages/_rocm_sdk_devel/bin/../lib/libhsa-runtime64.so.1: undefined symbol: hsaKmtOpenKFD
hsa_init Failed, possibly no supported GPU devices
Technical Details
Add a fallback path for loading thunk libraries when the normal platform library search fails.
The fallback locates the directory containing the currently loaded ROCR runtime library and attempts to load the thunk library from the same directory.
Issue Tracking
Test Plan
rocminfo pass without specified LD_LIBRARY_PATH setting
Test Result
rocminfo pass
Submission Checklist