[4/N][warmup][DSv4] Migrate common attention kernels (#50176)
Signed-off-by: LopezCastroRoberto <rocastro@redhat.com> Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
co-authored by
Codex
parent
f998862d46
commit
6ddbab03de
@@ -431,6 +431,40 @@ def test_dispatch_can_forward_compile_key_fields() -> None:
|
||||
kernel.compile_key({"tokens": 5, "mode": 2, "extra": 1})
|
||||
|
||||
|
||||
def test_forwarded_compile_key_fields_exclude_predicate_only_inputs() -> None:
|
||||
class ForwardingKernel(VllmJitKernel["ForwardingKernel.CompileKey"]):
|
||||
@dataclass(frozen=True)
|
||||
class CompileKey:
|
||||
mode: int
|
||||
block_size: int
|
||||
|
||||
def dispatch( # type: ignore[override]
|
||||
self,
|
||||
*,
|
||||
tokens: int,
|
||||
**compile_key_fields: int,
|
||||
) -> CompileKey:
|
||||
return self.CompileKey(
|
||||
**compile_key_fields,
|
||||
block_size=_round_up(tokens, multiple=4),
|
||||
)
|
||||
|
||||
def get_warmup_keys(self) -> list[CompileKey]:
|
||||
return self._trace_dispatch(self.dispatch)(
|
||||
tokens=(1, 5),
|
||||
mode=2,
|
||||
max_tokens=4,
|
||||
_when=lambda *, tokens, max_tokens: tokens <= max_tokens,
|
||||
)
|
||||
|
||||
def compile(self, compile_key: CompileKey) -> None:
|
||||
pass
|
||||
|
||||
assert ForwardingKernel().get_warmup_keys() == [
|
||||
ForwardingKernel.CompileKey(mode=2, block_size=4)
|
||||
]
|
||||
|
||||
|
||||
def test_dispatch_supports_tuple_and_mapping_subscriptions() -> None:
|
||||
class SubscriptKernel(VllmJitKernel["SubscriptKernel.CompileKey"]):
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Reference in New Issue
Block a user