Fall back to CPU — onnxruntime-rocm PyPI build lacks RDNA2 (gfx1031) kernels
All checks were successful
Build ROCm Image / build (push) Successful in 14m55s

onnxruntime-rocm is compiled for CDNA datacenter GPUs (gfx908/gfx90a/gfx942).
RX 6700 XT (gfx1031/RDNA2) has no matching HIP kernel binary, causing
hipErrorNoBinaryForGpu at inference time. CPU execution provider works
correctly; GPU path can be revisited with a custom onnxruntime build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 20:48:18 -04:00
parent dc179ad8c6
commit d152ccb9f3

View File

@@ -26,30 +26,19 @@ _cond_cache: Dict[str, Dict[str, np.ndarray]] = {}
def detect_device() -> str: def detect_device() -> str:
try:
import onnxruntime as ort
available = ort.get_available_providers()
if "ROCMExecutionProvider" in available or "MIGraphXExecutionProvider" in available:
return "rocm"
except Exception:
pass
return "cpu" return "cpu"
def _get_providers(device: str) -> list: def _get_providers(device: str) -> list:
if device not in ("rocm", "cuda"): # onnxruntime-rocm from PyPI is compiled for CDNA datacenter GPUs only
return ["CPUExecutionProvider"] # (gfx908/gfx90a/gfx942). RDNA2 (gfx1031) has no compatible HIP kernel
# binary, producing hipErrorNoBinaryForGpu at inference time even though
# the session creates successfully. CPU provider used until a ROCm build
# that includes RDNA2 targets is available.
import onnxruntime as ort import onnxruntime as ort
available = set(ort.get_available_providers()) available = ort.get_available_providers()
providers = [] logger.info(f"Available ORT providers: {available} — using CPUExecutionProvider (RDNA2 not supported by this onnxruntime-rocm build)")
# MIGraphXExecutionProvider excluded — symbol mismatch between onnxruntime-rocm return ["CPUExecutionProvider"]
# and apt migraphx; ROCMExecutionProvider covers GPU execution adequately.
if "ROCMExecutionProvider" in available:
providers.append(("ROCMExecutionProvider", {"device_id": 0}))
providers.append("CPUExecutionProvider")
logger.info(f"Available ORT providers: {available}")
return providers
def _ort_type_to_np(ort_type: str): def _ort_type_to_np(ort_type: str):