From ee8ab015dd1f70d0ff217eb0376837ab9fbbafa8 Mon Sep 17 00:00:00 2001 From: Yong Zhao Date: Tue, 26 Nov 2019 17:34:36 -0500 Subject: [PATCH] kfdtest: Add some logs to Atomics test This will help us triage the unexpected hangs on the farm systems. Meanwhile, simplify the logic. Change-Id: Ie50b97a34cb86891720dce11f2d178bff9aa2cd5 Signed-off-by: Yong Zhao [ROCm/ROCR-Runtime commit: 8f140fc03dfc008eb26a41206087f0cc8a028d9f] --- .../tests/kfdtest/src/KFDQMTest.cpp | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp b/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp index b5ab04bc63..2505cb3ba8 100644 --- a/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp +++ b/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp @@ -1331,20 +1331,19 @@ TEST_F(KFDQMTest, SdmaQueueWraparound) { struct AtomicIncThreadParams { HSAint64* pDest; volatile unsigned int count; - volatile bool stop; + volatile bool loop; }; unsigned int AtomicIncThread(void* pCtx) { AtomicIncThreadParams* pArgs = reinterpret_cast(pCtx); - while (pArgs->stop) - {} - - while (!pArgs->stop) { + while (pArgs->loop) { AtomicInc(pArgs->pDest); ++pArgs->count; } + LOG() << "CPU atomic increments finished" << std::endl; + return 0; } @@ -1375,28 +1374,31 @@ TEST_F(KFDQMTest, Atomics) { AtomicIncThreadParams params; params.pDest = destBuf.As(); - params.stop = true; + params.loop = true; params.count = 0; uint64_t threadId; ASSERT_EQ(true, StartThread(&AtomicIncThread, ¶ms, threadId)); - params.stop = false; + LOG() << "Waiting for CPU to atomic increment 1000 times" << std::endl; - while (params.count == 0) + while (params.count < 1000) {} + LOG() << "Submitting the GPU atomic increment shader" << std::endl; + dispatch.Submit(queue); dispatch.Sync(); - params.stop = true; + params.loop = false; WaitForThread(threadId); EXPECT_EQ(destBuf.As()[0], 1024 + params.count); - LOG() << "GPU increments: 1024, CPU increments: " << params.count << std::endl; + LOG() << "GPU increments: 1024, CPU increments: " << std::dec + << params.count << std::endl; queue.Destroy();