[ROCm] Add better kv dtype error discoverability (#55236)

Signed-off-by: Giuseppe Grossi <ggrossi@amd.com>

Giuseppe Grossi committed Sep 10, 2026 at 05:17 UTC 6ff479e1f798048829f884b4229f28c9b9b0c8d7
1 file changed +16 -1
vllm/platforms/rocm.py
+16 -1
@@ -682,9 +682,24 @@ class RocmPlatform(Platform):
682 f"{config_str}. Reasons: {reasons_str}."
683 )
684 if len(valid_backends_priorities) == 0:
685 + # If a backend rejected the requested kv-cache dtype, list the
686 + # dtypes it does accept so the limitation is discoverable.
687 + supported = sorted(
688 + {
689 + dt
690 + for backend, reasons in invalid_reasons.items()
691 + if any("kv_cache_dtype" in r for r in reasons)
692 + for dt in backend.get_class().supported_kv_cache_dtypes
693 + }
694 + )
695 + hint = (
696 + f" Supported kv_cache_dtype values: {', '.join(supported)}."
697 + if supported
698 + else ""
699 + )
700 raise ValueError(
701 f"No valid attention backend found for {cls.device_name} "
687 - f"with {config_str}. Reasons: {reasons_str}."
702 + f"with {config_str}. Reasons: {reasons_str}.{hint}"
703 )
704
705 # We have found some valid backends. Select the one with the