[UR][HIP] Implement virtual and physical memory management#22671
Open
zjin-lcf wants to merge 1 commit into
Open
[UR][HIP] Implement virtual and physical memory management#22671zjin-lcf wants to merge 1 commit into
zjin-lcf wants to merge 1 commit into
Conversation
Port the CUDA adapter's virtual memory management support to HIP. This implements the previously stubbed urVirtualMem* and urPhysicalMem* entry points using the HIP VMM API (hipMemAddressReserve/Free, hipMemCreate/ Release, hipMemMap/Unmap, hipMemSetAccess, hipMemGetAccess and hipMemGetAllocationGranularity), mirroring the CUDA implementation but using ScopedDevice instead of ScopedContext. UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT now queries hipDeviceAttributeVirtualMemoryManagementSupported instead of hard-coding false, so the device advertises the ext_oneapi_virtual_mem aspect when the hardware supports it. Extend the vector_with_virtual_mem e2e test's kernel-copy workaround to cover HIP: the ROCm runtime returns hipErrorInvalidValue when a single copy spans two separately-reserved (though contiguous) address ranges, the same limitation the test already special-cases for Level Zero. All 7 sycl/test-e2e/VirtualMem tests pass on an AMD Instinct MI300A (gfx942). Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
urVirtualMem*(granularity, reserve, free, set/get access, map, unmap) andurPhysicalMem*(create, retain, release, get info) entry points via the HIP VMM API (hipMemAddressReserve/Free,hipMemCreate/Release,hipMemMap/Unmap,hipMemSetAccess,hipMemGetAccess,hipMemGetAllocationGranularity).UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORTnow querieshipDeviceAttributeVirtualMemoryManagementSupportedinstead of hard-codingfalse, so the device advertises theext_oneapi_virtual_memaspect when supported.vector_with_virtual_meme2e test's kernel-copy workaround to cover HIP: ROCm returnshipErrorInvalidValuewhen a single copy spans two separately-reserved (though contiguous) ranges — the same limitation already special-cased for Level Zero.Test plan
sycl/test-e2e/VirtualMemtests pass on an AMD Instinct MI300A (gfx942).