-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
[Kernel] correct cpu worker function parameter type #19745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"""A CPU worker class.""" | ||
import os | ||
from importlib import util | ||
from typing import Dict, List, Optional, Set, Tuple, Type | ||
from typing import List, Optional, Set, Tuple, Type | ||
|
||
import torch | ||
import torch.distributed | ||
|
@@ -88,13 +88,13 @@ def _allocate_kv_cache( | |
torch.empty(kv_cache_shape, dtype=self.dtype, device="cpu")) | ||
return kv_cache | ||
|
||
def swap_in(self, src_to_dst: Dict[int, int]) -> None: | ||
def swap_in(self, src_to_dst: torch.Tensor) -> None: | ||
raise NotImplementedError("Swap is not supported in CPUCacheEngine.") | ||
|
||
def swap_out(self, src_to_dst: Dict[int, int]) -> None: | ||
def swap_out(self, src_to_dst: torch.Tensor) -> None: | ||
|
||
raise NotImplementedError("Swap is not supported in CPUCacheEngine.") | ||
|
||
def copy(self, src_to_dsts: Dict[int, List[int]]) -> None: | ||
def copy(self, src_to_dsts: torch.Tensor) -> None: | ||
|
||
self.attn_backend.copy_blocks(self.cpu_cache, src_to_dsts) | ||
|
||
@staticmethod | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the type hint for
src_to_dst
fromDict[int, int]
totorch.Tensor
improves type consistency with theblocks_to_swap_in
field in theWorkerInput
dataclass and theswap_blocks
method in theIPEXAttnBackend
.