In-Tree AMD Zen CPU Backend via zentorch [1/N] (#35970)
Signed-off-by: Lalithnarayan C <Lalithnarayan.C@amd.com> Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Co-authored-by: Chinmay-Kulkarni-AMD <Chinmay.Kulkarni@amd.com> Co-authored-by: Tyler Michael Smith <tyler@neuralmagic.com> Co-authored-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Chinmay-Kulkarni-AMD
Tyler Michael Smith
Tyler Michael Smith
Claude Sonnet 4.6
parent
697e4ff352
commit
7acaea634c
@@ -0,0 +1,37 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from unittest.mock import mock_open, patch
|
||||
|
||||
from vllm.platforms import _is_amd_zen_cpu
|
||||
|
||||
|
||||
def test_is_amd_zen_cpu_detects_amd_with_avx512():
|
||||
cpuinfo = "vendor_id: AuthenticAMD\nflags: avx avx2 avx512f avx512bw"
|
||||
with (
|
||||
patch("os.path.exists", return_value=True),
|
||||
patch("builtins.open", mock_open(read_data=cpuinfo)),
|
||||
):
|
||||
assert _is_amd_zen_cpu()
|
||||
|
||||
|
||||
def test_is_amd_zen_cpu_returns_false_for_amd_without_avx512():
|
||||
cpuinfo = "vendor_id: AuthenticAMD\nflags: avx avx2"
|
||||
with (
|
||||
patch("os.path.exists", return_value=True),
|
||||
patch("builtins.open", mock_open(read_data=cpuinfo)),
|
||||
):
|
||||
assert not _is_amd_zen_cpu()
|
||||
|
||||
|
||||
def test_is_amd_zen_cpu_returns_false_for_intel_with_avx512():
|
||||
cpuinfo = "vendor_id: GenuineIntel\nflags: avx avx2 avx512f"
|
||||
with (
|
||||
patch("os.path.exists", return_value=True),
|
||||
patch("builtins.open", mock_open(read_data=cpuinfo)),
|
||||
):
|
||||
assert not _is_amd_zen_cpu()
|
||||
|
||||
|
||||
def test_is_amd_zen_cpu_returns_false_when_cpuinfo_missing():
|
||||
with patch("os.path.exists", return_value=False):
|
||||
assert not _is_amd_zen_cpu()
|
||||
Reference in New Issue
Block a user