Repository navigation
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
cfreeamd
left a comment
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd)
Reviewed all three fixes. The openclose.cpp unwind (guarding close() on dxg_fd >= 0 and resetting it to -1) and the topology.cpp NumCUPerArray correction (dividing by NumShaderBanks * NumArrays = total arrays, not arrays-per-engine) both look correct — the CU-per-array fix addresses a real over-count. Two clarifying questions inline on the .pc prefix depth and the synthesized KFDGpuID.
The comment now states what the synthesized value is and is not: a nonzero snapshot-local key, never a kernel gpu_id. It also names amd_core_dump.cpp as the one consumer where the value becomes externally visible, so a future reader does not have to re-derive that. In response to review; comment text only, no functional change.
cfreeamd
left a comment
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd) — follow-up after the KFDGpuID docs commit (0596909)
The new contract comment at the KFDGpuID = node_id + 1 assignment resolves my earlier question: it documents that this is a nonzero snapshot-local key (not the PCI device ID, not a kernel gpu_id), that DXG consumers only need uniqueness + nonzeroness, and — helpfully — that it surfaces externally via amd_core_dump.cpp as the core dump's gpu_id, so a debugger correlating that field against kernel state won't match on WSL. Good disposition. The only remaining item is the non-blocking .pc prefix-depth question (single-segment vs multiarch CMAKE_INSTALL_LIBDIR); the three fixes look correct.
ed77209 to
51633ab
Compare
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
|
This pull request has been automatically closed due to inactivity (30 days with no updates). If you'd like to continue working on this, feel free to reopen the PR or create a new one. |
Motivation
These are four independent DXG issues discovered while validating the WSL
topology path. None of them is required for topology access, so they have been
split out of
#10034 to keep that PR
focused on the multi-consumer topology prerequisite and make both changes
easier to review.
Two of the issues produce incorrect results rather than representing only
latent risks:
NumCUPerArrayis over-reported on devices with more than oneshader engine, and
KFDGpuIDcollides across identical GPUs, causing reverselookups for both devices to resolve to the first node.
Technical Details
NumCUPerArrayused the wrong shader-array countsrc/dxg/topology.cppNumArraysisShaderArrayPerShaderEngine(), so the total number of shaderarrays across the GPU is:
NumShaderBanks * NumArraysThe previous calculation divided
ComputeUnitCount()byNumArraysalone,which over-reported
NumCUPerArrayby the shader-engine count. It produced thecorrect result only when
NumShaderBanks == 1, which is why single-shader-enginedevices were unaffected.
The divisor now uses the total number of shader arrays. The zero-divisor guard
has been updated accordingly, and a warning is emitted if the CU count is not
evenly divisible by the array count because the integer division would
otherwise truncate the result.
KFDGpuIDwas not unique across identical GPUssrc/dxg/topology.cppKFDGpuIDwas populated with the PCI device ID. The field is used both as thepredicate indicating that a node is a GPU and as the key inverted by
gpuid_to_nodeid()andget_device_id_by_gpu_id().A PCI device ID is neither unique across identical GPUs nor guaranteed to be
nonzero. As a result, identical GPUs could receive the same
KFDGpuID, causingboth reverse lookups to resolve to the first matching node.
KFDGpuIDis now assigned asnode_id + 1, making it unique within thetopology snapshot and nonzero for every node.
Failed DXG open left a stale file descriptor
src/dxg/openclose.cppOn the
dxcore_loader_failedpath, the localfdwas closed whiledxg_runtime->dxg_fdstill retained the closed descriptor value.A subsequent
hsaKmtOpenKFD()could therefore observe a non-negativedxg_runtime->dxg_fd, skip reopening/dev/dxg, and return a stale filedescriptor.
The failure path now closes the stored descriptor and resets
dxg_runtime->dxg_fdto-1.librocdxg.pcresolved the install prefix one directory too highlibrocdxg.pc.inThe pkg-config file is installed under
${CMAKE_INSTALL_LIBDIR}/pkgconfig,which is two directory levels below the install prefix. Using
${pcfiledir}/../../..therefore resolved one level above the actual prefix andmade the derived
libdirandincludedirpaths incorrect.The prefix is now derived from
${pcfiledir}/../.., matching the existinglayout used by
libhsakmt.pc.in.Issue Tracking
JIRA ID: ROCM-23912
Test Plan
Test Result
Submission Checklist