Skip to content

[SYCL] Fix for alignment requests > 64KB. #4263

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 5 commits into from
Aug 10, 2021
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
15 changes: 15 additions & 0 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6048,6 +6048,11 @@ pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
pi_device Device,
pi_usm_mem_properties *Properties, size_t Size,
pi_uint32 Alignment) {
// L0 supports alignment up to 64KB and silently ignores higher values.
// We flag alignment > 64KB as an invalid value.
if (Alignment > 65536)
return PI_INVALID_VALUE;

pi_platform Plt = Device->Platform;
std::unique_lock<std::mutex> ContextsLock(Plt->ContextsMutex,
std::defer_lock);
Expand Down Expand Up @@ -6106,6 +6111,11 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
pi_device Device,
pi_usm_mem_properties *Properties, size_t Size,
pi_uint32 Alignment) {
// L0 supports alignment up to 64KB and silently ignores higher values.
// We flag alignment > 64KB as an invalid value.
if (Alignment > 65536)
return PI_INVALID_VALUE;

pi_platform Plt = Device->Platform;
std::unique_lock<std::mutex> ContextsLock(Plt->ContextsMutex,
std::defer_lock);
Expand Down Expand Up @@ -6162,6 +6172,11 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
pi_result piextUSMHostAlloc(void **ResultPtr, pi_context Context,
pi_usm_mem_properties *Properties, size_t Size,
pi_uint32 Alignment) {
// L0 supports alignment up to 64KB and silently ignores higher values.
// We flag alignment > 64KB as an invalid value.
if (Alignment > 65536)
return PI_INVALID_VALUE;

pi_platform Plt = Context->Devices[0]->Platform;
std::unique_lock<std::mutex> ContextsLock(Plt->ContextsMutex,
std::defer_lock);
Expand Down