Skip to content

Commit ba6818b

Browse files
committed
Fix regression with empty property list for USM allocations
A board's MMD may not support passing property lists containing only a null terminator to aocl_mmd_host_alloc() or aocl_mmd_shared_alloc(). This resolves a regression introducted in #141 Signed-off-by: Peter Colberg <[email protected]>
1 parent f8b6bab commit ba6818b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/acl_usm.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
168168
}
169169

170170
int error = 0;
171-
void *mem = acl_get_hal()->host_alloc(devices, size, alignment,
172-
mmd_properties.data(), &error);
171+
void *mem = acl_get_hal()->host_alloc(
172+
devices, size, alignment,
173+
mmd_properties[0] ? mmd_properties.data() : nullptr, &error);
173174
if (error) {
174175
acl_free(usm_alloc);
175176
switch (error) {
@@ -458,8 +459,9 @@ clSharedMemAllocINTEL(cl_context context, cl_device_id device,
458459
}
459460

460461
int error;
461-
void *mem = acl_get_hal()->shared_alloc(device, size, alignment,
462-
mmd_properties.data(), &error);
462+
void *mem = acl_get_hal()->shared_alloc(
463+
device, size, alignment,
464+
mmd_properties[0] ? mmd_properties.data() : nullptr, &error);
463465
if (mem == NULL) {
464466
acl_free(usm_alloc);
465467
switch (error) {

0 commit comments

Comments
 (0)