Skip to content

[UR][HIP] Implement async device allocation#22672

Open
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:hip-async-alloc
Open

[UR][HIP] Implement async device allocation#22672
zjin-lcf wants to merge 1 commit into
intel:syclfrom
zjin-lcf:hip-async-alloc

Conversation

@zjin-lcf

Copy link
Copy Markdown
Contributor

Summary

  • Port the CUDA adapter's stream-ordered (async) allocation support to HIP: implement urEnqueueUSMDeviceAllocExp and urEnqueueUSMFreeExp using the HIP stream-ordered memory allocator (hipMallocAsync/hipFreeAsync) on the device's default memory pool, mirroring the CUDA implementation but using ScopedDevice. Host and shared async allocations remain unsupported, matching CUDA.
  • Register the four async-alloc entry points in the adapter's urGetEnqueueExpProcAddrTable. They were previously stubbed but never wired into the DDI table, so the loader returned UR_RESULT_ERROR_UNINITIALIZED.
  • UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_SUPPORT_EXP now queries hipDeviceAttributeMemoryPoolsSupported, so the device advertises the ext_oneapi_async_memory_alloc aspect when supported.

Test plan

  • The default-pool async allocation e2e tests (AsyncAlloc/device/async_alloc, ooo_queue_async_alloc) pass on an AMD Instinct MI300A (gfx942).
  • Tests that construct a sycl::ext::oneapi::experimental::memory_pool still require the USM memory pool experimental API (urUSMPool*Exp), which remains unimplemented on HIP and is out of scope for this PR.

Port the CUDA adapter's stream-ordered (async) allocation support to HIP.
urEnqueueUSMDeviceAllocExp and urEnqueueUSMFreeExp are implemented using
the HIP stream-ordered memory allocator (hipMallocAsync/hipFreeAsync) on
the device's default memory pool, mirroring the CUDA implementation but
using ScopedDevice instead of ScopedContext. Host and shared async
allocations remain unsupported, matching CUDA.

Register the four async-alloc entry points in the adapter's
urGetEnqueueExpProcAddrTable; they were previously stubbed but never wired
into the DDI table, so the loader returned UR_RESULT_ERROR_UNINITIALIZED.

UR_DEVICE_INFO_ASYNC_USM_ALLOCATIONS_SUPPORT_EXP now queries
hipDeviceAttributeMemoryPoolsSupported so the device advertises the
ext_oneapi_async_memory_alloc aspect when supported.

The default-pool async allocation e2e tests (async_alloc,
ooo_queue_async_alloc) pass on an AMD Instinct MI300A (gfx942). Tests that
construct a sycl memory_pool still require the USM memory pool experimental
API (urUSMPool*Exp), which remains unimplemented on HIP.

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