Skip to content

Commit 97d9ef5

Browse files
authored
[hipDNN] Fix test failures in non-GPU environments by handling hipErrorNoDevice (#4426)
Tests were failing with error code 100 ("no ROCm-capable device is detected") when run in environments without GPUs. This affected all tests, not just GPU-specific ones, making it impossible to run the test suite in non-GPU environments. In non-GPU environments: 1. Any HIP API call triggers HIP runtime initialization 2. HIP detects no GPU and sets `hipErrorNoDevice` (error 100) 3. This error persists and cannot be cleared, even after calling `hipGetLastError()` 4. The `HipErrorHandler` test listener checks for HIP errors after each test 5. It detected this persistent error and failed all tests Modified `HipErrorHandler::OnTestEnd()` to silently accept `hipErrorNoDevice`: - Check if the error is `hipErrorNoDevice` after calling `hipGetLastError()` - If true, return early without failing the test - This allows tests to run in non-GPU environments
1 parent d2fca53 commit 97d9ef5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

projects/hipdnn/test_sdk/include/hipdnn_test_sdk/utilities/HipErrorHandler.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ class HipErrorHandler : public testing::EmptyTestEventListener
2525
// Check and clear standard HIP error state
2626
auto hipError = hipGetLastError();
2727

28+
// Special case: hipErrorNoDevice cannot be cleared and persists even after
29+
// hipGetLastError() is called. In non-GPU environments, we should not fail
30+
// the test for this specific error.
31+
if(hipError == hipErrorNoDevice)
32+
{
33+
return;
34+
}
35+
2836
// Check and clear extended HIP error state
2937
auto hipExtError = hipExtGetLastError();
3038

0 commit comments

Comments
 (0)