kfdtest: Update KFDCWSRTest for software scheduler and MES
Update KFDCWSRTest.BasicTest to run CWSR test with legacy HWS, MES, and software scheduler. Signed-off-by: Mukul Joshi <mukul.joshi@amd.com> Change-Id: I09af904507109c2bbbace6ff616a57fa2b1b8aa9
This commit is contained in:
committed by
Mukul Joshi
orang tua
52f5b666d6
melakukan
acd5eda54f
@@ -132,6 +132,14 @@ bool isOnEmulator() {
|
|||||||
return isEmuMode;
|
return isEmuMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint32_t checkCWSREnabled() {
|
||||||
|
uint32_t cwsr_enable = 0;
|
||||||
|
|
||||||
|
fscanf_dec("/sys/module/amdgpu/parameters/cwsr_enable", &cwsr_enable);
|
||||||
|
|
||||||
|
return cwsr_enable;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* KFDCWSRTest.BasicTest
|
* KFDCWSRTest.BasicTest
|
||||||
*
|
*
|
||||||
@@ -139,83 +147,68 @@ bool isOnEmulator() {
|
|||||||
* It then triggers CWSR and ensures the shader stops running.
|
* It then triggers CWSR and ensures the shader stops running.
|
||||||
* It then resumes the shader, ensures that it's running again and terminates it.
|
* It then resumes the shader, ensures that it's running again and terminates it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TEST_F(KFDCWSRTest, BasicTest) {
|
TEST_F(KFDCWSRTest, BasicTest) {
|
||||||
TEST_START(TESTPROFILE_RUNALL);
|
TEST_START(TESTPROFILE_RUNALL);
|
||||||
|
|
||||||
int defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
|
int defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
|
||||||
|
|
||||||
if (m_FamilyId >= FAMILY_VI) {
|
if ((m_FamilyId >= FAMILY_VI) && (checkCWSREnabled())) {
|
||||||
|
const char *pIterateIsa;
|
||||||
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
|
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
|
||||||
HsaMemoryBuffer resultBuf1(PAGE_SIZE, defaultGPUNode, true, false, false);
|
HsaMemoryBuffer resultBuf1(PAGE_SIZE, defaultGPUNode, true, false, false);
|
||||||
HsaMemoryBuffer resultBuf2(PAGE_SIZE, defaultGPUNode, true, false, false);
|
uint64_t count1 = 400000000;
|
||||||
|
|
||||||
int count1 = 40000000;
|
|
||||||
int count2 = 20000000;
|
|
||||||
|
|
||||||
if (isOnEmulator()) {
|
|
||||||
// Divide the iterator times by 1000 so that the test can
|
|
||||||
// finish in a reasonable time.
|
|
||||||
count1 /= 1000;
|
|
||||||
count2 /= 1000;
|
|
||||||
LOG() << "On Emulators" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int* result1 = resultBuf1.As<unsigned int*>();
|
|
||||||
unsigned int* result2 = resultBuf2.As<unsigned int*>();
|
|
||||||
const char *pIterateIsa;
|
|
||||||
|
|
||||||
if (m_FamilyId < FAMILY_AI)
|
if (m_FamilyId < FAMILY_AI)
|
||||||
pIterateIsa = iterate_isa_gfx8;
|
pIterateIsa = iterate_isa_gfx8;
|
||||||
else
|
else
|
||||||
pIterateIsa = iterate_isa_gfx9;
|
pIterateIsa = iterate_isa_gfx9;
|
||||||
|
|
||||||
|
if (isOnEmulator()) {
|
||||||
|
// Divide the iterator times by 10000 so that the test can
|
||||||
|
// finish in a reasonable time.
|
||||||
|
count1 /= 10000;
|
||||||
|
LOG() << "On Emulators" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int* result1 = resultBuf1.As<unsigned int*>();
|
||||||
|
|
||||||
m_pIsaGen->CompileShader(pIterateIsa, "iterate_isa", isaBuffer);
|
m_pIsaGen->CompileShader(pIterateIsa, "iterate_isa", isaBuffer);
|
||||||
|
|
||||||
PM4Queue queue1, queue2;
|
PM4Queue queue1;
|
||||||
|
|
||||||
ASSERT_SUCCESS(queue1.Create(defaultGPUNode));
|
ASSERT_SUCCESS(queue1.Create(defaultGPUNode));
|
||||||
|
|
||||||
Dispatch *dispatch1, *dispatch2;
|
Dispatch *dispatch1;
|
||||||
|
|
||||||
dispatch1 = new Dispatch(isaBuffer);
|
dispatch1 = new Dispatch(isaBuffer);
|
||||||
dispatch2 = new Dispatch(isaBuffer);
|
|
||||||
|
|
||||||
dispatch1->SetArgs(reinterpret_cast<void *>(count1), result1);
|
dispatch1->SetArgs(reinterpret_cast<void *>(count1), result1);
|
||||||
dispatch1->SetDim(wave_number, 1, 1);
|
dispatch1->SetDim(wave_number, 1, 1);
|
||||||
dispatch2->SetArgs(reinterpret_cast<void *>(count2), result2);
|
|
||||||
dispatch2->SetDim(wave_number, 1, 1);
|
|
||||||
|
|
||||||
// Submit the shader, queue1
|
// Submit the shader, queue1
|
||||||
dispatch1->Submit(queue1);
|
dispatch1->Submit(queue1);
|
||||||
// Create queue2 during queue1 still running will trigger the CWSR
|
|
||||||
ASSERT_SUCCESS(queue2.Create(defaultGPUNode));
|
//Give time for waves to launch before disabling queue.
|
||||||
// Submit the shader
|
Delay(1);
|
||||||
dispatch2->Submit(queue2);
|
EXPECT_SUCCESS(queue1.Update(0/*percentage*/, BaseQueue::DEFAULT_PRIORITY, false));
|
||||||
|
Delay(5);
|
||||||
|
EXPECT_SUCCESS(queue1.Update(100/*percentage*/, BaseQueue::DEFAULT_PRIORITY, false));
|
||||||
|
|
||||||
dispatch1->Sync();
|
dispatch1->Sync();
|
||||||
dispatch2->Sync();
|
|
||||||
// Ensure all the waves complete as expected
|
// Ensure all the waves complete as expected
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < wave_number; ++i) {
|
for (i = 0 ; i < wave_number; ++i) {
|
||||||
if (result1[i] != count1) {
|
if (result1[i] != count1) {
|
||||||
LOG() << "Dispatch 1, work item [" << std::dec << i << "] "
|
LOG() << "Dispatch 1, work item [" << std::dec << i << "] "
|
||||||
<< result1[i] << " != " << count1 << std::endl;
|
<< result1[i] << " != " << count1 << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (result2[i] != count2) {
|
|
||||||
LOG() << "Dispatch 2, work item [" << std::dec << i << "] "
|
|
||||||
<< result2[i] << " != " << count2 << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EXPECT_EQ(i, wave_number);
|
EXPECT_EQ(i, wave_number);
|
||||||
|
|
||||||
EXPECT_SUCCESS(queue1.Destroy());
|
EXPECT_SUCCESS(queue1.Destroy());
|
||||||
EXPECT_SUCCESS(queue2.Destroy());
|
|
||||||
|
|
||||||
delete dispatch1;
|
delete dispatch1;
|
||||||
delete dispatch2;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LOG() << "Skipping test: No CWSR present for family ID 0x" << m_FamilyId << "." << std::endl;
|
LOG() << "Skipping test: No CWSR present for family ID 0x" << m_FamilyId << "." << std::endl;
|
||||||
}
|
}
|
||||||
@@ -240,7 +233,7 @@ TEST_F(KFDCWSRTest, InterruptRestore) {
|
|||||||
|
|
||||||
int defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
|
int defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
|
||||||
|
|
||||||
if (m_FamilyId >= FAMILY_VI) {
|
if ((m_FamilyId >= FAMILY_VI) && (checkCWSREnabled())) {
|
||||||
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
|
HsaMemoryBuffer isaBuffer(PAGE_SIZE, defaultGPUNode, true/*zero*/, false/*local*/, true/*exec*/);
|
||||||
|
|
||||||
m_pIsaGen->CompileShader(infinite_isa, "infinite_isa", isaBuffer);
|
m_pIsaGen->CompileShader(infinite_isa, "infinite_isa", isaBuffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user