From 54388cabdc00c6a499fe51c5aacc57aceecfa1a9 Mon Sep 17 00:00:00 2001 From: Oak Zeng Date: Mon, 27 May 2019 14:57:57 -0500 Subject: [PATCH] Fix HostHdpFlush shader 1. Use s_mov_b32 to move 0xcafe to s18. s_movk_i32 is a sign extention move instruction. Oxcafe will be extended to 0xffffcafe which is not desired 2. Add wait to s_load_dword instruction to make sure memory read finish before the next store instruction. Change-Id: I665d1d471019edfaba5693e07cdc567d4103573f Signed-off-by: Oak Zeng [ROCm/ROCR-Runtime commit: 5d163cd82181ab2b8b1c8adb4f465eec52a0c91a] --- .../rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp b/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp index 99f53563cd..ad1b24a6f4 100644 --- a/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp +++ b/projects/rocr-runtime/tests/kfdtest/src/KFDMemoryTest.cpp @@ -121,13 +121,15 @@ shader CopyOnSignal\n\ asic(GFX9)\n\ type(CS)\n\ /* Assume input buffer in s0, s1 */\n\ - s_movk_i32 s18, 0xcafe\n\ - POLLSIGNAL:\n\ + s_mov_b32 s18, 0xcafe\n\ +POLLSIGNAL:\n\ s_load_dword s16, s[0:1], 0x0 glc\n\ s_cmp_eq_i32 s16, s18\n\ s_cbranch_scc0 POLLSIGNAL\n\ s_load_dword s17, s[0:1], 0x4 glc\n\ + s_waitcnt vmcnt(0) & lgkmcnt(0)\n\ s_store_dword s17, s[0:1], 0x8 glc\n\ + s_waitcnt vmcnt(0) & lgkmcnt(0)\n\ s_endpgm\n\ end\n\ "; @@ -1794,7 +1796,7 @@ TEST_F(KFDMemoryTest, HostHdpFlush) { for (unsigned int bank = 0; bank < pNodeProperties->NumMemoryBanks; bank++) { if (memoryProperties[bank].HeapType == HSA_HEAPTYPE_MMIO_REMAP) { mmioBase = (unsigned int *)memoryProperties[bank].VirtualBaseAddress; - break; + break; } } ASSERT_NE(mmioBase, nullPtr) << "mmio base is NULL"; @@ -1821,11 +1823,11 @@ TEST_F(KFDMemoryTest, HostHdpFlush) { buffer[1] = 0xbeef; /* Flush HDP */ mmioBase[KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL/4] = 0x1; - /* Give cafe to wake up */ buffer[0] = 0xcafe; /* Check test result*/ dispatch0.Sync(); + mmioBase[KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL/4] = 0x1; EXPECT_EQ(0xbeef, buffer[2]); // Clean up