Skip to content

Commit f8b6bab

Browse files
ericxu233pcolberg
authored andcommitted
Only pass buffer location property if in simulation environment
This addresses #147 (comment)
1 parent ec25a48 commit f8b6bab

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/acl_usm.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,12 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
150150
{
151151
auto mmd_properties_it = mmd_properties.begin();
152152
if (mem_id) {
153-
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
154-
*mmd_properties_it++ = *mem_id;
153+
int use_offline_only;
154+
acl_get_offline_device_user_setting(&use_offline_only);
155+
if (use_offline_only == ACL_CONTEXT_MPSIM) {
156+
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
157+
*mmd_properties_it++ = *mem_id;
158+
}
155159
}
156160
*mmd_properties_it++ = 0;
157161
}
@@ -436,8 +440,12 @@ clSharedMemAllocINTEL(cl_context context, cl_device_id device,
436440
{
437441
auto mmd_properties_it = mmd_properties.begin();
438442
if (mem_id) {
439-
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
440-
*mmd_properties_it++ = *mem_id;
443+
int use_offline_only;
444+
acl_get_offline_device_user_setting(&use_offline_only);
445+
if (use_offline_only == ACL_CONTEXT_MPSIM) {
446+
*mmd_properties_it++ = AOCL_MMD_MEM_PROPERTIES_BUFFER_LOCATION;
447+
*mmd_properties_it++ = *mem_id;
448+
}
441449
}
442450
*mmd_properties_it++ = 0;
443451
}

0 commit comments

Comments
 (0)