Skip to content

[UR][HIP] Implement virtual and physical memory management#22671

Open
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:hip-virtual-memory
Open

[UR][HIP] Implement virtual and physical memory management#22671
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:hip-virtual-memory

Conversation

@zjin-lcf

Copy link
Copy Markdown
Contributor

Summary

  • Port the CUDA adapter's virtual memory management to the HIP adapter, implementing the previously stubbed urVirtualMem* (granularity, reserve, free, set/get access, map, unmap) and urPhysicalMem* (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_SUPPORT now queries hipDeviceAttributeVirtualMemoryManagementSupported instead of hard-coding false, so the device advertises the ext_oneapi_virtual_mem aspect when supported.
  • Extend the vector_with_virtual_mem e2e test's kernel-copy workaround to cover HIP: ROCm returns hipErrorInvalidValue when a single copy spans two separately-reserved (though contiguous) ranges — the same limitation already special-cased for Level Zero.

Test plan

  • All 7 sycl/test-e2e/VirtualMem tests pass on an AMD Instinct MI300A (gfx942).

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant