Skip to content

Commit f4e452e

Browse files
committed
Address feedback
1 parent 708873b commit f4e452e

File tree

3 files changed

+50
-57
lines changed

3 files changed

+50
-57
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_memory_export.asciidoc

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ handles to import SYCL allocated memory into external APIs.
111111
exporting memory by the implementation. Currently, the {dpcpp} implementation
112112
only supports exporting memory with the `opaque_fd` and `win32_nt_handle` handle
113113
types. This enum is shared with the memory import functionality defined in the
114-
Bindless Images extension, where more handle types may be supported for
115-
importing memory into SYCL.
114+
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc[sycl_ext_oneapi_bindless_images]
115+
extension, where more handle types may be supported for importing memory into
116+
SYCL.
116117
_{endnote}_]
117118

118119
```c++
@@ -127,26 +128,26 @@ enum class external_mem_handle_type {
127128
win32_nt_dx11_resource = 4,
128129
};
129130

130-
template <export_mem_handle_type ExportMemHandleType>
131+
template <external_mem_handle_type ExternalMemHandleType>
131132
struct exported_mem;
132133

133134
template <>
134-
struct exported_mem<export_mem_handle_type::opaque_fd> {
135+
struct exported_mem<external_mem_handle_type::opaque_fd> {
135136
using type = int;
136137
};
137138

138139
template <>
139-
struct exported_mem<export_mem_handle_type::win32_nt_handle> {
140+
struct exported_mem<external_mem_handle_type::win32_nt_handle> {
140141
using type = void *;
141142
};
142143

143-
template <export_mem_handle_type ExportMemHandleType>
144-
using exported_mem_t = typename exported_mem<ExportMemHandleType>::type;
144+
template <external_mem_handle_type ExternalMemHandleType>
145+
using exported_mem_t = typename exported_mem<ExternalMemHandleType>::type;
145146

146147
}
147148
```
148149

149-
The `export_mem_handle_type` enum class defines the types of external memory
150+
The `external_mem_handle_type` enum class defines the types of external memory
150151
resource handles that can be exported by this extension. The `opaque_fd` and
151152
`win32_nt_handle` values are used during allocation of exportable memory to
152153
indicate the type of handle that will later be returned by the
@@ -159,11 +160,11 @@ The `win32_nt_handle` handle type corresponds to a Windows NT handle, which is
159160
represented by a `void *`.
160161

161162
The `exported_mem` template struct is specialized for each of the
162-
`export_mem_handle_type` values. Each specialization defines a `type` alias that
163-
represents the type of the exported memory handle for that specific handle.
163+
`external_mem_handle_type` values. Each specialization defines a `type` alias
164+
that represents the type of the exported memory handle for that specific handle.
164165

165166
The `exported_mem_t` type alias allows the user to easily obtain the type of
166-
the exported memory handle based on the `export_mem_handle_type` template
167+
the exported memory handle based on the `external_mem_handle_type` template
167168
parameter.
168169

169170
=== API of the extension
@@ -174,13 +175,13 @@ namespace sycl::ext::oneapi::experimental {
174175

175176
void *alloc_exportable_device_mem(
176177
size_t alignment, size_t size,
177-
export_mem_handle_type exportMemHandleType,
178+
external_mem_handle_type externalMemHandleType,
178179
const sycl::device &syclDevice, const sycl::context &syclContext,
179180
const property_list& propList = {});
180181

181182
void *alloc_exportable_device_mem(
182183
size_t alignment, size_t size,
183-
export_mem_handle_type exportMemHandleType,
184+
external_mem_handle_type externalMemHandleType,
184185
const sycl::queue &syclQueue,
185186
const property_list& propList = {});
186187
}
@@ -209,8 +210,8 @@ instance of `sycl::property_list`. Currently, this extension does not define
209210
any properties that can be used with this function, so the `propList` parameter
210211
is ignored and reserved for future use.
211212

