@@ -66,9 +66,9 @@ when the kernel is submitted to the queue.
6666
6767This extension adds the ability for SYCL programs to share device USM memory
6868allocations between processes. This is done by the allocating process creating
69- a new `ipc_memory` object and transferring  the "handle data" to the other 
70- processes. The other processes can use the handle data to recreate  the
71- `ipc_memory` object and get a pointer to  the corresponding device USM memory.
69+ a new IPC memory handle through  the new free frunctions and transferring the 
70+ returned handle data to the other  processes. The other processes can use the
71+ handle data to retrieve  the corresponding device USM memory.
7272
7373
7474== Specification
@@ -83,10 +83,6 @@ the implementation supports this feature, or applications can test the macro's
8383value to determine which of the extension's features the implementation
8484supports.
8585
86- _And follow the text with a table like this *unless the extension is
87- "experimental"*.  Note that your table may have more than one row if it
88- has multiple versions._
89- 
9086[%header,cols="1,5"]
9187|===
9288|Value
@@ -100,29 +96,22 @@ has multiple versions._
10096=== Inter-process communicable memory
10197
10298
103- This extension adds the new `ipc_memory` class. This new class adheres to the
104- common reference semantics described in
105- https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:reference-semantics[Section 4.5.2.]
106- in the SYCL 2020 specification.
99+ This extension adds new free functions under the `ipc_memory` experimental
100+ namespace.
107101
108102```
109- namespace sycl::ext::oneapi::experimental {
110- using ipc_memory_handle_data_t = span<char, sycl::dynamic_extent>;
103+ namespace sycl::ext::oneapi::experimental::ipc_memory {
111104
112- class ipc_memory {
113- public:
114-   ipc_memory(void *ptr, sycl::context &ctx);
105+ using handle_data_t = std::vector<char>;
115106
116-    void put( );
107+ handle_data_t get( void *ptr, const sycl::context &ctx );
117108
118-   static void *open(ipc_memory_handle_data_t ipc_memory_handle_data,
119-                     const sycl::context &ctx, const sycl::device &dev);
120-   static void close(void *ptr, const sycl::context &ctx);
109+ void put(handle_data_t &handle_data, const sycl::context &ctx);
121110
122-   ipc_memory_handle_data_t get_handle_data() const;
111+ static void *open(handle_data_t handle_data, const sycl::context &ctx,
112+                   const sycl::device &dev);
123113
124-   void *get_ptr() const;
125- };
114+ static void close(void *ptr, const sycl::context &ctx);
126115
127116}
128117```
134123a!
135124[source]
136125---- 
137- ipc_memory (void *ptr, const sycl::context &ctx)
126+ get (void *ptr, const sycl::context &ctx)
138127---- 
139128!====
140129
141- _Effects :_ Constructs an IPC memory  object in `ctx` from a pointer `ptr` to 
142- device USM memory.
143- If  `ptr` is  not pointing  to device USM memory, the behaviors of this constructor 
144- and any resulting objects are  undefined.
130+ _Returns :_ A `handle_data_t`  object containing the data of the IPC memory handle 
131+ in `ctx` from a pointer `ptr` to  device USM memory.
132+ Calling this function with a  `ptr` that does  not point  to device USM memory, the
133+ behaviors is  undefined.
145134
146135!====
147136a!
148137[source]
149138---- 
150- void put() 
139+ void put(handle_data_t &handle_data, const sycl::context &ctx ) 
151140---- 
152141!====
153142
154143_Effects:_ Instructs the underlying IPC memory resources to be returned to
155- the backend. This is not required to be called before  the `ipc_memory` object 
156- dies. Freeing the device USM memory used when constructing this instance of 
157- `ipc_memory` will return the underlying IPC memory resources .
144+ the backend. Freeing the device USM memory used when  the handle data was created 
145+ through a call to `get()` will have the same effect as calling this function, 
146+ so a direct call to this function is not strictly required .
158147Calling this function after `sycl::free()` has been called on the device USM
159- memory used when constructing this instance of `ipc_memory` will result in
160- undefined behavior.
161- 
162- _Throws:_ A `sycl::exception` with `errc::invalid` if `ipc_memory::put()` has
163- previously been called on this instance of `ipc_memory`.
148+ memory used when the handle data was created through a call to `get()` will
149+ result in undefined behavior.
164150
165151!====
166152a!
167153[source]
168154---- 
169- static void *open(ipc_memory_handle_data_t ipc_memory_handle_data , 
170-                   const sycl::context &ctx, const sycl:: device &dev) 
155+ static void *open(handle_data_t &handle_data, const sycl::context &ctx , 
156+                   const sycl::device &dev) 
171157---- 
172158!====
173159
174160_Effects:_ Returns a pointer to the same device USM memory as the device USM
175- memory associated with the `ipc_memory` object that the handle data originated
176- from.
177- The `ipc_memory` object that the handle data originated from is allowed to be
178- from another process on the host system.
179- If the `ipc_memory` object that the handle data originated from has been
180- destroyed, the behaviors of this constructor and any resulting objects are
181- undefined.
182- If the device USM memory the original `ipc_memory` object was created with was
183- not originally allocated on `dev`, the behaviors of this function is undefined.
161+ memory associated with `handle_data`.
162+ The handle data is allowed to be from another process on the host system.
163+ If the handle data has been destroyed, calling this function results in
164+ undefined behavior.
184165
185166!====
186167a!
@@ -191,35 +172,7 @@ static void close(void *ptr, const sycl::context &ctx)
191172!====
192173
193174_Effects:_ Closes a device USM pointer previously returned by a call to
194- `ipc_memory::open()`.
195- 
196- !====
197- a!
198- [source]
199- ---- 
200- ipc_memory_handle_data_t get_handle_data() const 
201- ---- 
202- !====
203- 
204- _Returns:_ The handle data of the `ipc_memory` object.
205- Utilizing the handle data returned by this API after the `ipc_memory` object has
206- been destroyed results in undefined behavior.
207- 
208- _Throws:_ A `sycl::exception` with `errc::invalid` if `ipc_memory::put()` has
209- previously been called on this instance of `ipc_memory`.
210- 
211- !====
212- a!
213- [source]
214- ---- 
215- void *get_ptr() const 
216- ---- 
217- !====
218- 
219- _Returns:_ A pointer to device USM memory corresponding to the pointer used to
220- construct the original `ipc_memory` object.
221- Accessing the pointer returned by this API after the `ipc_memory` object has
222- been destroyed results in undefined behavior.
175+ `open()`.
223176
224177|====
225178
0 commit comments