(bugfix) mori bug on RoCM714#414
Conversation
jhchouuu
left a comment
There was a problem hiding this comment.
Overall: Right direction, should land — but please don't remove the P2P topology capability in this PR.
✅ CMake numa::numa fix — LGTM. Defining the imported target from system libnuma to work around ROCm 7.14's missing target is correct.
✅ rsmi → HIP for bus id — correct. This avoids rocm-smi's cross-process mutex contention under /dev/shm/rocm_smi_* (concurrent rsmi_init() races return RSMI_STATUS_INIT_ERROR, and ROCM_SMI_CHECK's exit(-1) kills every rank). HIP's query APIs are read-only and multi-process safe.
- (Preferred) keep it, swap the source — rebuild via
hipDeviceCanAccessPeer+hipDeviceGetP2PAttribute; or - (Minimum) keep the
TopoNodeGpuP2pLinkstruct andp2psfields with a TODO, drop only the rsmi collection.
Removing the capability is a rack-roadmap decision and shouldn't ride along in a bugfix.
jhchouuu
left a comment
There was a problem hiding this comment.
LGTM need minor modification
Fix MORI build + multi-process topology crash on ROCm 7.14
Summary
Two fixes that let MORI build and run on ROCm 7.14 (no regression on 7.2).
1. CMake: missing
numa::numatargetROCm 7.14's
hsakmt-config.cmakedeclares thathsakmt::hsakmtlinksnuma::numa, but ships nofind_package/finder to define it, so configuration aborts:Fix: define a
numa::numaIMPORTED target from the systemlibnumabeforefind_package(hsakmt).2. Runtime:
rsmi_init()crash under multi-process (rsmi symbol split-brain)On the ROCm 7.14 docker, the
rsmi_*symbols resolve to two different shared objects in the same process: some calls (e.g.rsmi_init,rsmi_is_P2P_accessible) bind tolibamd_smi.so(amdsmi), while the rest (rsmi_num_monitor_devices,rsmi_dev_pci_id_get, …) bind tolibrocm_smi64. amdsmi sits in the global symbol scope and interposes the subset of the rsmi ABI it re-exports.The two libraries keep separate global singletons, so
rsmi_init()initializes one whilersmi_num_monitor_devices()queries the other (uninitialized) →RSMI_STATUS_INIT_ERROR, and the check'sexit(-1)kills every rank. This does not happen on ROCm 7.2, where all symbols resolve to a single library.Fix: pin the library ourselves.
TopoSystemGpu::Load()nowdlopenslibrocm_smi64withRTLD_NOW | RTLD_LOCALand resolves everyrsmi_*symbol from that one handle, so all calls hit the same instance and amdsmi can no longer interpose. The link-time dependency onlibrocm_smi64is removed from CMake, which also means the library is loaded lazily, after torch has initialized HIP — itsNEEDED libamdhip64then resolves to the already-loaded copy by SONAME instead of pulling in a second HIP runtime.An optional
MORI_ROCM_SMI_PATHenv var overrides the library path.Test plan
pip install . --no-build-isolationbuilds on ROCm 7.14.test_dispatch_combine_internode.py --cmd stresscompletes 5000/5000 dispatch + combine with noRSMI_STATUS_INIT_ERROR(noLD_PRELOADneeded).