Skip to content

Commit 028d348

Browse files
committed
Modify USM device allocation information returned by clGetDeviceInfo
According to USM extension spec, clDeviceMemAllocINTEL will return NULL and CL_INVALID_OPERATION status if the device has property CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL equal to 0. Before, the runtime always return 1 for device allocation capabilities as all legacy devices support device allocations. This is no longer true in IP Authoring flow.
1 parent a10729c commit 028d348

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/acl_device.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,16 @@ CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfoIntelFPGA(
533533
if (param_name == CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL) {
534534
capabilities = device->def.host_capabilities;
535535
} else if (param_name == CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL) {
536-
// Device allocations are supported for all legacy devices
537-
// Device allocations managed by runtime in legacy devices
538-
capabilities = ACL_MEM_CAPABILITY_SUPPORTED;
536+
if (acl_platform.offline_mode == ACL_CONTEXT_MPSIM) {
537+
// Device allocations are not supported in IPA flow which
538+
// currently runs in simulation only. Return true device
539+
// allocation capabilities in this case.
540+
capabilities = device->def.device_capabilities;
541+
} else {
542+
// IPA is not supported with hardware flow currently, and
543+
// device allocations are supported for all legacy devices
544+
capabilities = ACL_MEM_CAPABILITY_SUPPORTED;
545+
}
539546
} else {
540547
capabilities = device->def.shared_capabilities;
541548
}

src/acl_usm.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ clDeviceMemAllocINTEL(cl_context context, cl_device_id device,
238238
"Memory buffer size is larger than max size supported by device");
239239
}
240240

241+
if (!acl_usm_has_access_capability(device,
242+
CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL)) {
243+
BAIL_INFO(
244+
CL_INVALID_OPERATION, context,
245+
"Device does not support device Unified Shared Memory allocations: " +
246+
device->def.autodiscovery_def.name);
247+
}
248+
241249
// Spec allows for power of 2 allignment.
242250
// For now, we only allow alignment to ACL_MEM_ALIGN.
243251
// Over align all allocations to ACL_MEM_ALIGN.

0 commit comments

Comments
 (0)