From 78e7fdd1ab81d4203a7522c2bf197b3a4b2b48cb Mon Sep 17 00:00:00 2001 From: Kush Zingade Date: Tue, 11 Aug 2026 21:35:07 +0800 Subject: [PATCH] [Bugfix][CPU] Make the Apple Silicon BF16 probe fall back instead of raising (#51627) Signed-off-by: Kush Zingade --- vllm/platforms/cpu.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vllm/platforms/cpu.py b/vllm/platforms/cpu.py index 139cfd6701..4eeb98a79c 100644 --- a/vllm/platforms/cpu.py +++ b/vllm/platforms/cpu.py @@ -54,12 +54,15 @@ class CpuPlatform(Platform): elif self.get_cpu_architecture() == CpuArchEnum.ARM and sys.platform.startswith( "darwin" ): - if ( - subprocess.check_output( - ["sysctl -n hw.optional.arm.FEAT_BF16"], shell=True - ).strip() + # sysctl exits non-zero when the OID is absent, so check_output would + # raise instead of letting the fp16/fp32 fallback below run. + bf16 = ( + subprocess.run( + ["sysctl", "-n", "hw.optional.arm.FEAT_BF16"], capture_output=True + ).stdout.strip() == b"1" - ): + ) + if bf16: return [torch.bfloat16, torch.float16, torch.float32] return [torch.float16, torch.float32] elif self.get_cpu_architecture() == CpuArchEnum.RISCV: