[clr] Reject VMM allocations in hipIpcGetMemHandle#4263
Open
darren-amd wants to merge 1 commit intodevelopfrom
Open
[clr] Reject VMM allocations in hipIpcGetMemHandle#4263darren-amd wants to merge 1 commit intodevelopfrom
darren-amd wants to merge 1 commit intodevelopfrom
Conversation
VMM allocations must use hipMemExportToShareableHandle for IPC, not hipIpcGetMemHandle. Add a check in Device::IpcCreate to reject memory objects with the CL_MEM_VA_RANGE_AMD flag. Co-authored-by: zyzshishui <104647851+zyzshishui@users.noreply.github.com> Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a guard in ROCclr’s IPC handle creation path to reject VMM (virtual address range) allocations, aligning with HIP’s requirement to use hipMemExportToShareableHandle instead of hipIpcGetMemHandle for VMM.
Changes:
- Detect VMM allocations in
Device::IpcCreateviaCL_MEM_VA_RANGE_AMD. - Log and fail early when IPC is attempted on a VMM allocation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1055
to
+1057
| ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_MEM, | ||
| "IPC is not supported for VMM allocations (dev_ptr: 0x%x)", dev_ptr); | ||
| return false; |
There was a problem hiding this comment.
The ClPrint format string uses 0x%x for dev_ptr (a void*). Since ClPrint ultimately calls vsnprintf, this is undefined behavior and can truncate addresses on 64-bit. Use %p (and pass dev_ptr) or cast to uintptr_t and print with an integer format instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cloned from: #3882. CI could not run as PR was from a forked repo.
VMM allocations must use hipMemExportToShareableHandle for IPC, not hipIpcGetMemHandle. Add a check in Device::IpcCreate.