SWDEV-408958 - Use LaunchDelayKernel and modify it to use same kernel based on real time clock for gfx10 and gfx11. (#370)
Change-Id: Iea8a48e8cbfa1745c7d5535dc5820133a4104087
This commit is contained in:
committed by
GitHub
parent
faa2dd7cfb
commit
04080c2e2e
@@ -23,7 +23,7 @@ THE SOFTWARE.
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip_test_checkers.hh>
|
||||
#include <iostream>
|
||||
|
||||
#include <utils.hh>
|
||||
/**
|
||||
* @addtogroup hipEventElapsedTime hipEventElapsedTime
|
||||
* @{
|
||||
@@ -158,10 +158,7 @@ TEST_CASE("Unit_hipEventElapsedTime_NotReady_Negative") {
|
||||
// Record start event
|
||||
HIP_CHECK(hipEventRecord(start, nullptr));
|
||||
|
||||
HipTest::BlockingContext b_context{nullptr};
|
||||
b_context.block_stream(); // blocked stream
|
||||
REQUIRE(b_context.is_blocked());
|
||||
|
||||
LaunchDelayKernel(std::chrono::milliseconds(1000));
|
||||
// Record stop event
|
||||
HIP_CHECK(hipEventRecord(stop, nullptr));
|
||||
|
||||
@@ -169,7 +166,6 @@ TEST_CASE("Unit_hipEventElapsedTime_NotReady_Negative") {
|
||||
float tElapsed = 1.0f;
|
||||
HIP_CHECK_ERROR(hipEventQuery(stop), hipErrorNotReady);
|
||||
HIP_ASSERT(hipEventElapsedTime(&tElapsed, start, stop) == hipErrorNotReady);
|
||||
b_context.unblock_stream();
|
||||
|
||||
HIP_CHECK(hipStreamSynchronize(nullptr));
|
||||
HIP_CHECK(hipEventDestroy(start));
|
||||
|
||||
@@ -18,7 +18,29 @@ THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <utils.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
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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));
|
||||
@@ -30,15 +52,10 @@ TEST_CASE("Unit_hipEventQuery_DifferentDevice") {
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
REQUIRE(stream != nullptr);
|
||||
|
||||
HipTest::BlockingContext b_context1{stream}; // og context
|
||||
// Block stream
|
||||
{
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
HIP_CHECK(hipEventRecord(event1, stream));
|
||||
|
||||
b_context1.block_stream(); // blocked stream
|
||||
REQUIRE(b_context1.is_blocked());
|
||||
|
||||
LaunchDelayKernel(std::chrono::milliseconds(3000), stream);
|
||||
HIP_CHECK(hipEventRecord(event2, stream));
|
||||
|
||||
HIP_CHECK(hipEventSynchronize(event1));
|
||||
@@ -58,8 +75,6 @@ TEST_CASE("Unit_hipEventQuery_DifferentDevice") {
|
||||
HIP_CHECK(hipEventQuery(event1));
|
||||
HIP_CHECK_ERROR(hipEventQuery(event2), hipErrorNotReady);
|
||||
|
||||
b_context1.unblock_stream();
|
||||
|
||||
HIP_CHECK(hipEventSynchronize(event2));
|
||||
|
||||
// Query, should be done now
|
||||
|
||||
@@ -25,7 +25,7 @@ THE SOFTWARE.
|
||||
#include <hip_test_kernels.hh>
|
||||
#include <hip_test_common.hh>
|
||||
#include "hip/hip_runtime_api.h"
|
||||
|
||||
#include <utils.hh>
|
||||
/**
|
||||
* @addtogroup hipEventDestroy hipEventDestroy
|
||||
* @{
|
||||
@@ -53,7 +53,7 @@ static inline void launchVectorAdd(float*& A_h, float*& B_h, float*& C_h,
|
||||
HIP_CHECK(hipHostGetDevicePointer(reinterpret_cast<void**>(&A_d), A_h, 0));
|
||||
HIP_CHECK(hipHostGetDevicePointer(reinterpret_cast<void**>(&B_d), B_h, 0));
|
||||
HIP_CHECK(hipHostGetDevicePointer(reinterpret_cast<void**>(&C_d), C_h, 0));
|
||||
HipTest::runKernelForDuration(delay, stream);
|
||||
LaunchDelayKernel(delay, stream);
|
||||
HipTest::vectorADD<<<1, 1, 0, stream>>>(A_d, B_d, C_d, vectorSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user