Skip to content

Commit 443333f

Browse files
authored
Merge pull request #423 from vinser52/svinogra_ipc_doc
Add documentation for IPC API
2 parents 943f674 + 9f8145f commit 443333f

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

scripts/docs_config/api.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ allocations memory allocations.
1717
UMF includes predefined pool allocators. UMF can also work with user-defined
1818
pools which implement the memory pool API.
1919

20+
.. _allocation API:
21+
2022
Memory Pool
2123
------------------------------------------
2224

@@ -103,3 +105,17 @@ Memspace
103105
------------------------------------------
104106
.. doxygenfile:: memspace.h
105107
:sections: define enum typedef func var
108+
109+
Inter-Process Communication
110+
==========================================
111+
112+
IPC API allows retrieving IPC handles for the memory buffers allocated from
113+
UMF memory pools. The memory provider used by the pool should support IPC
114+
operations for this API to work. Otherwise IPC APIs return an error.
115+
116+
.. _ipc-api:
117+
118+
IPC API
119+
------------------------------------------
120+
.. doxygenfile:: ipc.h
121+
:sections: define enum typedef func var

scripts/docs_config/introduction.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Memory Pools
9191

9292
A memory pool consists of a pool allocator and a memory provider instancies
9393
along with their properties and allocation policies. Memory pools are used by
94-
the `allocation API`_ as a first argument. There is also a possibility to
94+
the :ref:`allocation API <allocation API>` as a first argument. There is also a possibility to
9595
retrieve a memory pool from an existing memory pointer that points to a memory
9696
previously allocated by UMF.
9797

@@ -134,6 +134,26 @@ An example of an environment variable for setting up logger with logging level s
134134

135135
UMF_LOGL="level:warning;output:stdout"
136136

137+
Inter-Process Communication
138+
===========================
139+
140+
The :ref:`IPC API <ipc-api>` allows sharing of memory objects, allocated from UMF memory pools, across different processes.
141+
Since each process has its own virtual address space, there is no guarantee that the same virtual address will be available when the memory object is shared in a new process.
142+
There is a set of UMF APIs that makes it easier to share the memory objects with ease.
143+
144+
The :ref:`IPC API <ipc-api>` is based on the concept of IPC handles. An IPC handle is an opaque data structure that is used as a unique identifier to share memory objects across different processes.
145+
Memory providers are responsible for creating actual IPC handles. As a result, IPC handles are created by the memory provider per coarse grain allocations.
146+
UMF implementation employs caching for IPC handles returned by the memory provider to avoid creating multiple handles for the same memory region.
147+
When a client requests an IPC handle for a memory allocated by UMF, UMF does the following:
148+
149+
#. finds the corresponding memory pool.
150+
151+
#. finds corresponding coarse grain allocation (multiple fine grain allocations might reside in a coarse grain memory region returned by the memory provider).
152+
153+
#. checks if the IPC handle for a coarse grain is already cached and returns the cached handle if it exists. Otherwise creates a new IPC handle for the coarse grain allocation.
154+
155+
Not every memory provider can and must support IPC operations. It is up to the memory provider implementation to decide if it supports IPC operations.
156+
If the corresponding memory provider does not support IPC operations, UMF will return an error when a client requests an IPC handle for a memory object allocated by this memory provider.
157+
137158
.. _UMF: https://github.com/oneapi-src/unified-memory-framework
138159
.. _README.md: https://github.com/oneapi-src/unified-memory-framework/blob/main/README.md
139-
.. _allocation API: https://oneapi-src.github.io/unified-memory-framework/api.html#memory-pool

0 commit comments

Comments
 (0)