[ROCm] Add better kv dtype error discoverability (#55236)
Signed-off-by: Giuseppe Grossi <ggrossi@amd.com>
This commit is contained in:
+16
-1
@@ -682,9 +682,24 @@ class RocmPlatform(Platform):
|
|||||||
f"{config_str}. Reasons: {reasons_str}."
|
f"{config_str}. Reasons: {reasons_str}."
|
||||||
)
|
)
|
||||||
if len(valid_backends_priorities) == 0:
|
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(
|
raise ValueError(
|
||||||
f"No valid attention backend found for {cls.device_name} "
|
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
|
# We have found some valid backends. Select the one with the
|
||||||
|
|||||||
Reference in New Issue
Block a user