Skip to content
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
11 changes: 11 additions & 0 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -6217,6 +6217,11 @@ urEnqueueMemBufferCopyRect(
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `patternSize == 0 || size == 0`
/// + `patternSize > size`
/// + `(patternSize & (patternSize - 1)) != 0`
/// + `size % patternSize != 0`
/// + `offset % patternSize != 0`
/// + If `offset + size` results in an out-of-bounds access.
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
Expand Down Expand Up @@ -6266,6 +6271,8 @@ urEnqueueMemBufferFill(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
UR_APIEXPORT ur_result_t UR_APICALL
Expand Down Expand Up @@ -6317,6 +6324,8 @@ urEnqueueMemImageRead(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
UR_APIEXPORT ur_result_t UR_APICALL
Expand Down Expand Up @@ -6362,6 +6371,8 @@ urEnqueueMemImageWrite(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
UR_APIEXPORT ur_result_t UR_APICALL
Expand Down
11 changes: 11 additions & 0 deletions scripts/core/enqueue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@ returns:
- "If event objects in phEventWaitList are not valid events."
- $X_RESULT_ERROR_INVALID_MEM_OBJECT
- $X_RESULT_ERROR_INVALID_SIZE:
- "`patternSize == 0 || size == 0`"
- "`patternSize > size`"
- "`(patternSize & (patternSize - 1)) != 0`"
- "`size % patternSize != 0`"
- "`offset % patternSize != 0`"
- "If `offset + size` results in an out-of-bounds access."
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
- $X_RESULT_ERROR_OUT_OF_RESOURCES
Expand Down Expand Up @@ -629,6 +634,8 @@ returns:
- "`phEventWaitList != NULL && numEventsInWaitList == 0`"
- "If event objects in phEventWaitList are not valid events."
- $X_RESULT_ERROR_INVALID_MEM_OBJECT
- $X_RESULT_ERROR_INVALID_SIZE:
- "`region.width == 0 || region.height == 0 || region.depth == 0`"
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
- $X_RESULT_ERROR_OUT_OF_RESOURCES
--- #--------------------------------------------------------------------------
Expand Down Expand Up @@ -686,6 +693,8 @@ returns:
- "`phEventWaitList != NULL && numEventsInWaitList == 0`"
- "If event objects in phEventWaitList are not valid events."
- $X_RESULT_ERROR_INVALID_MEM_OBJECT
- $X_RESULT_ERROR_INVALID_SIZE:
- "`region.width == 0 || region.height == 0 || region.depth == 0`"
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
- $X_RESULT_ERROR_OUT_OF_RESOURCES
--- #--------------------------------------------------------------------------
Expand Down Expand Up @@ -735,6 +744,8 @@ returns:
- "`phEventWaitList != NULL && numEventsInWaitList == 0`"
- "If event objects in phEventWaitList are not valid events."
- $X_RESULT_ERROR_INVALID_MEM_OBJECT
- $X_RESULT_ERROR_INVALID_SIZE:
- "`region.width == 0 || region.height == 0 || region.depth == 0`"
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
- $X_RESULT_ERROR_OUT_OF_RESOURCES
--- #--------------------------------------------------------------------------
Expand Down
32 changes: 32 additions & 0 deletions source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4525,6 +4525,26 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill(
if (phEventWaitList != NULL && numEventsInWaitList == 0) {
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
}

if (patternSize == 0 || size == 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}

if (patternSize > size) {
return UR_RESULT_ERROR_INVALID_SIZE;
}

if ((patternSize & (patternSize - 1)) != 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}

if (size % patternSize != 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}

if (offset % patternSize != 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}
}

ur_result_t result =
Expand Down Expand Up @@ -4584,6 +4604,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead(
if (phEventWaitList != NULL && numEventsInWaitList == 0) {
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
}

if (region.width == 0 || region.height == 0 || region.depth == 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}
}

ur_result_t result = pfnMemImageRead(
Expand Down Expand Up @@ -4644,6 +4668,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite(
if (phEventWaitList != NULL && numEventsInWaitList == 0) {
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
}

if (region.width == 0 || region.height == 0 || region.depth == 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}
}

ur_result_t result = pfnMemImageWrite(
Expand Down Expand Up @@ -4704,6 +4732,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy(
if (phEventWaitList != NULL && numEventsInWaitList == 0) {
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
}

if (region.width == 0 || region.height == 0 || region.depth == 0) {
return UR_RESULT_ERROR_INVALID_SIZE;
}
}

ur_result_t result =
Expand Down
11 changes: 11 additions & 0 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5197,6 +5197,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopyRect(
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `patternSize == 0 || size == 0`
/// + `patternSize > size`
/// + `(patternSize & (patternSize - 1)) != 0`
/// + `size % patternSize != 0`
/// + `offset % patternSize != 0`
/// + If `offset + size` results in an out-of-bounds access.
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
Expand Down Expand Up @@ -5259,6 +5264,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferFill(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
ur_result_t UR_APICALL urEnqueueMemImageRead(
Expand Down Expand Up @@ -5324,6 +5331,8 @@ ur_result_t UR_APICALL urEnqueueMemImageRead(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
ur_result_t UR_APICALL urEnqueueMemImageWrite(
Expand Down Expand Up @@ -5385,6 +5394,8 @@ ur_result_t UR_APICALL urEnqueueMemImageWrite(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
ur_result_t UR_APICALL urEnqueueMemImageCopy(
Expand Down
11 changes: 11 additions & 0 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4405,6 +4405,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopyRect(
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `patternSize == 0 || size == 0`
/// + `patternSize > size`
/// + `(patternSize & (patternSize - 1)) != 0`
/// + `size % patternSize != 0`
/// + `offset % patternSize != 0`
/// + If `offset + size` results in an out-of-bounds access.
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
Expand Down Expand Up @@ -4458,6 +4463,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferFill(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
ur_result_t UR_APICALL urEnqueueMemImageRead(
Expand Down Expand Up @@ -4515,6 +4522,8 @@ ur_result_t UR_APICALL urEnqueueMemImageRead(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
ur_result_t UR_APICALL urEnqueueMemImageWrite(
Expand Down Expand Up @@ -4567,6 +4576,8 @@ ur_result_t UR_APICALL urEnqueueMemImageWrite(
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
/// + If event objects in phEventWaitList are not valid events.
/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + `region.width == 0 || region.height == 0 || region.depth == 0`
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
ur_result_t UR_APICALL urEnqueueMemImageCopy(
Expand Down