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.
Цей коміт міститься в:
Alysa Liu
2025-12-02 10:25:21 -05:00
зафіксовано GitHub
джерело 81df45d896
коміт 3a7b5571c0
24 змінених файлів з 851 додано та 833 видалено
+14 -16
Переглянути файл
@@ -76,19 +76,16 @@ static inline uint32_t checkCWSREnabled() {
* 3: 1024 work-items (multi-wave), CWSR threshold of 1000
*/
static void BasicTest(KFDTEST_PARAMETERS* pTestParamters) {
void KFDCWSRTest::BasicTest(int gpuNode) {
int gpuNode = pTestParamters->gpuNode;
KFDCWSRTest* pKFDCWSRTest = (KFDCWSRTest*)pTestParamters->pTestObject;
const HSAuint32 m_FamilyId = pKFDCWSRTest->GetFamilyIdFromNodeId(gpuNode);
const HSAuint32 m_FamilyId = GetFamilyIdFromNodeId(gpuNode);
Assembler* m_pAsm;
m_pAsm = pKFDCWSRTest->GetAssemblerFromNodeId(gpuNode);
m_pAsm = GetAssemblerFromNodeId(gpuNode);
ASSERT_NOTNULL_GPU(m_pAsm, gpuNode);
int num_witems = std::get<0>(pKFDCWSRTest->GetParam());
int cwsr_thresh = std::get<1>(pKFDCWSRTest->GetParam());
int num_witems = std::get<0>(GetParam());
int cwsr_thresh = std::get<1>(GetParam());
// Increase delay on emulator by this factor.
const int delayMult = (g_IsEmuMode ? 20 : 1);
@@ -160,7 +157,9 @@ static void BasicTest(KFDTEST_PARAMETERS* pTestParamters) {
TEST_P(KFDCWSRTest, BasicTest) {
TEST_START(TESTPROFILE_RUNALL);
ASSERT_SUCCESS(KFDTest_Launch(BasicTest));
ASSERT_SUCCESS(KFDTestLaunch([this](int gpuNode) {
this->BasicTest(gpuNode);
}));
TEST_END
}
@@ -194,15 +193,12 @@ INSTANTIATE_TEST_CASE_P(
* Preempt runlist. One or both queues must interrupt context restore to preempt.
*/
static void InterruptRestore(KFDTEST_PARAMETERS* pTestParamters) {
void KFDCWSRTest::InterruptRestore(int gpuNode) {
int gpuNode = pTestParamters->gpuNode;
KFDCWSRTest* pKFDCWSRTest = (KFDCWSRTest*)pTestParamters->pTestObject;
const HSAuint32 m_FamilyId = pKFDCWSRTest->GetFamilyIdFromNodeId(gpuNode);
const HSAuint32 m_FamilyId = GetFamilyIdFromNodeId(gpuNode);
Assembler* m_pAsm;
m_pAsm = pKFDCWSRTest->GetAssemblerFromNodeId(gpuNode);
m_pAsm = GetAssemblerFromNodeId(gpuNode);
ASSERT_NOTNULL_GPU(m_pAsm, gpuNode);
if ((m_FamilyId >= FAMILY_VI) && (checkCWSREnabled())) {
@@ -248,7 +244,9 @@ static void InterruptRestore(KFDTEST_PARAMETERS* pTestParamters) {
TEST_F(KFDCWSRTest, InterruptRestore) {
TEST_START(TESTPROFILE_RUNALL);
ASSERT_SUCCESS(KFDTest_Launch(InterruptRestore));
ASSERT_SUCCESS(KFDTestLaunch([this](int gpuNode) {
this->InterruptRestore(gpuNode);
}));
TEST_END
}