Skip to content

Only pass buffer location property if in simulation environment #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions src/acl_usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,12 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
{
auto mmd_properties_it = mmd_properties.begin();
if (mem_id) {
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
*mmd_properties_it++ = *mem_id;
int use_offline_only;
acl_get_offline_device_user_setting(&use_offline_only);
if (use_offline_only == ACL_CONTEXT_MPSIM) {
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
*mmd_properties_it++ = *mem_id;
}
}
*mmd_properties_it++ = 0;
}
Expand All @@ -164,8 +168,9 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
}

int error = 0;
void *mem = acl_get_hal()->host_alloc(devices, size, alignment,
mmd_properties.data(), &error);
void *mem = acl_get_hal()->host_alloc(
devices, size, alignment,
mmd_properties[0] ? mmd_properties.data() : nullptr, &error);
if (error) {
acl_free(usm_alloc);
switch (error) {
Expand Down Expand Up @@ -436,8 +441,12 @@ clSharedMemAllocINTEL(cl_context context, cl_device_id device,
{
auto mmd_properties_it = mmd_properties.begin();
if (mem_id) {
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
*mmd_properties_it++ = *mem_id;
int use_offline_only;
acl_get_offline_device_user_setting(&use_offline_only);
if (use_offline_only == ACL_CONTEXT_MPSIM) {
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
*mmd_properties_it++ = *mem_id;
}
}
*mmd_properties_it++ = 0;
}
Expand All @@ -450,8 +459,9 @@ clSharedMemAllocINTEL(cl_context context, cl_device_id device,
}

int error;
void *mem = acl_get_hal()->shared_alloc(device, size, alignment,
mmd_properties.data(), &error);
void *mem = acl_get_hal()->shared_alloc(
device, size, alignment,
mmd_properties[0] ? mmd_properties.data() : nullptr, &error);
if (mem == NULL) {
acl_free(usm_alloc);
switch (error) {
Expand Down