SWDEV-337452 - Changing Clock64 to WallClock64 in tests for gfx11. (#78)

Change-Id: I484fe9ff7cd56c70a37a3ac5a4a55812f8557259


[ROCm/hip-tests commit: 87fac87657]
This commit is contained in:
ROCm CI Service Account
2023-01-07 04:35:21 +05:30
committed by GitHub
parent 9bc91a13b2
commit d8b7cb28ff
10 changed files with 339 additions and 50 deletions
@@ -34,6 +34,20 @@ __global__ void waitKernel(int clockRate, int seconds) {
}
}
__global__ void waitKernel_gfx11(int clockRate, int seconds) {
#if HT_AMD
auto start = wall_clock64();
auto ms = seconds * 1000;
long long waitTill = clockRate * (long long)ms;
while (1) {
auto end = wall_clock64();
if ((end - start) > waitTill) {
return;
}
}
#endif
}
TEST_CASE("Unit_hipEventQuery_DifferentDevice") {
hipEvent_t event1{}, event2{};
HIP_CHECK(hipEventCreate(&event1));
@@ -54,9 +68,10 @@ TEST_CASE("Unit_hipEventQuery_DifferentDevice") {
HIP_CHECK(hipSetDevice(0));
HIP_CHECK(hipEventRecord(event1, stream));
auto waitKernel_used = IsGfx11() ? waitKernel_gfx11 : waitKernel;
// Start kernel and wait for 3 seconds
// Make sure you increase this time if you add more tests here
waitKernel<<<1, 1, 0, stream>>>(clockRate, 3);
waitKernel_used<<<1, 1, 0, stream>>>(clockRate, 3);
HIP_CHECK(hipEventRecord(event2, stream));