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

Signed-off-by: Giuseppe Grossi <ggrossi@amd.com>
This commit is contained in:
Giuseppe Grossi
2026-09-10 09:17:41 +00:00
committed by GitHub
parent b28c3e1568
commit 6ff479e1f7
+16 -1
View File
@@ -682,9 +682,24 @@ class RocmPlatform(Platform):
f"{config_str}. Reasons: {reasons_str}."
)
if len(valid_backends_priorities) == 0:
# If a backend rejected the requested kv-cache dtype, list the
# dtypes it does accept so the limitation is discoverable.
supported = sorted(
{
dt
for backend, reasons in invalid_reasons.items()
if any("kv_cache_dtype" in r for r in reasons)
for dt in backend.get_class().supported_kv_cache_dtypes
}
)
hint = (
f" Supported kv_cache_dtype values: {', '.join(supported)}."
if supported
else ""
)
raise ValueError(
f"No valid attention backend found for {cls.device_name} "
f"with {config_str}. Reasons: {reasons_str}."
f"with {config_str}. Reasons: {reasons_str}.{hint}"
)
# We have found some valid backends. Select the one with the