@@ -37,10 +37,26 @@ https://github.com/intel/llvm/issues
3737
3838== Dependencies
3939
40+ :khr-default-context: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:khr-default-context
41+
4042This extension is written against the SYCL 2020 revision 10 specification. All
4143references below to the "core SYCL specification" or to section numbers in the
4244SYCL specification refer to that revision.
4345
46+ [_Note:_ The APIs in this extension uses the concept of a per-platform
47+ default context as specified in section 4.6.2 "Platform class" of the core SYCL
48+ specification.
49+ As a convenience, this extension specification describes the behavior of its
50+ APIs by using the `khr_get_default_context` function from {khr-default-context}[
51+ sycl_khr_default_context], however there is no true dependency on that
52+ extension.
53+ An implementation could still implement
54+ sycl_ext_oneapi_inter_process_communication even without implementing
55+ sycl_khr_default_context because the core SYCL specification still requires
56+ there to be a per-platform default context even if the core SYCL specification
57+ does not provide a convenient way to get it.
58+ _{endnote}_]
59+
4460
4561== Status
4662
@@ -56,7 +72,7 @@ specification.*
5672
5773This extension adds the ability for SYCL programs to share device USM memory
5874allocations between processes. This is done by the allocating process creating
59- a new IPC memory handle through the new free frunctions and transferring the
75+ a new IPC memory handle through the new free functions and transferring the
6076returned handle data to the other processes. The other processes can use the
6177handle data to retrieve the corresponding device USM memory.
6278
@@ -112,13 +128,23 @@ using handle_data_t = std::vector<std::byte>;
112128
113129handle_data_t get(void *ptr, const sycl::context &ctx);
114130
131+ handle_data_t get(void *ptr);
132+
133+ void put(handle_data_t &handle_data, const sycl::context &ctx);
134+
115135void put(handle_data_t &handle_data, const sycl::context &ctx);
116136
117137static void *open(handle_data_t handle_data, const sycl::context &ctx,
118138 const sycl::device &dev);
119139
140+ static void *open(handle_data_t handle_data, const sycl::device &dev);
141+
142+ static void *open(handle_data_t handle_data);
143+
120144static void close(void *ptr, const sycl::context &ctx);
121145
146+ static void close(void *ptr);
147+
122148}
123149```
124150
@@ -145,6 +171,23 @@ call to the `open` function.
145171_Throws:_ An exception with the `errc::feature_not_supported` error code if
146172device _D_ does not have `aspect::ext_oneapi_ipc_memory`.
147173
174+ !====
175+ a!
176+ [source]
177+ ----
178+ handle_data_t get(void *ptr)
179+ ----
180+ !====
181+
182+ _Effects_: Equivalent to:
183+
184+ [source,c++,indent=2]
185+ ----
186+ sycl::device d;
187+ sycl::contxt ctxt = d.get_platform().khr_get_default_context();
188+ return ipc_memory::get(ptr, ctxt);
189+ ----
190+
148191!====
149192a!
150193[source]
@@ -161,6 +204,23 @@ _Effects:_ Deallocates resources associated with the handle. These resources are
161204automatically deallocated when the USM device memory is freed, so it is not
162205strictly necessary to call the `put` function.
163206
207+ !====
208+ a!
209+ [source]
210+ ----
211+ void put(handle_data_t &handle_data)
212+ ----
213+ !====
214+
215+ _Effects_: Equivalent to:
216+
217+ [source,c++,indent=2]
218+ ----
219+ sycl::device d;
220+ sycl::contxt ctxt = d.get_platform().khr_get_default_context();
221+ return ipc_memory::put(handle_data, ctxt);
222+ ----
223+
164224!====
165225a!
166226[source]
@@ -187,6 +247,40 @@ _Throws:_
187247 * An exception with the `errc::invalid` error code if the handle data
188248 `handle_data` has an unexpected number of bytes.
189249
250+ !====
251+ a!
252+ [source]
253+ ----
254+ static void *open(handle_data_t &handle_data, const sycl::device &dev)
255+ ----
256+ !====
257+
258+ _Effects_: Equivalent to:
259+
260+ [source,c++,indent=2]
261+ ----
262+ sycl::contxt ctxt = dev.get_platform().khr_get_default_context();
263+ return ipc_memory::put(handle_data, ctxt, dev);
264+ ----
265+
266+ !====
267+ a!
268+ [source]
269+ ----
270+ static void *open(handle_data_t &handle_data, const sycl::context &ctx,
271+ const sycl::device &dev)
272+ ----
273+ !====
274+
275+ _Effects_: Equivalent to:
276+
277+ [source,c++,indent=2]
278+ ----
279+ sycl::device d;
280+ sycl::contxt ctxt = d.get_platform().khr_get_default_context();
281+ return ipc_memory::open(handle_data, ctxt, d);
282+ ----
283+
190284!====
191285a!
192286[source]
@@ -198,6 +292,23 @@ static void close(void *ptr, const sycl::context &ctx)
198292_Effects:_ Closes a device USM pointer previously returned by a call to
199293the `open` function.
200294
295+ !====
296+ a!
297+ [source]
298+ ----
299+ static void close(void *ptr)
300+ ----
301+ !====
302+
303+ _Effects_: Equivalent to:
304+
305+ [source,c++,indent=2]
306+ ----
307+ sycl::device d;
308+ sycl::contxt ctxt = d.get_platform().khr_get_default_context();
309+ return ipc_memory::close(ptr, ctxt);
310+ ----
311+
201312|====
202313
203314
0 commit comments