diff --git a/projects/hip-tests/catch/include/hip_test_defgroups.hh b/projects/hip-tests/catch/include/hip_test_defgroups.hh index 360bfe1282..97e9bea8ab 100644 --- a/projects/hip-tests/catch/include/hip_test_defgroups.hh +++ b/projects/hip-tests/catch/include/hip_test_defgroups.hh @@ -43,6 +43,13 @@ THE SOFTWARE. * @} */ +/** + * @defgroup EventTest Event Management + * @{ + * This section describes tests for the event management functions of HIP runtime API. + * @} + */ + /** * @defgroup ShflTest warp shuffle function Management * @{ diff --git a/projects/hip-tests/catch/unit/event/Unit_hipEvent.cc b/projects/hip-tests/catch/unit/event/Unit_hipEvent.cc index 6654c58d5b..24c8856006 100644 --- a/projects/hip-tests/catch/unit/event/Unit_hipEvent.cc +++ b/projects/hip-tests/catch/unit/event/Unit_hipEvent.cc @@ -26,6 +26,12 @@ THE SOFTWARE. #include +/** + * @addtogroup hipEventRecord hipEventRecord + * @{ + * @ingroup EventTest + */ + int tests = -1; enum SyncMode { syncNone, @@ -183,7 +189,19 @@ void runTests(int64_t numElements) { HIP_CHECK(hipHostFree(C_h)); } - +/** + * Test Description + * ------------------------ + * - Complex test case used to create a lot of events. + * - Each event is enqueued to the stream. + * - Kernels are launched and synchronized. + * Test source + * ------------------------ + * - unit/event/Unit_hipEvent.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEvent") { runTests(10000000); } diff --git a/projects/hip-tests/catch/unit/event/Unit_hipEventElapsedTime.cc b/projects/hip-tests/catch/unit/event/Unit_hipEventElapsedTime.cc index 1b5f6e22e9..7149c8cbea 100644 --- a/projects/hip-tests/catch/unit/event/Unit_hipEventElapsedTime.cc +++ b/projects/hip-tests/catch/unit/event/Unit_hipEventElapsedTime.cc @@ -19,21 +19,43 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipEventElapsedTime_NullCheck - Test unsuccessful hipEventElapsedTime when either event passed as nullptr -Unit_hipEventElapsedTime_DisableTiming - Test unsuccessful hipEventElapsedTime when events are created with hipEventDisableTiming flag -Unit_hipEventElapsedTime_DifferentDevices - Test unsuccessful hipEventElapsedTime when events are recorded on different devices -Unit_hipEventElapsedTime_NotReady_Negative - Test unsuccessful hipEventElapsedTime when an event has not been completed -Unit_hipEventElapsedTime - Test time elapsed between two recorded events with hipEventElapsedTime api -*/ #include - #include - #include +/** + * @addtogroup hipEventElapsedTime hipEventElapsedTime + * @{ + * @ingroup EventTest + * `hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop)` - + * Return the elapsed time between two events. + * ________________________ + * Test cases from other modules: + * - @ref Unit_hipEvent + * - @ref Unit_hipEventIpc + * - @ref Unit_hipEventMGpuMThreads_1 + * - @ref Unit_hipEventMGpuMThreads_2 + * - @ref Unit_hipEventMGpuMThreads_3 + */ + +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When output parameter for time is `nullptr` + * - Expected output: return `hipErrorInvalidValue` + * -# When first event is `nullptr` + * - Expected output: return `hipErrorInvalidHandle` + * -# When second event is `nullptr` + * - Expected output: return `hipErrorInvalidValue` + * Test source + * ------------------------ + * - unit/event/Unit_hipEventElapsedTime.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventElapsedTime_NullCheck") { hipEvent_t start = nullptr, end = nullptr; float tms = 1.0f; @@ -45,6 +67,19 @@ TEST_CASE("Unit_hipEventElapsedTime_NullCheck") { #endif } +/** + * Test Description + * ------------------------ + * - Calculates elapsed time when events are created with disable timing flag + * -# When flag is set to disable timing + * - Expected output: return `hipErrorInvalidValue` + * Test source + * ------------------------ + * - unit/event/Unit_hipEventElapsedTime.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventElapsedTime_DisableTiming") { float timeElapsed = 1.0f; hipEvent_t start, stop; @@ -55,6 +90,19 @@ TEST_CASE("Unit_hipEventElapsedTime_DisableTiming") { HIP_CHECK(hipEventDestroy(stop)); } +/** + * Test Description + * ------------------------ + * - Calculates elapsed time when events are recorded on different devices + * -# When start and stop events are recorded on different devices + * - Expected output: return `hipErrorInvalidValue` + * Test source + * ------------------------ + * - unit/event/Unit_hipEventElapsedTime.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") { int devCount = 0; HIP_CHECK(hipGetDeviceCount(&devCount)); @@ -86,6 +134,20 @@ TEST_CASE("Unit_hipEventElapsedTime_DifferentDevices") { #if HT_AMD /* Disabled because frequency based wait is timing out on nvidia platforms */ +/** + * Test Description + * ------------------------ + * - Calculates elapsed time when an event has not been completed. + * -# When the stop event has not finished yet + * - Expected output: return `hipErrorNotReady` + * Test source + * ------------------------ + * - unit/event/Unit_hipEventElapsedTime.cc + * Test requirements + * ------------------------ + * - Platform specific (AMD) + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventElapsedTime_NotReady_Negative") { hipEvent_t start; HIP_CHECK(hipEventCreate(&start)); @@ -112,6 +174,17 @@ TEST_CASE("Unit_hipEventElapsedTime_NotReady_Negative") { } #endif // HT_AMD +/** + * Test Description + * ------------------------ + * - Calculates elapsed time between two successfully created and recorded events. + * Test source + * ------------------------ + * - unit/event/Unit_hipEventElapsedTime.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventElapsedTime") { hipEvent_t start; HIP_CHECK(hipEventCreate(&start)); diff --git a/projects/hip-tests/catch/unit/event/Unit_hipEventIpc.cc b/projects/hip-tests/catch/unit/event/Unit_hipEventIpc.cc index 1081327f8c..a4f71d568a 100644 --- a/projects/hip-tests/catch/unit/event/Unit_hipEventIpc.cc +++ b/projects/hip-tests/catch/unit/event/Unit_hipEventIpc.cc @@ -27,7 +27,23 @@ THE SOFTWARE. #include +/** + * @addtogroup hipEventCreateWithFlags hipEventCreateWithFlags + * @{ + * @ingroup EventTest + */ +/** + * Test Description + * ------------------------ + * - Validate Event Management APIs when working with multiple processes. + * Test source + * ------------------------ + * - unit/event/Unit_hipEventIpc.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventIpc") { size_t N = 4 * 1024 * 1024; unsigned threadsPerBlock = 256; diff --git a/projects/hip-tests/catch/unit/event/Unit_hipEventMGpuMThreads.cc b/projects/hip-tests/catch/unit/event/Unit_hipEventMGpuMThreads.cc index a6d849065b..346d8c05ec 100644 --- a/projects/hip-tests/catch/unit/event/Unit_hipEventMGpuMThreads.cc +++ b/projects/hip-tests/catch/unit/event/Unit_hipEventMGpuMThreads.cc @@ -22,6 +22,12 @@ #include #include +/** + * @addtogroup hipEventCreate hipEventCreate + * @{ + * @ingroup EventTest + */ + int64_t timeNanos() { using namespace std::chrono; static auto t0 = steady_clock::now(); @@ -187,10 +193,32 @@ void testEventMGpuMThreads(int nThreads = 1) { delete []threads; } +/** + * Test Description + * ------------------------ + * - Validate Event Management APIs when working with one thread. + * Test source + * ------------------------ + * - unit/event/Unit_hipEventMGpuMThreads.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventMGpuMThreads_1") { testEventMGpuMThreads(1); } +/** + * Test Description + * ------------------------ + * - Validate Event Management APIs when working with at least two threads. + * Test source + * ------------------------ + * - unit/event/Unit_hipEventMGpuMThreads.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventMGpuMThreads_2") { int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); @@ -201,6 +229,17 @@ TEST_CASE("Unit_hipEventMGpuMThreads_2") { } } +/** + * Test Description + * ------------------------ + * - Validate Event Management APIs when working with at least three threads. + * Test source + * ------------------------ + * - unit/event/Unit_hipEventMGpuMThreads.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventMGpuMThreads_3") { int numDevices = 0; HIP_CHECK(hipGetDeviceCount(&numDevices)); diff --git a/projects/hip-tests/catch/unit/event/Unit_hipEventQuery.cc b/projects/hip-tests/catch/unit/event/Unit_hipEventQuery.cc index 47d8995c18..726a57ca53 100644 --- a/projects/hip-tests/catch/unit/event/Unit_hipEventQuery.cc +++ b/projects/hip-tests/catch/unit/event/Unit_hipEventQuery.cc @@ -19,6 +19,17 @@ THE SOFTWARE. #include +/** + * @addtogroup hipEventQuery hipEventQuery + * @{ + * @ingroup EventTest + * `hipEventQuery(hipEvent_t event)` - + * Query the status of the specified event. + * ________________________ + * Test cases from other modules: + * - @ref Unit_hipEventIpc + */ + // Since we can not use atomic*_system on every gpu, we will use wait based on clock rate. // This wont be accurate since current clock rate of a GPU varies depending on many variables // including thermals, load, utilization etc @@ -48,6 +59,17 @@ __global__ void waitKernel_gfx11(int clockRate, int seconds) { #endif } +/** + * Test Description + * ------------------------ + * - Query events with a single and with multiple devices. + * Test source + * ------------------------ + * - unit/event/Unit_hipEventQuery.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventQuery_DifferentDevice") { hipEvent_t event1{}, event2{}; HIP_CHECK(hipEventCreate(&event1)); diff --git a/projects/hip-tests/catch/unit/event/Unit_hipEventRecord.cc b/projects/hip-tests/catch/unit/event/Unit_hipEventRecord.cc index 70e5a684ec..7dd8c582b9 100644 --- a/projects/hip-tests/catch/unit/event/Unit_hipEventRecord.cc +++ b/projects/hip-tests/catch/unit/event/Unit_hipEventRecord.cc @@ -19,12 +19,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipEventRecord- Test hipEventRecord serialization behavior -Unit_hipEventRecord_Negative - Test unsuccessful hipEventRecord when event is passed as nullptr - - Test unsuccessful hipEventRecord when event is created/recorded on different devices -*/ #include @@ -32,6 +26,33 @@ Unit_hipEventRecord_Negative - Test unsuccessful hipEventRecord when event is pa #include #include +/** + * @addtogroup hipEventRecord hipEventRecord + * @{ + * @ingroup EventTest + * `hipEventRecord(hipEvent_t event, hipStream_t stream = NULL)` - + * Record an event in the specified stream. + * ________________________ + * Test cases from other modules: + * - @ref Unit_hipEventIpc + * - @ref Unit_hipEventMGpuMThreads_1 + * - @ref Unit_hipEventMGpuMThreads_2 + * - @ref Unit_hipEventMGpuMThreads_3 + */ + +/** + * Test Description + * ------------------------ + * - Creates regular events and events with flags. + * - Enqueues them to the streams and checks if events + * can be successfully used for synchronization. + * Test source + * ------------------------ + * - unit/event/Unit_hipEventRecord.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventRecord") { constexpr size_t N = 1024; constexpr int iterations = 1; @@ -117,6 +138,21 @@ TEST_CASE("Unit_hipEventRecord") { TestContext::get().cleanContext(); } +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When event is `nullptr` + * - Expected output: return `hipErrorInvalidResourceHandle` + * -# When event is created on one device but recorded on the other one + * - Expected output: return `hipErrorInvalidHandle` + * Test source + * ------------------------ + * - unit/event/Unit_hipEventRecord.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventRecord_Negative") { SECTION("Nullptr event") { HIP_CHECK_ERROR(hipEventRecord(nullptr, nullptr), hipErrorInvalidResourceHandle); diff --git a/projects/hip-tests/catch/unit/event/Unit_hipEvent_Negative.cc b/projects/hip-tests/catch/unit/event/Unit_hipEvent_Negative.cc index 6dd0b44363..14c173ceb7 100644 --- a/projects/hip-tests/catch/unit/event/Unit_hipEvent_Negative.cc +++ b/projects/hip-tests/catch/unit/event/Unit_hipEvent_Negative.cc @@ -31,31 +31,71 @@ Unit_hipEventCreate_IncompatibleFlags - Test unsuccessful event creation when in #include +/** + * @addtogroup hipEventCreate hipEventCreate + * @{ + * @ingroup EventTest + */ + +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When output pointer to the event is `nullptr` + * - Expected output: do not return `hipSuccess` + * Test source + * ------------------------ + * - unit/event/Unit_hipEvent_Negative.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventCreate_NullCheck") { auto res = hipEventCreate(nullptr); REQUIRE(res != hipSuccess); } +/** + * End doxygen group hipEventCreate. + * @} + */ +/** + * @addtogroup hipEventCreateWithFlags hipEventCreateWithFlags + * @{ + * @ingroup EventTest + */ + +/** + * Test Description + * ------------------------ + * - Validates handling of `nullptr` arguments: + * -# When output pointer to the event is `nullptr` + * - Expected output: do not return `hipSuccess` + * Test source + * ------------------------ + * - unit/event/Unit_hipEvent_Negative.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventCreateWithFlags_NullCheck") { auto res = hipEventCreateWithFlags(nullptr, 0); REQUIRE(res != hipSuccess); } -TEST_CASE("Unit_hipEventSynchronize_NullCheck") { - auto res = hipEventSynchronize(nullptr); - REQUIRE(res != hipSuccess); -} - -TEST_CASE("Unit_hipEventQuery_NullCheck") { - auto res = hipEventQuery(nullptr); - REQUIRE(res != hipSuccess); -} - -TEST_CASE("Unit_hipEventDestroy_NullCheck") { - auto res = hipEventDestroy(nullptr); - REQUIRE(res != hipSuccess); -} - +/** + * Test Description + * ------------------------ + * - Validates handling of incompatible flags: + * -# When the flags are not supported on the device + * - Expected output: return `hipErrorInvalidValue` + * Test source + * ------------------------ + * - unit/event/Unit_hipEvent_Negative.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventCreate_IncompatibleFlags") { hipEvent_t event; HIP_CHECK_ERROR(hipEventCreateWithFlags(&event, hipEventInterprocess), hipErrorInvalidValue); @@ -79,4 +119,88 @@ TEST_CASE("Unit_hipEventCreate_IncompatibleFlags") { unsigned invalidFlag{0x08000000}; HIP_CHECK_ERROR(hipEventCreateWithFlags(&event, invalidFlag), hipErrorInvalidValue); -} \ No newline at end of file +} +/** + * End doxygen group hipEventCreateWithFlags. + * @} + */ + +/** + * @addtogroup hipEventSynchronize hipEventSynchronize + * @{ + * @ingroup EventTest + */ + +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When event is `nullptr` + * - Expected output: do not return `hipSuccess` + * Test source + * ------------------------ + * - unit/event/Unit_hipEvent_Negative.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ +TEST_CASE("Unit_hipEventSynchronize_NullCheck") { + auto res = hipEventSynchronize(nullptr); + REQUIRE(res != hipSuccess); +} +/** + * End doxygen group hipEventSynchronize. + * @} + */ + +/** + * @addtogroup hipEventQuery hipEventQuery + * @{ + * @ingroup EventTest + */ + +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When event is `nullptr` + * - Expected output: do not return `hipSuccess` + * Test source + * ------------------------ + * - unit/event/Unit_hipEvent_Negative.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ +TEST_CASE("Unit_hipEventQuery_NullCheck") { + auto res = hipEventQuery(nullptr); + REQUIRE(res != hipSuccess); +} +/** + * End doxygen group hipEventQuery. + * @} + */ + +/** + * @addtogroup hipEventDestroy hipEventDestroy + * @{ + * @ingroup EventTest + */ + +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When event is `nullptr` + * - Expected output: do not return `hipSuccess` + * Test source + * ------------------------ + * - unit/event/Unit_hipEvent_Negative.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ +TEST_CASE("Unit_hipEventDestroy_NullCheck") { + auto res = hipEventDestroy(nullptr); + REQUIRE(res != hipSuccess); +} diff --git a/projects/hip-tests/catch/unit/event/hipEventCreate.cc b/projects/hip-tests/catch/unit/event/hipEventCreate.cc index 30cad62c77..c4d355f533 100644 --- a/projects/hip-tests/catch/unit/event/hipEventCreate.cc +++ b/projects/hip-tests/catch/unit/event/hipEventCreate.cc @@ -19,13 +19,28 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipEventCreate_Positive - Test simple event creation with hipEventCreate api -*/ #include +/** + * @addtogroup hipEventCreate hipEventCreate + * @{ + * @ingroup EventTest + * `hipEventCreate(hipEvent_t* event)` - + * Create an event. + */ + +/** + * Test Description + * ------------------------ + * - Successfully creates and event for each device. + * Test source + * ------------------------ + * - unit/event/hipEventCreate.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventCreate_Positive") { int id = GENERATE(range(0, HipTest::getDeviceCount())); HIP_CHECK(hipSetDevice(id)); diff --git a/projects/hip-tests/catch/unit/event/hipEventCreateWithFlags.cc b/projects/hip-tests/catch/unit/event/hipEventCreateWithFlags.cc index 7f31c8e347..c758e12a55 100644 --- a/projects/hip-tests/catch/unit/event/hipEventCreateWithFlags.cc +++ b/projects/hip-tests/catch/unit/event/hipEventCreateWithFlags.cc @@ -19,13 +19,28 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipEventCreateWithFlags_Positive - Test simple event creation with hipEventCreateWithFlags api for each flag -*/ #include +/** + * @addtogroup hipEventCreateWithFlags hipEventCreateWithFlags + * @{ + * @ingroup EventTest + * `hipEventCreateWithFlags(hipEvent_t* event, unsigned flags)` - + * Create an event with the specified flags to control event behaviour. + */ + +/** + * Test Description + * ------------------------ + * - Successfully create an event with all defined device flags. + * Test source + * ------------------------ + * - unit/event/hipEventCreateWithFlags.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventCreateWithFlags_Positive") { #if HT_AMD diff --git a/projects/hip-tests/catch/unit/event/hipEventDestroy.cc b/projects/hip-tests/catch/unit/event/hipEventDestroy.cc index 8965d5227a..d62921f01b 100644 --- a/projects/hip-tests/catch/unit/event/hipEventDestroy.cc +++ b/projects/hip-tests/catch/unit/event/hipEventDestroy.cc @@ -26,12 +26,23 @@ THE SOFTWARE. #include #include "hip/hip_runtime_api.h" +/** + * @addtogroup hipEventDestroy hipEventDestroy + * @{ + * @ingroup EventTest + * `hipEventDestroy(hipEvent_t event)` - + * Destroy the specified event. + * ________________________ + * Test cases from other modules: + * - @ref Unit_hipEventIpc + */ + #if HT_AMD /* Disabled because frequency based wait is timing out on nvidia platforms */ static constexpr size_t vectorSize{1024}; -/** - * @brief Launches vectorAdd kernel with a delay +/* + * Launches vectorAdd kernel with a delay */ static inline void launchVectorAdd(float*& A_h, float*& B_h, float*& C_h, std::chrono::milliseconds delay, hipStream_t stream = nullptr) { @@ -46,10 +57,17 @@ static inline void launchVectorAdd(float*& A_h, float*& B_h, float*& C_h, HipTest::vectorADD<<<1, 1, 0, stream>>>(A_d, B_d, C_d, vectorSize); } - /** - * @brief Check that destroying an event before the kernel has finished running causes no errors. - * + * Test Description + * ------------------------ + * - Destroys the event before launched kernel has finished running. + * Test source + * ------------------------ + * - unit/event/hipEventDestroy.cc + * Test requirements + * ------------------------ + * - Platform specific (AMD) + * - HIP_VERSION >= 5.2 */ TEST_CASE("Unit_hipEventDestroy_Unfinished") { hipEvent_t event; @@ -69,8 +87,16 @@ TEST_CASE("Unit_hipEventDestroy_Unfinished") { } /** - * @brief Check that destroying an event enqueued to a stream causes no errors. - * + * Test Description + * ------------------------ + * - Destroys the event that is enqueued into a stream. + * Test source + * ------------------------ + * - unit/event/hipEventDestroy.cc + * Test requirements + * ------------------------ + * - Platform specific (AMD) + * - HIP_VERSION >= 5.2 */ TEST_CASE("Unit_hipEventDestroy_WithWaitingStream") { hipEvent_t event; @@ -94,6 +120,22 @@ TEST_CASE("Unit_hipEventDestroy_WithWaitingStream") { HipTest::freeArraysForHost(A_h, B_h, C_h, true); } +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When output pointer to the event is `nullptr` + * - Expected output: return `hipErrorInvalidResourceHandle` + * -# When event is destroyed twice + * - Expected output: return `hipErrorContextIsDestroyed` + * Test source + * ------------------------ + * - unit/event/hipEventDestroy.cc + * Test requirements + * ------------------------ + * - Platform specific (AMD) + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventDestroy_Negative") { SECTION("Invalid Event") { hipEvent_t event{nullptr}; diff --git a/projects/hip-tests/catch/unit/event/hipEventSynchronize.cc b/projects/hip-tests/catch/unit/event/hipEventSynchronize.cc index dc70323b15..76373eea31 100644 --- a/projects/hip-tests/catch/unit/event/hipEventSynchronize.cc +++ b/projects/hip-tests/catch/unit/event/hipEventSynchronize.cc @@ -19,17 +19,25 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipEventSynchronize_Default_Positive- Test synchronization of an event that is completed after a simple kernel launch (on null/created stream) -Unit_hipEventSynchronize_NoEventRecord_Positive - Test synchronization of an event that has not been recorded -*/ #include - #include #include +/** + * @addtogroup hipEventSynchronize hipEventSynchronize + * @{ + * @ingroup EventTest + * `hipEventSynchronize(hipEvent_t event)` - + * Wait for an event to complete. + * ________________________ + * Test cases from other modules: + * - @ref Unit_hipEventIpc + * - @ref Unit_hipEventMGpuMThreads_1 + * - @ref Unit_hipEventMGpuMThreads_2 + * - @ref Unit_hipEventMGpuMThreads_3 + */ + void testSynchronize(hipStream_t stream) { constexpr size_t N = 1024; @@ -70,6 +78,17 @@ void testSynchronize(hipStream_t stream) { HipTest::freeArrays(A_d, B_d, C_d, A_h, B_h, C_h, false); } +/** + * Test Description + * ------------------------ + * - Synchronization of an event that is completed after a simple kernel launch (on null/created stream). + * Test source + * ------------------------ + * - unit/event/hipEventSynchronize.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventSynchronize_Default_Positive") { hipStream_t stream{nullptr}; @@ -84,6 +103,17 @@ TEST_CASE("Unit_hipEventSynchronize_Default_Positive") { } } +/** + * Test Description + * ------------------------ + * - Synchronization of an event that has not been recorded. + * Test source + * ------------------------ + * - unit/event/hipEventSynchronize.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipEventSynchronize_NoEventRecord_Positive") { constexpr size_t N = 1024;