kfdtest: Replace pthread with std::thread (#1448)
* kfdtest: Replace pthread with std::thread Modify concurrent kfdtest to use std::thread instead of pthread, eventually modify KFDTestLaunch to take in a member function of test instance instead of static function. Convert KFDQMTest to pass in member function for multi-gpu kfdtest. * kfdtest: Convert KFDPerfCountersTest to use std::thread Convert KFDPerfCountersTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDGraphicsInterop to use std::thread Convert KFDGraphicsInterop to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDGWSTest to use std::thread Convert KFDGWSTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDCWSRTest to use std::thread Convert KFDCWSRTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDEventTest to use std::thread Convert KFDEventTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDExceptionTest to use std::thread Convert KFDExceptionTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDLocalMemoryTest to use std::thread Convert KFDLocalMemoryTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDMemoryTest to use std::thread Convert KFDMemoryTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDSVMRangeTest to use std::thread Convert KFDSVMRangeTest to use std::thread for multi-gpu kfdtest. * kfdtest: Convert KFDHWSTest to use std::thread Convert KFDHWSTest to use std::thread for multi-gpu kfdtest. * kfdtest: Remove pthread multigpu test structure Remove older multi-gpu test framework which uses pthread.
Этот коммит содержится в:
@@ -171,12 +171,9 @@ queuefail:
|
||||
queue.Destroy();
|
||||
}
|
||||
|
||||
void AddressFault(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
void KFDExceptionTest::AddressFault(int gpuNode) {
|
||||
|
||||
int gpuNode = pTestParamters->gpuNode;
|
||||
KFDExceptionTest* pKFDExceptionTest = (KFDExceptionTest*)pTestParamters->pTestObject;
|
||||
|
||||
const HSAuint32 m_FamilyId = pKFDExceptionTest->GetFamilyIdFromNodeId(gpuNode);
|
||||
const HSAuint32 m_FamilyId = GetFamilyIdFromNodeId(gpuNode);
|
||||
if (m_FamilyId == FAMILY_RV) {
|
||||
LOG() << "Skipping test: IOMMU issues on Raven." << std::endl;
|
||||
return;
|
||||
@@ -184,13 +181,13 @@ void AddressFault(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
|
||||
pid_t m_ChildPid = fork();
|
||||
if (m_ChildPid == 0) {
|
||||
pKFDExceptionTest->TearDown();
|
||||
pKFDExceptionTest->SetUp();
|
||||
TearDown();
|
||||
SetUp();
|
||||
|
||||
HsaMemoryBuffer srcBuffer(PAGE_SIZE, gpuNode, false);
|
||||
|
||||
srcBuffer.Fill(0xAA55AA55);
|
||||
pKFDExceptionTest->TestMemoryException(gpuNode, srcBuffer.As<HSAuint64>(),
|
||||
TestMemoryException(gpuNode, srcBuffer.As<HSAuint64>(),
|
||||
0x12345678ULL);
|
||||
exit(0);
|
||||
|
||||
@@ -213,7 +210,9 @@ TEST_F(KFDExceptionTest, AddressFault) {
|
||||
TEST_REQUIRE_ENV_CAPABILITIES(ENVCAPS_64BITLINUX);
|
||||
TEST_START(TESTPROFILE_RUNALL);
|
||||
|
||||
ASSERT_SUCCESS(KFDTest_Launch(AddressFault));
|
||||
ASSERT_SUCCESS(KFDTestLaunch([this](int gpuNode) {
|
||||
this->AddressFault(gpuNode);
|
||||
}));
|
||||
|
||||
TEST_END
|
||||
}
|
||||
@@ -221,12 +220,9 @@ TEST_F(KFDExceptionTest, AddressFault) {
|
||||
/* Allocate Read Only buffer. Test Memory Exception failure by
|
||||
* attempting to write to that buffer in the child process.
|
||||
*/
|
||||
void PermissionFault(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
void KFDExceptionTest::PermissionFault(int gpuNode) {
|
||||
|
||||
int gpuNode = pTestParamters->gpuNode;
|
||||
KFDExceptionTest* pKFDExceptionTest = (KFDExceptionTest*)pTestParamters->pTestObject;
|
||||
|
||||
const HSAuint32 m_FamilyId = pKFDExceptionTest->GetFamilyIdFromNodeId(gpuNode);
|
||||
const HSAuint32 m_FamilyId = GetFamilyIdFromNodeId(gpuNode);
|
||||
if (m_FamilyId == FAMILY_RV) {
|
||||
LOG() << "Skipping test: IOMMU issues on Raven." << std::endl;
|
||||
return;
|
||||
@@ -234,8 +230,8 @@ void PermissionFault(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
|
||||
pid_t m_ChildPid = fork();
|
||||
if (m_ChildPid == 0) {
|
||||
pKFDExceptionTest->TearDown();
|
||||
pKFDExceptionTest->SetUp();
|
||||
TearDown();
|
||||
SetUp();
|
||||
|
||||
HsaMemoryBuffer readOnlyBuffer(PAGE_SIZE, gpuNode, false /*zero*/,
|
||||
false /*isLocal*/, true /*isExec*/,
|
||||
@@ -244,7 +240,7 @@ void PermissionFault(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
|
||||
srcSysBuffer.Fill(0xAA55AA55);
|
||||
|
||||
pKFDExceptionTest->TestMemoryException(gpuNode, srcSysBuffer.As<HSAuint64>(),
|
||||
TestMemoryException(gpuNode, srcSysBuffer.As<HSAuint64>(),
|
||||
readOnlyBuffer.As<HSAuint64>());
|
||||
|
||||
exit(0);
|
||||
@@ -267,7 +263,9 @@ TEST_F(KFDExceptionTest, PermissionFault) {
|
||||
TEST_REQUIRE_ENV_CAPABILITIES(ENVCAPS_64BITLINUX);
|
||||
TEST_START(TESTPROFILE_RUNALL)
|
||||
|
||||
ASSERT_SUCCESS(KFDTest_Launch(PermissionFault));
|
||||
ASSERT_SUCCESS(KFDTestLaunch([this](int gpuNode) {
|
||||
this->PermissionFault(gpuNode);
|
||||
}));
|
||||
|
||||
TEST_END
|
||||
}
|
||||
@@ -275,12 +273,9 @@ TEST_F(KFDExceptionTest, PermissionFault) {
|
||||
/* Allocate Read Only user pointer buffer. Test Memory Exception failure by
|
||||
* attempting to write to that buffer in the child process.
|
||||
*/
|
||||
void PermissionFaultUserPointer(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
void KFDExceptionTest::PermissionFaultUserPointer(int gpuNode) {
|
||||
|
||||
int gpuNode = pTestParamters->gpuNode;
|
||||
KFDExceptionTest* pKFDExceptionTest = (KFDExceptionTest*)pTestParamters->pTestObject;
|
||||
|
||||
const HSAuint32 m_FamilyId = pKFDExceptionTest->GetFamilyIdFromNodeId(gpuNode);
|
||||
const HSAuint32 m_FamilyId = GetFamilyIdFromNodeId(gpuNode);
|
||||
if (m_FamilyId == FAMILY_RV) {
|
||||
LOG() << "Skipping test: IOMMU issues on Raven." << std::endl;
|
||||
return;
|
||||
@@ -288,8 +283,8 @@ void PermissionFaultUserPointer(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
|
||||
pid_t m_ChildPid = fork();
|
||||
if (m_ChildPid == 0) {
|
||||
pKFDExceptionTest->TearDown();
|
||||
pKFDExceptionTest->SetUp();
|
||||
TearDown();
|
||||
SetUp();
|
||||
|
||||
void *pBuf = mmap(NULL, PAGE_SIZE, PROT_READ,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
@@ -300,7 +295,7 @@ void PermissionFaultUserPointer(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
|
||||
srcSysBuffer.Fill(0xAA55AA55);
|
||||
|
||||
pKFDExceptionTest->TestMemoryException(gpuNode, srcSysBuffer.As<HSAuint64>(),
|
||||
TestMemoryException(gpuNode, srcSysBuffer.As<HSAuint64>(),
|
||||
(HSAuint64)pBuf);
|
||||
|
||||
exit(0);
|
||||
@@ -323,7 +318,9 @@ TEST_F(KFDExceptionTest, PermissionFaultUserPointer) {
|
||||
TEST_REQUIRE_ENV_CAPABILITIES(ENVCAPS_64BITLINUX);
|
||||
TEST_START(TESTPROFILE_RUNALL)
|
||||
|
||||
ASSERT_SUCCESS(KFDTest_Launch(PermissionFault));
|
||||
ASSERT_SUCCESS(KFDTestLaunch([this](int gpuNode) {
|
||||
this->PermissionFaultUserPointer(gpuNode);
|
||||
}));
|
||||
|
||||
TEST_END
|
||||
}
|
||||
@@ -331,12 +328,9 @@ TEST_F(KFDExceptionTest, PermissionFaultUserPointer) {
|
||||
/* Test VM fault storm handling by copying to/from invalid pointers
|
||||
* with lots of work items at the same time
|
||||
*/
|
||||
void FaultStorm(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
void KFDExceptionTest::FaultStorm(int gpuNode) {
|
||||
|
||||
int gpuNode = pTestParamters->gpuNode;
|
||||
KFDExceptionTest* pKFDExceptionTest = (KFDExceptionTest*)pTestParamters->pTestObject;
|
||||
|
||||
const HSAuint32 m_FamilyId = pKFDExceptionTest->GetFamilyIdFromNodeId(gpuNode);
|
||||
const HSAuint32 m_FamilyId = GetFamilyIdFromNodeId(gpuNode);
|
||||
if (m_FamilyId == FAMILY_RV) {
|
||||
LOG() << "Skipping test: IOMMU issues on Raven." << std::endl;
|
||||
return;
|
||||
@@ -346,10 +340,10 @@ void FaultStorm(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
|
||||
pid_t m_ChildPid = fork();
|
||||
if (m_ChildPid == 0) {
|
||||
pKFDExceptionTest->TearDown();
|
||||
pKFDExceptionTest->SetUp();
|
||||
TearDown();
|
||||
SetUp();
|
||||
|
||||
pKFDExceptionTest->TestMemoryException(gpuNode, 0x12345678, 0x76543210, 1024, 1024, 1);
|
||||
TestMemoryException(gpuNode, 0x12345678, 0x76543210, 1024, 1024, 1);
|
||||
|
||||
exit(0);
|
||||
} else {
|
||||
@@ -371,19 +365,18 @@ TEST_F(KFDExceptionTest, FaultStorm) {
|
||||
TEST_REQUIRE_ENV_CAPABILITIES(ENVCAPS_64BITLINUX);
|
||||
TEST_START(TESTPROFILE_RUNALL)
|
||||
|
||||
ASSERT_SUCCESS(KFDTest_Launch(FaultStorm));
|
||||
ASSERT_SUCCESS(KFDTestLaunch([this](int gpuNode) {
|
||||
this->FaultStorm(gpuNode);
|
||||
}));
|
||||
|
||||
TEST_END
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
void SdmaQueueException(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
void KFDExceptionTest::SdmaQueueException(int gpuNode) {
|
||||
|
||||
int gpuNode = pTestParamters->gpuNode;
|
||||
KFDExceptionTest* pKFDExceptionTest = (KFDExceptionTest*)pTestParamters->pTestObject;
|
||||
|
||||
const HSAuint32 m_FamilyId = pKFDExceptionTest->GetFamilyIdFromNodeId(gpuNode);
|
||||
const HSAuint32 m_FamilyId = GetFamilyIdFromNodeId(gpuNode);
|
||||
if (m_FamilyId == FAMILY_RV) {
|
||||
LOG() << "Skipping test: IOMMU issues on Raven." << std::endl;
|
||||
return;
|
||||
@@ -396,8 +389,8 @@ void SdmaQueueException(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
unsigned int* pDb = NULL;
|
||||
unsigned int *nullPtr = NULL;
|
||||
|
||||
pKFDExceptionTest->TearDown();
|
||||
pKFDExceptionTest->SetUp();
|
||||
TearDown();
|
||||
SetUp();
|
||||
|
||||
HsaMemFlags m_MemoryFlags;
|
||||
m_MemoryFlags.Value = 0;
|
||||
@@ -411,7 +404,7 @@ void SdmaQueueException(KFDTEST_PARAMETERS* pTestParamters) {
|
||||
ASSERT_SUCCESS_GPU(hsaKmtMapMemoryToGPU(pDb, PAGE_SIZE, NULL), gpuNode);
|
||||
EXPECT_SUCCESS_GPU(hsaKmtUnmapMemoryToGPU(pDb), gpuNode);
|
||||
|
||||
pKFDExceptionTest->TestSdmaException(gpuNode, pDb);
|
||||
TestSdmaException(gpuNode, pDb);
|
||||
EXPECT_SUCCESS_GPU(hsaKmtFreeMemory(pDb, PAGE_SIZE), gpuNode);
|
||||
|
||||
exit(0);
|
||||
@@ -433,7 +426,9 @@ TEST_F(KFDExceptionTest, SdmaQueueException) {
|
||||
TEST_REQUIRE_ENV_CAPABILITIES(ENVCAPS_64BITLINUX);
|
||||
TEST_START(TESTPROFILE_RUNALL)
|
||||
|
||||
ASSERT_SUCCESS(KFDTest_Launch(SdmaQueueException));
|
||||
ASSERT_SUCCESS(KFDTestLaunch([this](int gpuNode) {
|
||||
this->SdmaQueueException(gpuNode);
|
||||
}));
|
||||
|
||||
TEST_END
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user