@@ -46,7 +46,8 @@ namespace detail {
46
46
namespace usm {
47
47
48
48
void *alignedAllocHost (size_t Alignment, size_t Size, const context &Ctxt,
49
- alloc Kind, const detail::code_location &CL) {
49
+ alloc Kind, const detail::code_location &CL,
50
+ const property_list &PropList = {}) {
50
51
XPTI_CREATE_TRACEPOINT (CL);
51
52
void *RetVal = nullptr ;
52
53
if (Size == 0 )
@@ -72,8 +73,26 @@ void *alignedAllocHost(size_t Alignment, size_t Size, const context &Ctxt,
72
73
73
74
switch (Kind) {
74
75
case alloc::host: {
76
+ std::array<pi_usm_mem_properties, 3 > Props;
77
+ auto PropsIter = Props.begin ();
78
+
79
+ if (PropList.has_property <cl::sycl::ext::intel::experimental::property::
80
+ usm::buffer_location>() &&
81
+ Ctxt.get_platform ().has_extension (
82
+ " cl_intel_mem_alloc_buffer_location" )) {
83
+ *PropsIter++ = PI_MEM_USM_ALLOC_BUFFER_LOCATION;
84
+ *PropsIter++ = PropList
85
+ .get_property <cl::sycl::ext::intel::experimental::
86
+ property::usm::buffer_location>()
87
+ .get_buffer_location ();
88
+ }
89
+
90
+ assert (PropsIter >= Props.begin () && PropsIter < Props.end ());
91
+ *PropsIter++ = 0 ; // null-terminate property list
92
+
75
93
Error = Plugin.call_nocheck <PiApiKind::piextUSMHostAlloc>(
76
- &RetVal, C, nullptr , Size, Alignment);
94
+ &RetVal, C, Props.data (), Size, Alignment);
95
+
77
96
break ;
78
97
}
79
98
case alloc::device:
@@ -298,9 +317,11 @@ void *malloc_host(size_t Size, const context &Ctxt,
298
317
return detail::usm::alignedAllocHost (0 , Size, Ctxt, alloc::host, CL);
299
318
}
300
319
301
- void *malloc_host (size_t Size, const context &Ctxt, const property_list &,
320
+ void *malloc_host (size_t Size, const context &Ctxt,
321
+ const property_list &PropList,
302
322
const detail::code_location CL) {
303
- return malloc_host (Size, Ctxt, CL);
323
+ return detail::usm::alignedAllocHost (0 , Size, Ctxt, alloc::host, CL,
324
+ PropList);
304
325
}
305
326
306
327
void *malloc_host (size_t Size, const queue &Q, const detail::code_location CL) {
@@ -340,9 +361,10 @@ void *aligned_alloc_host(size_t Alignment, size_t Size, const context &Ctxt,
340
361
}
341
362
342
363
void *aligned_alloc_host (size_t Alignment, size_t Size, const context &Ctxt,
343
- const property_list &,
364
+ const property_list &PropList ,
344
365
const detail::code_location CL) {
345
- return aligned_alloc_host (Alignment, Size, Ctxt, CL);
366
+ return detail::usm::alignedAllocHost (Alignment, Size, Ctxt, alloc::host, CL,
367
+ PropList);
346
368
}
347
369
348
370
void *aligned_alloc_host (size_t Alignment, size_t Size, const queue &Q,
0 commit comments