Skip to content

Commit

Permalink
Merge pull request #1739 from hdelan/add-buffer-docs
Browse files Browse the repository at this point in the history
[UR] Add some information about buffers in spec
  • Loading branch information
kbenzie committed Jun 11, 2024
2 parents dfd8ec9 + 43a2b28 commit 071bf54
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/core/PROG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,39 @@ native handle to a driver handle. For example, OpenCL platform
may expose an extension ${x}ProgramCreateWithNativeHandle to retrieve
a cl_program.

Memory
======

UR Mem Handles
--------------

A ${x}_mem_handle_t can represent an untyped memory buffer object, created by
${x}MemBufferCreate, or a memory image object, created by ${x}MemImageCreate.
A ${x}_mem_handle_t manages the internal allocation and deallocation of native
memory objects across all devices in a ${x}_context_handle_t. A
${x}_mem_handle_t may only be used by queues that share the same
${x}_context_handle_t.

If multiple queues in the same ${x}_context_handle_t use the same
${x}_mem_handle_t across dependent commands, a dependency must be defined by the
user using the enqueue entry point's phEventWaitList parameter. Provided that
dependencies are explicitly passed to UR entry points, a UR adapter will manage
memory migration of native memory objects across all devices in a context, if
memory migration is indeed necessary in the backend API.

.. parsed-literal::
// Q1 and Q2 are both in hContext
${x}_mem_handle_t hBuffer;
${x}MemBufferCreate(hContext,,,,&hBuffer);
${x}EnqueueMemBufferWrite(Q1, hBuffer,,,,,,, &outEv);
${x}EnqueueMemBufferRead(Q2, hBuffer,,,,, 1, &outEv /*phEventWaitList*/, );
As such, the buffer written to in ${x}EnqueueMemBufferWrite can be
successfully read using ${x}EnqueueMemBufferRead from another queue in the same
context, since the event associated with the write operation has been passed as
a dependency to the read operation.

Memory Pooling
----------------------------------

Expand Down

0 comments on commit 071bf54

Please sign in to comment.