[Hardware][Intel] Add CPU inference backend (#3634)

Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
Co-authored-by: Yuan Zhou <yuan.zhou@intel.com>
This commit is contained in:
bigPYJ1151
2024-04-01 22:07:30 -07:00
committed by GitHub
co-authored by Kunshang Ji Yuan Zhou
parent eb69d68804
commit 0e3f06fe9c
24 changed files with 2747 additions and 5 deletions
+10
View File
@@ -117,6 +117,13 @@ def is_hip() -> bool:
return torch.version.hip is not None
@lru_cache(maxsize=None)
def is_cpu() -> bool:
from importlib.metadata import version
is_cpu_flag = "cpu" in version("vllm")
return is_cpu_flag
@lru_cache(maxsize=None)
def is_neuron() -> bool:
try:
@@ -362,6 +369,9 @@ def is_pin_memory_available() -> bool:
elif is_neuron():
print_warning_once("Pin memory is not supported on Neuron.")
return False
elif is_cpu():
print_warning_once("Pin memory is not supported on CPU.")
return False
return True