From 75476b578343609b4e55891fdf2f66470ea94485 Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Thu, 16 May 2024 19:26:57 +0100 Subject: [PATCH] Fix validation for urEnqueueTimestampRecordingExpTest This was failing with the HIP adapter when the pointer is null and the event wait list is not 0. --- include/ur_api.h | 2 ++ scripts/core/exp-enqueue-timestamp-recording.yml | 4 +++- source/loader/layers/validation/ur_valddi.cpp | 8 ++++++++ source/loader/ur_libapi.cpp | 2 ++ source/ur_api.cpp | 2 ++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/ur_api.h b/include/ur_api.h index 77e012259f..08374e8d6e 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -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 diff --git a/scripts/core/exp-enqueue-timestamp-recording.yml b/scripts/core/exp-enqueue-timestamp-recording.yml index 18316f734e..d8eff2a6cc 100644 --- a/scripts/core/exp-enqueue-timestamp-recording.yml +++ b/scripts/core/exp-enqueue-timestamp-recording.yml @@ -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`" diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index cc11494804..e997726dc2 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -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) { diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index baa8173976..0d0bdc1fe5 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -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 diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 83929bf71b..7cb62fdf0d 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -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