From d49fbe2475304799b69c83d5e9d99084eac9be90 Mon Sep 17 00:00:00 2001 From: Eric Huang Date: Thu, 5 Dec 2019 14:24:50 -0500 Subject: [PATCH] kfdtest: change baseline in BasicCuMaskingEven To keep normal performance, we have to use symmetrical cu masks based on shader engines. So change baseline from 1 cu to 1 cu per SE. Change-Id: I9e83a87fb670bb406f7983714fa0d8ab673609eb Signed-off-by: Eric Huang [ROCm/ROCR-Runtime commit: caa744944eb5c0cfa22471139d45041f96f30587] --- .../tests/kfdtest/src/KFDQMTest.cpp | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp b/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp index 2505cb3ba8..ae76fa1a47 100644 --- a/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp +++ b/projects/rocr-runtime/tests/kfdtest/src/KFDQMTest.cpp @@ -765,15 +765,24 @@ TEST_F(KFDQMTest, BasicCuMaskingEven) { int numCuPerShader = ActiveCU / numShaderEngines; double ratio; - /* Set Mask to 1 for a single CU */ - mask[0] = 0x1; - for (int i = 1; i < maskNumDwords; i++) - mask[i] = 0x0; + /* In KFD we symmetrically map mask to all SEs: + * mask[0] bit0 -> se0 cu0; + * mask[0] bit1 -> se1 cu0; + * ... (if # SE is 4) + * mask[0] bit4 -> se0 cu1; + * ... + */ + /* Set Mask to 1 CU per SE */ + memset(mask, 0, maskNumDwords * sizeof(uint32_t)); + for (int i = 0; i < numShaderEngines; i++) { + int maskIndex = (i / 32) % maskNumDwords; + mask[maskIndex] |= 1 << (i % 32); + } /* Execute once to get any HW optimizations out of the way */ TimeConsumedwithCUMask(defaultGPUNode, mask, maskNumBits); - LOG() << "Getting baseline performance numbers (1 CU)" << std::endl; + LOG() << "Getting baseline performance numbers (1 CU per SE)" << std::endl; TimewithCU1 = GetAverageTimeConsumedwithCUMask(defaultGPUNode, mask, maskNumBits, 3); /* Each loop will add 1 more CU per SE. We use the mod and divide to handle @@ -786,12 +795,12 @@ TEST_F(KFDQMTest, BasicCuMaskingEven) { int maskIndex = (offset / 32) % maskNumDwords; mask[maskIndex] |= 1 << (offset % 32); } - int nCUs = numShaderEngines * (x + 1); + int nCUs = x + 1; TimewithCU = TimeConsumedwithCUMask(defaultGPUNode, mask, maskNumBits); ratio = (double)(TimewithCU1) / ((double)(TimewithCU) * nCUs); - LOG() << "Expected performance of " << nCUs << " CUs vs 1 CU:" << std::endl; + LOG() << "Expected performance of " << nCUs << " CU(s)/SE vs 1 CU/SE:" << std::endl; LOG() << std::setprecision(2) << CuNegVariance << " <= " << std::fixed << std::setprecision(8) << ratio << " <= " << std::setprecision(2) << CuPosVariance << std::endl;