Skip to content

Commit 34eb136

Browse files
committed
Add property_list to alloc func. Fix alignment and size param order.
1 parent 817492f commit 34eb136

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_memory_export.asciidoc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,16 @@ the exported memory handle based on the `export_external_mem_handle_type`.
161161
namespace sycl::ext::oneapi::experimental {
162162

163163
void *alloc_exportable_device_mem(
164-
size_t size, size_t alignment,
164+
size_t alignment, size_t size,
165165
export_external_mem_handle_type exportMemHandleType,
166-
const sycl::device &syclDevice, const sycl::context &syclContext);
166+
const sycl::device &syclDevice, const sycl::context &syclContext,
167+
const property_list& propList = {});
167168

168169
void *alloc_exportable_device_mem(
169-
size_t size, size_t alignment,
170+
size_t alignment, size_t size,
170171
export_external_mem_handle_type exportMemHandleType,
171-
const sycl::queue &syclQueue);
172+
const sycl::queue &syclQueue,
173+
const property_list& propList = {});
172174
}
173175
```
174176

@@ -190,6 +192,11 @@ Memory allocated through this function has a linear memory layout on the device
190192
(which is the same as memory allocated by other USM allocation functions like
191193
`sycl::malloc_device`).
192194

195+
Zero or more properties can be passed in the `propList` parameter via an
196+
instance of `sycl::property_list`. Currently, this extension does not define
197+
any properties that can be used with this function, so the `propList` parameter
198+
is ignored and reserved for future use.
199+
193200
If an invalid `exportMemHandleType` is passed, the function will throw a
194201
`sycl::exception` with the `errc::invalid` code.
195202

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ export_device_mem_win32_nt(void *deviceMemory, const sycl::device &syclDevice,
5353
__SYCL_EXPORT void *alloc_exportable_device_mem(
5454
size_t alignment, size_t size,
5555
export_external_mem_handle_type externalMemHandleType,
56-
const sycl::device &syclDevice, const sycl::context &syclContext);
56+
const sycl::device &syclDevice, const sycl::context &syclContext,
57+
const sycl::property_list &propList = {});
5758

5859
inline void *alloc_exportable_device_mem(
5960
size_t alignment, size_t size,
6061
export_external_mem_handle_type externalMemHandleType,
61-
const sycl::queue &syclQueue) {
62-
return alloc_exportable_device_mem(size, alignment, externalMemHandleType,
62+
const sycl::queue &syclQueue, const sycl::property_list &propList = {}) {
63+
return alloc_exportable_device_mem(alignment, size, externalMemHandleType,
6364
syclQueue.get_device(),
64-
syclQueue.get_context());
65+
syclQueue.get_context(), propList);
6566
}
6667

6768
__SYCL_EXPORT void free_exportable_memory(void *deviceMemory,

sycl/source/detail/memory_export.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ namespace ext::oneapi::experimental {
2323
__SYCL_EXPORT void *alloc_exportable_device_mem(
2424
size_t alignment, size_t size,
2525
export_external_mem_handle_type externalMemHandleType,
26-
const sycl::device &syclDevice, const sycl::context &syclContext) {
26+
const sycl::device &syclDevice, const sycl::context &syclContext,
27+
const sycl::property_list& propList) {
2728

2829
if (!syclDevice.has(sycl::aspect::ext_oneapi_memory_export_linear)) {
2930
throw sycl::exception(

sycl/test-e2e/MemoryExport/export_memory_api_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ int main() {
3636
try {
3737
// Allocate exportable memory.
3838
size_t size = 1024;
39-
void *mem = syclexp::alloc_exportable_device_mem(0, size, exportHandleType,
40-
device, context);
39+
void *mem = syclexp::alloc_exportable_device_mem(
40+
0 /* alignment */, size, exportHandleType, device, context);
4141

4242
// Export the memory handle.
4343
syclexp::exported_mem_t<exportHandleType> exportableMemoryHandle =

0 commit comments

Comments
 (0)