diff --git a/tests/kfdtest/src/KFDQMTest.cpp b/tests/kfdtest/src/KFDQMTest.cpp index b5ab04bc63..2505cb3ba8 100644 --- a/tests/kfdtest/src/KFDQMTest.cpp +++ b/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();