@@ -5973,6 +5973,11 @@ pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context,
5973
5973
pi_device Device,
5974
5974
pi_usm_mem_properties *Properties, size_t Size,
5975
5975
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
+
5976
5981
pi_platform Plt = Device->Platform ;
5977
5982
std::unique_lock<std::mutex> ContextsLock (Plt->ContextsMutex ,
5978
5983
std::defer_lock);
@@ -6031,6 +6036,11 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
6031
6036
pi_device Device,
6032
6037
pi_usm_mem_properties *Properties, size_t Size,
6033
6038
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
+
6034
6044
pi_platform Plt = Device->Platform ;
6035
6045
std::unique_lock<std::mutex> ContextsLock (Plt->ContextsMutex ,
6036
6046
std::defer_lock);
@@ -6087,6 +6097,11 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
6087
6097
pi_result piextUSMHostAlloc (void **ResultPtr, pi_context Context,
6088
6098
pi_usm_mem_properties *Properties, size_t Size,
6089
6099
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
+
6090
6105
pi_platform Plt = Context->Devices [0 ]->Platform ;
6091
6106
std::unique_lock<std::mutex> ContextsLock (Plt->ContextsMutex ,
6092
6107
std::defer_lock);
0 commit comments