kfdtest: Updated CWSR test for emulation

Added global flag g_IsEmuMode and set it when running under emulator.
Adjusted delays in KFDCWSRTest for emulator.

Change-Id: Ia5c0be40816ac2219add943e306ee16438f5b852
Signed-off-by: David Belanger <david.belanger@amd.com>
This commit is contained in:
David Belanger
2023-11-13 12:22:21 -05:00
committad av Harish Kasiviswanathan
förälder f75fddb9bd
incheckning 3dd98d075f
5 ändrade filer med 23 tillägg och 3 borttagningar
+5 -3
Visa fil
@@ -80,6 +80,8 @@ TEST_P(KFDCWSRTest, BasicTest) {
int num_witems = std::get<0>(GetParam());
int cwsr_thresh = std::get<1>(GetParam());
int defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
// Increase delay on emulator by this factor.
const int delayMult = (g_IsEmuMode ? 20 : 1);
if ((m_FamilyId >= FAMILY_VI) && (checkCWSREnabled())) {
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true, false, true);
@@ -106,7 +108,7 @@ TEST_P(KFDCWSRTest, BasicTest) {
dispatch.SetDim(num_witems, 1, 1);
dispatch.Submit(queue);
Delay(5);
Delay(5 * delayMult);
LOG() << "Starting iteration for " << std::dec << num_witems
<< " work items(s) (targeting " << std::dec << cwsr_thresh
@@ -117,12 +119,12 @@ TEST_P(KFDCWSRTest, BasicTest) {
// Send dequeue request
EXPECT_SUCCESS(queue.Update(0, BaseQueue::DEFAULT_PRIORITY, false));
Delay(5);
Delay(5 * delayMult);
// Send requeue request
EXPECT_SUCCESS(queue.Update(100, BaseQueue::DEFAULT_PRIORITY, false));
Delay(50);
Delay(50 * delayMult);
// Check for reg mangling
for (int i = 0; i < num_witems; i++) {
+1
Visa fil
@@ -30,6 +30,7 @@ extern unsigned int g_TestTimeOut;
extern int g_TestNodeId;
extern int g_TestDstNodeId;
extern bool g_IsChildProcess;
extern bool g_IsEmuMode;
// Each test should call TEST_START with the test custom profile and HW scheduling
enum TESTPROFILE{
+8
Visa fil
@@ -53,6 +53,7 @@ unsigned int g_TestTimeOut;
int g_TestNodeId;
int g_TestDstNodeId;
bool g_IsChildProcess;
bool g_IsEmuMode;
unsigned int g_SleepTime;
unsigned int g_TestGPUFamilyId;
class KFDBaseComponentTest *g_baseTest;
@@ -90,8 +91,15 @@ GTEST_API_ int main(int argc, char **argv) {
g_TestNodeId = args.NodeId;
g_TestDstNodeId = args.DstNodeId;
g_IsEmuMode = CheckEmuModeEnabled();
LOG() << "Profile: " << (TESTPROFILE)g_TestRunProfile << std::endl;
LOG() << "HW capabilities: 0x" << std::hex << g_TestENVCaps << std::endl;
if (g_IsEmuMode)
{
LOG() << "Emulation Mode Enabled" << std::endl;
}
if (g_SleepTime > 0) {
LOG() << "Sleep time in seconds as specified by user: " << std::dec << g_SleepTime << std::endl;
}
+7
Visa fil
@@ -95,6 +95,13 @@ void SplitU64(const HSAuint64 value, unsigned int& rLoPart, unsigned int& rHiPar
rHiPart = static_cast<unsigned int>(value >> 32);
}
bool CheckEmuModeEnabled()
{
uint32_t emu_mode = false;
fscanf_dec("/sys/module/amdgpu/parameters/emu_mode", &emu_mode);
return (emu_mode != 0);
}
bool GetHwCapabilityHWS() {
unsigned int value = 0;
bool valExists = ReadDriverConfigValue(CONFIG_HWS, value);
+2
Visa fil
@@ -44,6 +44,8 @@ bool WaitOnValue(const volatile unsigned int *buf, unsigned int value, unsigned
void SplitU64(const HSAuint64 value, unsigned int& rLoPart, unsigned int& rHiPart);
bool CheckEmuModeEnabled();
bool GetHwCapabilityHWS();
HSAKMT_STATUS CreateQueueTypeEvent(bool ManualReset, bool IsSignaled, unsigned int NodeId, HsaEvent** Event);