EXSWHTEC-224 - Test cases ID clean up and documentation for Event Management (#71)
- Test cases ID clean up and documentation for Event Management
[ROCm/hip-tests commit: 3969e4a320]
This commit is contained in:
gecommit door
GitHub
bovenliggende
a8f65237eb
commit
b2829b49de
@@ -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
|
||||
* @{
|
||||
|
||||
@@ -26,6 +26,12 @@ THE SOFTWARE.
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -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 <hip_test_common.hh>
|
||||
|
||||
#include <hip_test_checkers.hh>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* @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));
|
||||
|
||||
@@ -27,7 +27,23 @@ THE SOFTWARE.
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
/**
|
||||
* @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;
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
#include <ratio>
|
||||
#include <chrono>
|
||||
|
||||
/**
|
||||
* @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));
|
||||
|
||||
@@ -19,6 +19,17 @@ THE SOFTWARE.
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
/**
|
||||
* @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));
|
||||
|
||||
@@ -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 <hip_test_common.hh>
|
||||
|
||||
@@ -32,6 +26,33 @@ Unit_hipEventRecord_Negative - Test unsuccessful hipEventRecord when event is pa
|
||||
#include <hip_test_checkers.hh>
|
||||
#include <hip_test_context.hh>
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
@@ -31,31 +31,71 @@ Unit_hipEventCreate_IncompatibleFlags - Test unsuccessful event creation when in
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
@@ -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 <hip_test_common.hh>
|
||||
|
||||
/**
|
||||
* @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));
|
||||
|
||||
@@ -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 <hip_test_common.hh>
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
@@ -26,12 +26,23 @@ THE SOFTWARE.
|
||||
#include <hip_test_common.hh>
|
||||
#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};
|
||||
|
||||
@@ -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 <hip_test_common.hh>
|
||||
|
||||
#include <kernels.hh>
|
||||
#include <hip_test_checkers.hh>
|
||||
|
||||
/**
|
||||
* @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;
|
||||
|
||||
|
||||
Verwijs in nieuw issue
Block a user