Skip to content

Commit

Permalink
Fix validation for urEnqueueTimestampRecordingExpTest
Browse files Browse the repository at this point in the history
This was failing with the HIP adapter when the pointer is null and the
event wait list is not 0.
  • Loading branch information
npmiller committed May 20, 2024
1 parent 65c39c8 commit 75476b5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -8914,6 +8914,8 @@ urKernelSuggestMaxCooperativeGroupCountExp(
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == phEvent`
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
/// + `phEventWaitList == NULL && numEventsInWaitList > 0`
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
UR_APIEXPORT ur_result_t UR_APICALL
urEnqueueTimestampRecordingExp(
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
Expand Down
4 changes: 3 additions & 1 deletion scripts/core/exp-enqueue-timestamp-recording.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ params:
returns:
- $X_RESULT_ERROR_INVALID_NULL_HANDLE
- $X_RESULT_ERROR_INVALID_NULL_POINTER
- $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
- $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST:
- "`phEventWaitList == NULL && numEventsInWaitList > 0`"
- "`phEventWaitList != NULL && numEventsInWaitList == 0`"
8 changes: 8 additions & 0 deletions source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8975,6 +8975,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueTimestampRecordingExp(
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}

if (phEventWaitList == NULL && numEventsInWaitList > 0) {
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
}

if (phEventWaitList != NULL && numEventsInWaitList == 0) {
return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST;
}

if (phEventWaitList != NULL && numEventsInWaitList > 0) {
for (uint32_t i = 0; i < numEventsInWaitList; ++i) {
if (phEventWaitList[i] == NULL) {
Expand Down
2 changes: 2 additions & 0 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8328,6 +8328,8 @@ ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == phEvent`
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
/// + `phEventWaitList == NULL && numEventsInWaitList > 0`
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
ur_result_t UR_APICALL urEnqueueTimestampRecordingExp(
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
bool
Expand Down
2 changes: 2 additions & 0 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7047,6 +7047,8 @@ ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp(
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == phEvent`
/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST
/// + `phEventWaitList == NULL && numEventsInWaitList > 0`
/// + `phEventWaitList != NULL && numEventsInWaitList == 0`
ur_result_t UR_APICALL urEnqueueTimestampRecordingExp(
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
bool
Expand Down

0 comments on commit 75476b5

Please sign in to comment.