Skip to content

Modify USM device allocation information returned by clGetDeviceInfo #286

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 1 commit into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions src/acl_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,16 @@ CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfoIntelFPGA(
if (param_name == CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL) {
capabilities = device->def.host_capabilities;
} else if (param_name == CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL) {
// Device allocations are supported for all legacy devices
// Device allocations managed by runtime in legacy devices
capabilities = ACL_MEM_CAPABILITY_SUPPORTED;
if (acl_platform.offline_mode == ACL_CONTEXT_MPSIM) {
// Device allocations are not supported in IPA flow which
// currently runs in simulation only. Return true device
// allocation capabilities in this case.
capabilities = device->def.device_capabilities;
} else {
// IPA is not supported with hardware flow currently, and
// device allocations are supported for all legacy devices
capabilities = ACL_MEM_CAPABILITY_SUPPORTED;
}
} else {
capabilities = device->def.shared_capabilities;
}
Expand Down
8 changes: 8 additions & 0 deletions src/acl_usm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ clDeviceMemAllocINTEL(cl_context context, cl_device_id device,
"Memory buffer size is larger than max size supported by device");
}

if (!acl_usm_has_access_capability(device,
CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL)) {
BAIL_INFO(
CL_INVALID_OPERATION, context,
"Device does not support device Unified Shared Memory allocations: " +
device->def.autodiscovery_def.name);
}

// Spec allows for power of 2 allignment.
// For now, we only allow alignment to ACL_MEM_ALIGN.
// Over align all allocations to ACL_MEM_ALIGN.
Expand Down