[Platform] Add check_runner_kv_caches_multi_layer (#51633)

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
This commit is contained in:
wangxiyuan
2026-08-13 19:25:07 +00:00
committed by GitHub
parent 11c3fa4adc
commit 73b83949f7
6 changed files with 34 additions and 11 deletions
+17
View File
@@ -1200,6 +1200,23 @@ class Platform:
"""
return False
@classmethod
def check_runner_kv_caches_multi_layer(cls) -> None:
"""
Check whether the platform's ModelRunner can handle multiple attention
layers that share the same layer index (e.g. cross attention and self
attention in the same decoder block of an encoder-decoder model such as
BART).
Platforms that have verified that their ``runner_kv_caches`` is not
impacted by this case should override this to a no-op. Otherwise the
default implementation raises ``NotImplementedError``.
"""
raise NotImplementedError(
"Multiple attention layers with the same layer index are not "
"supported on the current platform."
)
@classmethod
def support_deep_gemm(cls) -> bool:
"""