212-
The passed `exportMemHandleType` must be supported by the operating system
213-
running the SYCL application. Passing an `exportMemHandleType` that is not
213+
The passed `externalMemHandleType` must be supported by the operating system
214+
running the SYCL application. Passing an `externalMemHandleType` that is not
214215
supported by the operating system running the SYCL application results in
215216
undefined behavior. The `win32_nt_handle` handle type is only supported on
216217
Windows operating systems, while the `opaque_fd` handle type is only supported
@@ -223,23 +224,21 @@ if the device `syclDevice` does not have
223224
This function will throw a `sycl::exception` with the `errc::runtime` code if
224225
any error occurs while allocating the memory.
225226

226-
[_Note:_ The {dpcpp} implementation of this function will throw a
227-
`sycl::exception` with the code `errc::invalid` if the
228-
`external_mem_handle_type` passed is not either `opaque_fd` or
229-
`win32_nt_handle`.
230-
_{endnote}_]
227+
This function will throw a `sycl::exception` with the code `errc::invalid` if
228+
the `externalMemHandleType` passed is not supported by the backend
229+
implementation.
231230

232231
```c++
233232

234233
namespace sycl::ext::oneapi::experimental {
235234

236-
template <export_mem_handle_type ExportMemHandleType>
237-
exported_mem_t<ExportMemHandleType>
235+
template <external_mem_handle_type ExternalMemHandleType>
236+
exported_mem_t<ExternalMemHandleType>
238237
export_device_mem_handle(void *deviceMemory, const sycl::device &syclDevice,
239238
const sycl::context &syclContext);
240239

241-
template <export_mem_handle_type ExportMemHandleType>
242-
exported_mem_t<ExportMemHandleType>
240+
template <external_mem_handle_type ExternalMemHandleType>
241+
exported_mem_t<ExternalMemHandleType>
243242
export_device_mem_handle(void *deviceMemory, const sycl::queue &syclQueue);
244243

245244
}
@@ -249,11 +248,11 @@ The `export_device_mem_handle` function accepts a `void *` representing a device
249248
allocation made using `alloc_exportable_device_mem`.
250249

251250
The return type is determined by the template parameter,
252-
`ExportMemHandleType`.
251+
`ExternalMemHandleType`.
253252

254-
The value of `ExportMemHandleType` must match the value passed to
253+
The value of `ExternalMemHandleType` must match the value passed to
255254
`alloc_exportable_device_mem` when the memory was allocated. Passing an
256-
`ExportMemHandleType` value that not match the value passed to
255+
`ExternalMemHandleType` value that not match the value passed to
257256
`alloc_exportable_device_mem` results in undefined behavior.
258257

259258
The `syclDevice` and `syclContext` passed to `export_device_mem_handle` must
@@ -265,12 +264,6 @@ allocated.
265264
This function will throw a `sycl::exception` with the `errc::runtime` code if
266265
any error occurs while exporting the memory handle.
267266

268-
[_Note:_ The {dpcpp} implementation of this function will throw a
269-
`sycl::exception` with the code `errc::invalid` if the
270-
`external_mem_handle_type` passed is not either `opaque_fd` or
271-
`win32_nt_handle`.
272-
_{endnote}_]
273-
274267
[_Note:_ The returned handle may be used to import the SYCL allocated memory
275268
into an external API, such as Vulkan or DirectX.
276269
_{endnote}_]

sycl/include/sycl/ext/oneapi/memory_export.hpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,52 +71,52 @@ inline void free_exportable_memory(void *deviceMemory,
7171
}
7272

7373
// Available only when
74-
// ExportMemHandleType == external_mem_handle_type::opaque_fd
75-
template <
76-
external_mem_handle_type ExportMemHandleType,
77-
std::enable_if_t<ExportMemHandleType == external_mem_handle_type::opaque_fd,
78-
bool> = true>
79-
inline exported_mem_t<ExportMemHandleType>
74+
// ExternalMemHandleType == external_mem_handle_type::opaque_fd
75+
template <external_mem_handle_type ExternalMemHandleType,
76+
std::enable_if_t<ExternalMemHandleType ==
77+
external_mem_handle_type::opaque_fd,
78+
bool> = true>
79+
inline exported_mem_t<ExternalMemHandleType>
8080
export_device_mem_handle(void *deviceMemory, const sycl::device &syclDevice,
8181
const sycl::context &syclContext) {
8282
return detail::export_device_mem_opaque_fd(deviceMemory, syclDevice,
8383
syclContext);
8484
}
8585

8686
// Available only when
87-
// ExportMemHandleType == external_mem_handle_type::opaque_fd
88-
template <
89-
external_mem_handle_type ExportMemHandleType,
90-
std::enable_if_t<ExportMemHandleType == external_mem_handle_type::opaque_fd,
91-
bool> = true>
92-
inline exported_mem_t<ExportMemHandleType>
87+
// ExternalMemHandleType == external_mem_handle_type::opaque_fd
88+
template <external_mem_handle_type ExternalMemHandleType,
89+
std::enable_if_t<ExternalMemHandleType ==
90+
external_mem_handle_type::opaque_fd,
91+
bool> = true>
92+
inline exported_mem_t<ExternalMemHandleType>
9393
export_device_mem_handle(void *deviceMemory, const sycl::queue &syclQueue) {
94-
return export_device_mem_handle<ExportMemHandleType>(
94+
return export_device_mem_handle<ExternalMemHandleType>(
9595
deviceMemory, syclQueue.get_device(), syclQueue.get_context());
9696
}
9797

9898
// Available only when
99-
// ExportMemHandleType == external_mem_handle_type::win32_nt_handle
100-
template <external_mem_handle_type ExportMemHandleType,
101-
std::enable_if_t<ExportMemHandleType ==
99+
// ExternalMemHandleType == external_mem_handle_type::win32_nt_handle
100+
template <external_mem_handle_type ExternalMemHandleType,
101+
std::enable_if_t<ExternalMemHandleType ==
102102
external_mem_handle_type::win32_nt_handle,
103103
bool> = true>
104-
inline exported_mem_t<ExportMemHandleType>
104+
inline exported_mem_t<ExternalMemHandleType>
105105
export_device_mem_handle(void *deviceMemory, const sycl::device &syclDevice,
106106
const sycl::context &syclContext) {
107107
return detail::export_device_mem_win32_nt(deviceMemory, syclDevice,
108108
syclContext);
109109
}
110110

111111
// Available only when
112-
// ExportMemHandleType == external_mem_handle_type::win32_nt_handle
113-
template <external_mem_handle_type ExportMemHandleType,
114-
std::enable_if_t<ExportMemHandleType ==
112+
// ExternalMemHandleType == external_mem_handle_type::win32_nt_handle
113+
template <external_mem_handle_type ExternalMemHandleType,
114+
std::enable_if_t<ExternalMemHandleType ==
115115
external_mem_handle_type::win32_nt_handle,
116116
bool> = true>
117-
inline exported_mem_t<ExportMemHandleType>
117+
inline exported_mem_t<ExternalMemHandleType>
118118
export_device_mem_handle(void *deviceMemory, const sycl::queue &syclQueue) {
119-
return export_device_mem_handle<ExportMemHandleType>(
119+
return export_device_mem_handle<ExternalMemHandleType>(
120120
deviceMemory, syclQueue.get_device(), syclQueue.get_context());
121121
}
122122

sycl/test-e2e/MemoryExport/export_memory_to_vulkan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// REQUIRES: target-spir
33
// REQUIRES: vulkan
44

5-
// RUN: %{build} %link-vulkan -o %t.out %if target-spir %{
6-
// -Wno-ignored-attributes %} RUN: %{run} %t.out
5+
// RUN: %{build} %link-vulkan -o %t.out %if target-spir %{ -Wno-ignored-attributes %}
6+
// RUN: %{run} %t.out
77

88
#include <iostream>
99
#include <numeric>

0 commit comments

Comments
 (0)