You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native runtime and installer: load the HIP runtime only from System32 or an official SDK by full path #242
PR #239 makes the Python tools and build scripts use only an official AMD HIP SDK (clean/runner/sdk.py). The native
runtime and the installer still have their own HIP runtime lookup, which does not follow that rule:
clean/runtime/device.cpp (init, around lines 301-335) on Windows tries, in order: an explicit rocm_dir (any
folder, or an exact .dll the installer selected), amdhip64_7.dll from System32, then the same bare name through the
standard DLL search path (which includes PATH), then the newest folder under C:\Program Files\AMD\ROCm, then %HIP_PATH%\bin. On Linux it tries rocm_dir/lib/libamdhip64.so, then the bare name libamdhip64.so (the loader's
search path). clean/runtime/runtime.cpp (around lines 698-706) reaches this loader.
clean/installer/src/wg_core/checks.cpp (around lines 151-189, 210-213, 284-300) probes PATH and HIP_PATH
candidates on its own.
Example: when System32 has no amdhip64_7.dll, a DLL of that name found through PATH is loaded, or HIP_PATH
pointing at a non-official SDK copy is used. The installer probe can select such a copy as well.
These rules predate #239; changing them changes product behaviour, so they were kept out of that PR.
Proposed rule (runtime and installer the same)
System32 first: the AMD driver's own amdhip64_7.dll (LOAD_LIBRARY_SEARCH_SYSTEM32).
Then an official HIP SDK install by full path: C:\Program Files\AMD\ROCm\<version>\bin\amdhip64_7.dll, newest
compatible version first (Linux: /opt/rocm-<version>/lib or /opt/rocm/lib, by full path).
Never a bare-name search through PATH or the loader's default search path.
HIP_PATH only when it resolves to one of the official installs of step 2 (otherwise ignored, with a note in the log
that names it by id only, not by path).
An explicit rocm_dir or installer-selected DLL: only when it is System32's copy or inside an official install
(tests that need another one get an explicit, logged override).
The installer probe (checks.cpp) uses exactly these rules, so it never selects a runtime the runtime would refuse.
Done when
device.cpp, runtime.cpp and checks.cpp follow the rule above; no bare-name load remains.
Tests (no GPU): with a stand-in DLL on PATH and in a HIP_PATH folder outside the official root, neither is
loaded or selected; System32 and the official SDK are; HIP_PATH pointing at an official install is accepted.
BUILDING.md (HIP SDK paragraph) states that the native runtime and installer follow the same rule.
I independently checked the loader discrepancy in this issue against main at 0bf6aa42a0942d71298f1ccc085a856c685ccf8f on Windows 11 / Strix Halo, then built and scoped-tested a Windows-only source candidate.
Confirmed in the pinned upstream source
clean/runtime/device.cpp still contains a bare-name LoadLibraryExA("amdhip64_7.dll", ..., 0) fallback, accepts an arbitrary explicit rocm_dir/DLL before System32, and accepts arbitrary HIP_PATH.
clean/installer/src/wg_core/checks.cpp::HipCandidates() separately scans PATH and HIP_PATH. The two components can therefore choose different DLL origins.
Candidate integration (four-file local diff, including documentation):
Add a shared Windows path-selection helper used by both the runtime and installer.
Enumerate the driver System32 DLL first, then version-ordered SDK DLLs from C:\Program Files\AMD\ROCm\<version>\bin by full path; no production bare-name or PATH lookup.
Restrict dependent DLL lookup to the DLL directory and System32, and verify the runtime's observed loaded module path matches the approved candidate.
Verification: A genuinely compiled, harmless stand-in amdhip64_7.dll was placed in an isolated directory included on the native test process's PATH; it was never loaded. The patched policy rejected it, accepted installed System32/SDK paths, and passed 24/24 native Windows controls (including bad paths, invalid UTF-8, SDK precedence and environment rules). Both modified complete C++ translation units (device.cpp and checks.cpp) compile with MSVC. git diff --check, git apply --check, and git apply passed on a separate pristine checkout at the pinned commit; the resulting files match the working candidate.
Important limits: This is a tested Windows source-level candidate, not an integrated or end-user runtime qualification. I have not linked/installed the full launcher, tested actual WrongGPU GPU operation, implemented the Linux origin rule, or independently validated vendor Authenticode signatures. A path under an official SDK directory is not by itself proof of signing.
I have the four-file unified diff and a SHA-256-bound test/evidence bundle available if useful. Would you prefer a Windows-only PR first, or a single cross-platform patch once the Linux policy and full launcher tests are added?
Activity
nigelhutch commentedon Nov 21, 2026
I independently checked the loader discrepancy in this issue against
mainat0bf6aa42a0942d71298f1ccc085a856c685ccf8fon Windows 11 / Strix Halo, then built and scoped-tested a Windows-only source candidate.Confirmed in the pinned upstream source
clean/runtime/device.cppstill contains a bare-nameLoadLibraryExA("amdhip64_7.dll", ..., 0)fallback, accepts an arbitrary explicitrocm_dir/DLL before System32, and accepts arbitraryHIP_PATH.clean/installer/src/wg_core/checks.cpp::HipCandidates()separately scansPATHandHIP_PATH. The two components can therefore choose different DLL origins.Candidate integration (four-file local diff, including documentation):
C:\Program Files\AMD\ROCm\<version>\binby full path; no production bare-name orPATHlookup.HIP_PATHinputs; retain test-only candidate overrides behindWRONGGPU_TESTING.Verification: A genuinely compiled, harmless stand-in
amdhip64_7.dllwas placed in an isolated directory included on the native test process'sPATH; it was never loaded. The patched policy rejected it, accepted installed System32/SDK paths, and passed 24/24 native Windows controls (including bad paths, invalid UTF-8, SDK precedence and environment rules). Both modified complete C++ translation units (device.cppandchecks.cpp) compile with MSVC.git diff --check,git apply --check, andgit applypassed on a separate pristine checkout at the pinned commit; the resulting files match the working candidate.Important limits: This is a tested Windows source-level candidate, not an integrated or end-user runtime qualification. I have not linked/installed the full launcher, tested actual WrongGPU GPU operation, implemented the Linux origin rule, or independently validated vendor Authenticode signatures. A path under an official SDK directory is not by itself proof of signing.
I have the four-file unified diff and a SHA-256-bound test/evidence bundle available if useful. Would you prefer a Windows-only PR first, or a single cross-platform patch once the Linux policy and full launcher tests are added?
Nigel Hutchinson — NH Applied