Skip to content

Commit 24f443f

Browse files
authored
kfdtest: Disable XNACK on older ASICs. (#3569)
Older ASICs before MI200x (gfx90a) does not need to run kfdtest with XNACK ON due to a hardware bug. So this PR explicitly turns it OFF for those ASICs. ## Motivation <!-- Explain the purpose of this PR and the goals it aims to achieve. --> ## Technical Details Please see details in the description here: https://amd-hub.atlassian.net/browse/ROCM-3769 <!-- Explain the changes along with any relevant GitHub links. --> ## JIRA ID https://amd-hub.atlassian.net/browse/ROCM-3769 <!-- If applicable, mention the JIRA ID resolved by this PR (Example: Resolves SWDEV-12345). --> <!-- Do not post any JIRA links here. --> ## Test Plan <!-- Explain any relevant testing done to verify this PR. --> ## Test Result <!-- Briefly summarize test outcomes. --> ## Submission Checklist - [ ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
2 parents 58d667b + ad3cf1d commit 24f443f

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

projects/rocr-runtime/libhsakmt/tests/kfdtest/src/KFDBaseComponentTest.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ void KFDBaseComponentTest::SetUp() {
7272
/* m_FamilyId is default gpu family id, keep it to support old test method */
7373
m_FamilyId = FamilyIdFromNode(nodeProperties);
7474

75+
/* Check if XNACK is supported on the ASIC */
76+
m_is_xnack_supported = m_FamilyId < FAMILY_AL ? false : true;
77+
7578
/* these values are for default gpu, keep them to support old test method */
7679
GetHwQueueInfo(nodeProperties, &m_numCpQueues, &m_numSdmaEngines,
7780
&m_numSdmaXgmiEngines, &m_numSdmaQueuesPerEngine);
@@ -98,7 +101,7 @@ void KFDBaseComponentTest::SetUp() {
98101
while ((end = g_ConcurrentNodes.find(',', start)) != std::string::npos) {
99102
std::string token = g_ConcurrentNodes.substr(start, end - start);
100103
if (!token.empty()) {
101-
int node = std::stoi(token);
104+
int node = std::stoi(token);
102105

103106
if (std::find(gpuNodes.begin(), gpuNodes.end(), node) != gpuNodes.end())
104107
uniqueIndices.insert(node);
@@ -279,7 +282,6 @@ bool KFDBaseComponentTest::SVMAPISupported_GPU(unsigned int gpuNode) {
279282
return supported;
280283
}
281284

282-
283285
/*
284286
* Some asics need CWSR workround for DEGFX11_12113
285287
*/
@@ -360,6 +362,8 @@ HsaMemFlags& KFDBaseComponentTest::GetHsaMemFlags() {
360362
return m_MemoryFlags;
361363
}
362364

365+
bool KFDBaseComponentTest::XNACKSupported() { return m_is_xnack_supported; }
366+
363367
static void* KFDTest_GPU(void* ptr) {
364368

365369
KFDTEST_GPUPARAMETERS* pKFDTest_GPUParameters = (KFDTEST_GPUPARAMETERS*)ptr;

projects/rocr-runtime/libhsakmt/tests/kfdtest/src/KFDBaseComponentTest.hpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class KFDBaseComponentTest : public testing::Test {
9292
HsaNodeInfo* Get_NodeInfo();
9393
HsaMemFlags& GetHsaMemFlags();
9494
bool SVMAPISupported_GPU(unsigned int nodeId);
95+
bool XNACKSupported();
9596

9697
inline unsigned int Get_NumCpQueues(int gpuIndex){
9798
return m_numCpQueues_GPU[gpuIndex];
@@ -109,8 +110,8 @@ class KFDBaseComponentTest : public testing::Test {
109110
return m_numSdmaXgmiEngines_GPU[gpuIndex];
110111
}
111112

112-
HSAKMT_STATUS KFDTestMultiGPU(std::function<void(int)> test_func,
113-
const std::vector<int>& gpuNodes,
113+
HSAKMT_STATUS KFDTestMultiGPU(std::function<void(int)> test_func,
114+
const std::vector<int>& gpuNodes,
114115
unsigned int gpu_num);
115116

116117
HSAKMT_STATUS KFDTestLaunch(std::function<void(int)> test_func);
@@ -126,6 +127,7 @@ class KFDBaseComponentTest : public testing::Test {
126127
HsaMemFlags m_MemoryFlags;
127128
HsaNodeInfo m_NodeInfo;
128129
HSAint32 m_xnack;
130+
bool m_is_xnack_supported;
129131
Assembler* m_pAsm;
130132

131133
Assembler* m_pAsmGPU[MAX_GPU];
@@ -153,7 +155,10 @@ class KFDBaseComponentTest : public testing::Test {
153155
void SVMSetXNACKMode(int xnack_override = -1) {
154156
if (!SVMAPISupported())
155157
return;
156-
158+
if (!m_is_xnack_supported) {
159+
LOG() << "Skipping test: XNACK not supported on this ASIC" << std::endl;
160+
return;
161+
}
157162
m_xnack = -1;
158163
HSAKMT_STATUS ret = hsaKmtGetXNACKMode(&m_xnack);
159164
if (ret != HSAKMT_STATUS_SUCCESS) {
@@ -172,9 +177,9 @@ class KFDBaseComponentTest : public testing::Test {
172177
else
173178
return;
174179

175-
// No need to set XNACK if it's already the current value
176-
if (xnack_on == m_xnack)
177-
return;
180+
// No need to set XNACK if it's already the current value
181+
if (xnack_on == m_xnack)
182+
return;
178183

179184
ret = hsaKmtSetXNACKMode(xnack_on);
180185
if (ret != HSAKMT_STATUS_SUCCESS)

projects/rocr-runtime/libhsakmt/tests/kfdtest/src/KFDSVMEvictTest.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ void KFDSVMEvictTest::SetUp() {
4040
ROUTINE_START
4141

4242
KFDLocalMemoryTest::SetUp();
43-
4443
SVMSetXNACKMode(GetParam());
4544

4645
ROUTINE_END
@@ -235,12 +234,13 @@ TEST_P(KFDSVMEvictTest, BasicTest) {
235234

236235
if (!SVMAPISupported())
237236
return;
238-
239-
HSAint32 xnack_enable = 0;
240-
EXPECT_SUCCESS(hsaKmtGetXNACKMode(&xnack_enable));
241-
if (!xnack_enable) {
237+
if (m_is_xnack_supported) {
238+
HSAint32 xnack_enable = 0;
239+
EXPECT_SUCCESS(hsaKmtGetXNACKMode(&xnack_enable));
240+
if (!xnack_enable) {
242241
LOG() << std::hex << "Test is skipped with xnack off" << std::endl;
243242
return;
243+
}
244244
}
245245

246246
HSAuint32 defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();
@@ -309,12 +309,13 @@ TEST_P(KFDSVMEvictTest, QueueTest) {
309309

310310
if (!SVMAPISupported())
311311
return;
312-
313312
HSAint32 xnack_enable = 0;
314-
EXPECT_SUCCESS(hsaKmtGetXNACKMode(&xnack_enable));
315-
if (!xnack_enable) {
316-
LOG() << std::hex << "Test is skipped with xnack off" << std::endl;
317-
return;
313+
if (m_is_xnack_supported) {
314+
EXPECT_SUCCESS(hsaKmtGetXNACKMode(&xnack_enable));
315+
if (!xnack_enable) {
316+
LOG() << std::hex << "Test is skipped with xnack off" << std::endl;
317+
return;
318+
}
318319
}
319320

320321
HSAuint32 defaultGPUNode = m_NodeInfo.HsaDefaultGPUNode();

projects/rocr-runtime/libhsakmt/tests/kfdtest/src/KFDSVMRangeTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void KFDSVMRangeTest::SetUp() {
3636
ROUTINE_START
3737

3838
KFDBaseComponentTest::SetUp();
39-
4039
SVMSetXNACKMode(GetParam());
4140

4241
ROUTINE_END
@@ -195,6 +194,8 @@ TEST_P(KFDSVMRangeTest, XNACKModeTest) {
195194

196195
if (!SVMAPISupported())
197196
return;
197+
if (!m_is_xnack_supported)
198+
return;
198199

199200
HSAuint32 i, j;
200201
HSAint32 r;

0 commit comments

Comments
 (0)