Skip to content

[ROCm] Fix round for #327: stage rocrand.dll on arch-suffixed ROCm wheels - #1

Merged
jeffdaily merged 1 commit into
moat-portfrom
moat-fix-327
Aug 17, 2026
Merged

[ROCm] Fix round for #327: stage rocrand.dll on arch-suffixed ROCm wheels#1
jeffdaily merged 1 commit into
moat-portfrom
moat-fix-327

Conversation

@jeffdaily

Copy link
Copy Markdown
Collaborator

Fix round on upstream PR brian-team#327, staged on moat-fix-327 (base aca06c78, tip 90d6d7cf).

What prompted it

Not maintainer-requested. The windows-gfx1151 revalidation at the published tip found a genuine port defect in the Windows runtime staging: the DLL-copy logic looked for the ROCm libraries package under the exact directory name _rocm_sdk_libraries, but per-architecture TheRock wheels install it as _rocm_sdk_libraries_<arch> (here _rocm_sdk_libraries_gfx1151). The lookup found nothing, rocrand.dll was never copied, and the generated binary died at load (hiprand.dll imports rocrand.dll) with exit 127 before any output. This would fail identically for any user on a single-arch ROCm wheel, so it is a port defect, not a host quirk.

What changed

One commit, 90d6d7c (brian2cuda/device.py, +13/-9): glob _rocm_sdk_libraries* instead of matching an exact directory name, and copy rocrand.dll unconditionally (the copy loop already tolerates absent names — rocrand.dll also ships in the devel package). Both edits sit inside the existing is_hip_backend() and os.name == 'nt' guard; the only unguarded line is a new import glob. Linux behavior untouched.

What revalidated (both at tip 90d6d7c)

  • windows-gfx1151 (Radeon 8060S, TheRock 7.14 per-arch wheel — the failing configuration): 3/3 GPU simulation tests pass, RC=0.
  • linux-gfx90a (MI250X, ROCm 7.2.1): 3/3 pass including the wave64 spike-queue spinlock path; no regression from the Windows-only change.
  • Gates: wave64 via gfx90a, wave32 and windows via gfx1151. CUDA no-regression recorded as an environmental wall (brian2cuda's own CUDA codegen shells out to nvidia-smi, unmodified by the port; not satisfiable on an AMD-only host).
  • Jargon scan over master..moat-fix-327 (commits and added lines): clean. Fork tree clean.

Upstream reply

Pushed one small fix to the Windows staging logic in device.py. ROCm Python wheels can be packaged per GPU architecture, and those installs name the bundled libraries directory with an architecture suffix; the previous exact-name lookup then missed it, so the generated binary failed to load rocrand.dll (a transitive import of hiprand.dll). The directory is now matched by prefix and rocrand.dll is copied alongside the other runtime DLLs. The change is confined to the existing Windows-only branch of the code, so Linux behavior is unchanged.

Re-ran the tests at the new commit on Windows (Radeon 8060S) and Linux (MI250X): simulations generate, compile, and run correctly on both, including the synaptic-delay spike-queue path.

No hurry on our end -- this just keeps the branch correct for anyone trying it on a per-architecture ROCm install while you sort out the review policy.

For our own record (not posted upstream)

The reply above is the only upstream-visible text; approving this PR covers the commit and that reply. upstream.py --merge-fix --apply then fast-forwards brian-team#327's branch to 90d6d7cf and posts the reply.

The Windows runtime staging looked for the ROCm libraries package under the
exact name _rocm_sdk_libraries. A ROCm wheel built for a single GPU
architecture installs it as _rocm_sdk_libraries_<arch> instead, so the lookup
found nothing, rocrand.dll was never copied next to the generated executable,
and the run died before its first line of output: hiprand.dll imports
rocrand.dll, and Windows resolves neither from PATH once the exe directory is
searched first.

Match the directory by prefix, and copy rocrand.dll unconditionally. It ships
in the devel package too, so its presence never depended on locating the
separate libraries package; the copy loop already skips names it cannot find.

Assistance from an AI coding agent was used to prepare this change.

Test Plan:

Radeon 8060S (gfx1151), Windows 11, ROCm 7.14, which installs the libraries
package as _rocm_sdk_libraries_gfx1151. Three standalone simulations covering
plain integration, delayed synaptic propagation (the spikequeue.h spinlock)
and a ~12000-synapse network:

```
set HIP_VISIBLE_DEVICES=0
set USE_HIP=1
python test_basic.py
```

Before: RuntimeError: Project run failed, the generated binary exiting 127.
After: 3/3 pass; the state-update result matches the analytic solution to
6.7e-16.
jeffdaily added a commit to AMD-Ecosystem/moat that referenced this pull request Aug 17, 2026
@jeffdaily

Copy link
Copy Markdown
Collaborator Author

/moat approve

@jeffdaily
jeffdaily merged commit 90d6d7c into moat-port Aug 17, 2026
@jeffdaily
jeffdaily deleted the moat-fix-327 branch August 17, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant