Fall back to CPU — onnxruntime-rocm PyPI build lacks RDNA2 (gfx1031) kernels
All checks were successful
Build ROCm Image / build (push) Successful in 14m55s
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:
27
engine.py
27
engine.py
@@ -26,30 +26,19 @@ _cond_cache: Dict[str, Dict[str, np.ndarray]] = {}
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
||||
def _get_providers(device: str) -> list:
|
||||
if device not in ("rocm", "cuda"):
|
||||
return ["CPUExecutionProvider"]
|
||||
|
||||
# onnxruntime-rocm from PyPI is compiled for CDNA datacenter GPUs only
|
||||
# (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
|
||||
available = set(ort.get_available_providers())
|
||||
providers = []
|
||||
# MIGraphXExecutionProvider excluded — symbol mismatch between onnxruntime-rocm
|
||||
# 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
|
||||
available = ort.get_available_providers()
|
||||
logger.info(f"Available ORT providers: {available} — using CPUExecutionProvider (RDNA2 not supported by this onnxruntime-rocm build)")
|
||||
return ["CPUExecutionProvider"]
|
||||
|
||||
|
||||
def _ort_type_to_np(ort_type: str):
|
||||
|
||||
Reference in New Issue
Block a user