Skip to content

Commit cabdf60

Browse files
committed
[SYCL] Fix for alignment requests > 64KB.
Signed-off-by: rdeodhar <[email protected]>
1 parent 9ddb8f0 commit cabdf60

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5973,6 +5973,11 @@ pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
59735973
pi_device Device,
59745974
pi_usm_mem_properties *Properties, size_t Size,
59755975
pi_uint32 Alignment) {
5976+
// L0 supports alignment up to 64KB and silently ignores higher values.
5977+
// We flag alignment > 64KB as an invalid value.
5978+
if (Alignment > 65536)
5979+
return PI_INVALID_VALUE;
5980+
59765981
pi_platform Plt = Device->Platform;
59775982
std::unique_lock<std::mutex> ContextsLock(Plt->ContextsMutex,
59785983
std::defer_lock);
@@ -6031,6 +6036,11 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
60316036
pi_device Device,
60326037
pi_usm_mem_properties *Properties, size_t Size,
60336038
pi_uint32 Alignment) {
6039+
// L0 supports alignment up to 64KB and silently ignores higher values.
6040+
// We flag alignment > 64KB as an invalid value.
6041+
if (Alignment > 65536)
6042+
return PI_INVALID_VALUE;
6043+
60346044
pi_platform Plt = Device->Platform;
60356045
std::unique_lock<std::mutex> ContextsLock(Plt->ContextsMutex,
60366046
std::defer_lock);
@@ -6087,6 +6097,11 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
60876097
pi_result piextUSMHostAlloc(void **ResultPtr, pi_context Context,
60886098
pi_usm_mem_properties *Properties, size_t Size,
60896099
pi_uint32 Alignment) {
6100+
// L0 supports alignment up to 64KB and silently ignores higher values.
6101+
// We flag alignment > 64KB as an invalid value.
6102+
if (Alignment > 65536)
6103+
return PI_INVALID_VALUE;
6104+
60906105
pi_platform Plt = Context->Devices[0]->Platform;
60916106
std::unique_lock<std::mutex> ContextsLock(Plt->ContextsMutex,
60926107
std::defer_lock);

0 commit comments

Comments
 (0)