From b980cb57e414df77ff58de4e58231fef4fc7dcc5 Mon Sep 17 00:00:00 2001 From: John Shumway Date: Thu, 9 Jul 2026 14:53:09 -0700 Subject: [PATCH] test(rocke): recognize WSL /dev/dxg in the GPU-availability gate The platform pytest suite gated on-GPU tests on the presence of the /dev/kfd device node. Under WSL, ROCm reaches the GPU through the DXG bridge (/dev/dxg); /dev/kfd is absent even though kernels launch fine. As a result every @_requires_gpu test skipped on WSL, so a "green" run exercised no on-GPU execution. Accept /dev/dxg in addition to /dev/kfd. The probe stays torch-free and issues no HIP call (no hang risk), and the /dev/kfd path is unchanged, so native-Linux runners are unaffected. On a gfx1151 WSL box this turns the three torch-free lowerer round-trip tests from skip into real on-GPU passes (verified: 3 pass with the device visible, and all three fail at hipInit when the device is hidden). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../rocke/platform/tests/test_rocke.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke.py b/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke.py index a0e951ec97f..55e8b37a3ff 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke.py +++ b/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke.py @@ -85,9 +85,10 @@ # # A separate handful drive the lowerer all the way through # ``hipModuleLoadData``, which blocks indefinitely on a host with no ROCm -# GPU (no ``/dev/kfd``). Those are skipped when no GPU device node is -# present. The probe is deliberately torch-free (the point of this suite is -# torch-independence) and avoids issuing any HIP call that could itself hang. +# GPU (no ``/dev/kfd`` or ``/dev/dxg``). Those are skipped when no GPU device +# node is present. The probe is deliberately torch-free (the point of this +# suite is torch-independence) and avoids issuing any HIP call that could +# itself hang. try: # torch is optional; gate torch-facing tests on its presence. import torch as _torch # noqa: F401 @@ -98,13 +99,15 @@ import os as _os -# A ROCm GPU exposes the kernel-fusion device node at /dev/kfd. Its absence -# means launches/module loads cannot succeed and would hang; skip then. -_HAVE_GPU = _os.path.exists("/dev/kfd") +# A ROCm GPU exposes a device node the runtime can open: /dev/kfd on native +# Linux, or /dev/dxg under WSL, where ROCm reaches the GPU through the DXG +# bridge. Absence of both means launches/module loads cannot succeed and would +# hang; skip then. +_HAVE_GPU = _os.path.exists("/dev/kfd") or _os.path.exists("/dev/dxg") _requires_torch = unittest.skipUnless(_HAVE_TORCH, "requires torch") _requires_gpu = unittest.skipUnless( - _HAVE_GPU, "requires a ROCm GPU (no /dev/kfd device node present)" + _HAVE_GPU, "requires a ROCm GPU (no /dev/kfd or /dev/dxg device node present)" )