[CLR] Fix hipMemUnmap segfault on multi-GPU: guard null device memory… - #8402
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 |
There was a problem hiding this comment.
Pull request overview
Fixes a multi-GPU Windows crash in the PAL backend where hipMemUnmap can probe a VA on a device that doesn’t physically back the allocation, leading to a null dereference inside pal::Device::GetMemAccess.
Changes:
- Switch
GetMemAccessto query device backing without allocating (getDeviceMemory(*this, false)). - Add a nullptr guard to avoid dereferencing a missing per-device memory backing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AidanBeltonS
left a comment
There was a problem hiding this comment.
Generally looks fine, one change needed
2faf711 to
d10491b
Compare
66bebc9 to
b7bb881
Compare
=?UTF-8?q?ti-GPU:=20guard=20null=20device=20memory=E2=80=A6=20(#8402)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
… in PAL GetMemAccess.
## Motivation
hipMemUnmap segfaults on Windows with 2 GPUs while passing with 1 GPU.
Crash occurs inside pal::Device::GetMemAccess during the multi-device
access-probe loop added for synchronous unmap.
## Technical Details
hipMemUnmap segfaults on Windows with 2 GPUs while passing with 1 GPU.
Crash occurs inside pal::Device::GetMemAccess during the multi-device
access-probe loop added for synchronous unmap.
## JIRA ID
ROCM-27508
## Test Plan
Seg faulting failures from reported tests.
830 - Unit_hipMemVmm_Uncached (SEGFAULT)
1141 - Unit_hipPointerGetAttribute_ipc_capable (SEGFAULT)
2484 - Unit_hipMemRetainAllocationHandle_SetGet (SEGFAULT)
2485 - Unit_hipMemRetainAllocationHandle_NegTst (SEGFAULT)
2486 - Unit_hipMemRetainAllocationHandle_Capture (SEGFAULT)
2487 - Unit_hipGetProcAddress_VMM (SEGFAULT)
2492 - Unit_hipMemCreate_ChkDev2HstMemcpy_ReleaseHdlPostUnmap (SEGFAULT)
2493 - Unit_hipMemCreate_ChkDev2HstMemcpy_ReleaseHdlPreUse (SEGFAULT)
2494 - Unit_hipMemCreate_ChkWithMemset (SEGFAULT)
2497 - Unit_hipMemSetAccess_SegmentsAccess (SEGFAULT)
2498 - Unit_hipMemSetAccess_Vmm2PeerPeerMemCpy (SEGFAULT)
2499 - Unit_hipMemSetGetAccess_Capture (SEGFAULT)
2503 - Unit_hipMemMap_VMMMemoryReuse_SingleGPU (SEGFAULT)
2504 - Unit_hipMemMap_MapPartialVMMMem (SEGFAULT)
2505 - Unit_hipMemMap_Capture (SEGFAULT)
2507 - Unit_hipMemMap_Retrieve_AllocationHandle (SEGFAULT)
2508 - Unit_hipMemMap_Retrieve_MultiAllocationHandle (SEGFAULT)
2509 - Unit_hipMemMap_CheckAddMemObj (SEGFAULT)
2510 - Unit_hipMemMap_RoundTrip (SEGFAULT)
2511 - Unit_hipMemMap_ConcurrentDisjointMapsNoDeadlock (SEGFAULT)
2514 - Unit_hipMemUnmap_negative (SEGFAULT)
2515 - Unit_hipMemUnmap_Capture (SEGFAULT)
2516 - Unit_hipMemUnmap_CrossLinksTornDown (SEGFAULT)
2517 - Unit_hipMemUnmap_RemapCrossLinks (SEGFAULT)
2518 - Unit_hipMemUnmap_DirectPath_BasicRoundTrip (SEGFAULT)
2519 - Unit_hipMemUnmap_DirectPath_InFlightKernelDrained (SEGFAULT)
## Test Result
Seg faulting failures from reported tests pass.
## Submission Checklist
- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
[rocm-systems] ROCm/rocm-systems#8402 (commit ca63267)
#8402) … in PAL GetMemAccess. ## Motivation hipMemUnmap segfaults on Windows with 2 GPUs while passing with 1 GPU. Crash occurs inside pal::Device::GetMemAccess during the multi-device access-probe loop added for synchronous unmap. ## Technical Details hipMemUnmap segfaults on Windows with 2 GPUs while passing with 1 GPU. Crash occurs inside pal::Device::GetMemAccess during the multi-device access-probe loop added for synchronous unmap. ## JIRA ID ROCM-27508 ## Test Plan Seg faulting failures from reported tests. 830 - Unit_hipMemVmm_Uncached (SEGFAULT) 1141 - Unit_hipPointerGetAttribute_ipc_capable (SEGFAULT) 2484 - Unit_hipMemRetainAllocationHandle_SetGet (SEGFAULT) 2485 - Unit_hipMemRetainAllocationHandle_NegTst (SEGFAULT) 2486 - Unit_hipMemRetainAllocationHandle_Capture (SEGFAULT) 2487 - Unit_hipGetProcAddress_VMM (SEGFAULT) 2492 - Unit_hipMemCreate_ChkDev2HstMemcpy_ReleaseHdlPostUnmap (SEGFAULT) 2493 - Unit_hipMemCreate_ChkDev2HstMemcpy_ReleaseHdlPreUse (SEGFAULT) 2494 - Unit_hipMemCreate_ChkWithMemset (SEGFAULT) 2497 - Unit_hipMemSetAccess_SegmentsAccess (SEGFAULT) 2498 - Unit_hipMemSetAccess_Vmm2PeerPeerMemCpy (SEGFAULT) 2499 - Unit_hipMemSetGetAccess_Capture (SEGFAULT) 2503 - Unit_hipMemMap_VMMMemoryReuse_SingleGPU (SEGFAULT) 2504 - Unit_hipMemMap_MapPartialVMMMem (SEGFAULT) 2505 - Unit_hipMemMap_Capture (SEGFAULT) 2507 - Unit_hipMemMap_Retrieve_AllocationHandle (SEGFAULT) 2508 - Unit_hipMemMap_Retrieve_MultiAllocationHandle (SEGFAULT) 2509 - Unit_hipMemMap_CheckAddMemObj (SEGFAULT) 2510 - Unit_hipMemMap_RoundTrip (SEGFAULT) 2511 - Unit_hipMemMap_ConcurrentDisjointMapsNoDeadlock (SEGFAULT) 2514 - Unit_hipMemUnmap_negative (SEGFAULT) 2515 - Unit_hipMemUnmap_Capture (SEGFAULT) 2516 - Unit_hipMemUnmap_CrossLinksTornDown (SEGFAULT) 2517 - Unit_hipMemUnmap_RemapCrossLinks (SEGFAULT) 2518 - Unit_hipMemUnmap_DirectPath_BasicRoundTrip (SEGFAULT) 2519 - Unit_hipMemUnmap_DirectPath_InFlightKernelDrained (SEGFAULT) ## Test Result Seg faulting failures from reported tests pass. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. --------- Co-authored-by: Jaydeep Patel <jaypatel@amd.com>
… in PAL GetMemAccess.
Motivation
hipMemUnmap segfaults on Windows with 2 GPUs while passing with 1 GPU. Crash occurs inside pal::Device::GetMemAccess during the multi-device access-probe loop added for synchronous unmap.
Technical Details
hipMemUnmap segfaults on Windows with 2 GPUs while passing with 1 GPU. Crash occurs inside pal::Device::GetMemAccess during the multi-device access-probe loop added for synchronous unmap.
JIRA ID
ROCM-27508
Test Plan
Seg faulting failures from reported tests.
830 - Unit_hipMemVmm_Uncached (SEGFAULT)
1141 - Unit_hipPointerGetAttribute_ipc_capable (SEGFAULT)
2484 - Unit_hipMemRetainAllocationHandle_SetGet (SEGFAULT)
2485 - Unit_hipMemRetainAllocationHandle_NegTst (SEGFAULT)
2486 - Unit_hipMemRetainAllocationHandle_Capture (SEGFAULT)
2487 - Unit_hipGetProcAddress_VMM (SEGFAULT)
2492 - Unit_hipMemCreate_ChkDev2HstMemcpy_ReleaseHdlPostUnmap (SEGFAULT)
2493 - Unit_hipMemCreate_ChkDev2HstMemcpy_ReleaseHdlPreUse (SEGFAULT)
2494 - Unit_hipMemCreate_ChkWithMemset (SEGFAULT)
2497 - Unit_hipMemSetAccess_SegmentsAccess (SEGFAULT)
2498 - Unit_hipMemSetAccess_Vmm2PeerPeerMemCpy (SEGFAULT)
2499 - Unit_hipMemSetGetAccess_Capture (SEGFAULT)
2503 - Unit_hipMemMap_VMMMemoryReuse_SingleGPU (SEGFAULT)
2504 - Unit_hipMemMap_MapPartialVMMMem (SEGFAULT)
2505 - Unit_hipMemMap_Capture (SEGFAULT)
2507 - Unit_hipMemMap_Retrieve_AllocationHandle (SEGFAULT)
2508 - Unit_hipMemMap_Retrieve_MultiAllocationHandle (SEGFAULT)
2509 - Unit_hipMemMap_CheckAddMemObj (SEGFAULT)
2510 - Unit_hipMemMap_RoundTrip (SEGFAULT)
2511 - Unit_hipMemMap_ConcurrentDisjointMapsNoDeadlock (SEGFAULT)
2514 - Unit_hipMemUnmap_negative (SEGFAULT)
2515 - Unit_hipMemUnmap_Capture (SEGFAULT)
2516 - Unit_hipMemUnmap_CrossLinksTornDown (SEGFAULT)
2517 - Unit_hipMemUnmap_RemapCrossLinks (SEGFAULT)
2518 - Unit_hipMemUnmap_DirectPath_BasicRoundTrip (SEGFAULT)
2519 - Unit_hipMemUnmap_DirectPath_InFlightKernelDrained (SEGFAULT)
Test Result
Seg faulting failures from reported tests pass.
Submission Checklist