Skip to content

[CI/Build] fix cpu_extension for apple silicon #2

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

Closed
wants to merge 3 commits into from

Conversation

ignaciosica
Copy link
Owner

@ignaciosica ignaciosica commented Jul 16, 2025

Purpose

The purpose for this pr is to fix the cpu installation from source for apple silicon CPUs. Recently, basic serving capabilities and examples stopped working in my local setup (M3 pro). I bisected my way to this pr vllm-project#14129 which introduced int8 quantization for ARM CPU. The problem lied on the fact that although apple silicon shared some codepath with the rest of the arm cpu in cpu_extension.cmake, it also had some specific configurations that ended up breaking build after the int8 support was introduced; more specifically, apple silicon pathway was not enabling ASIMD_FOUND thus not including quant.cpp (cpu_extension.cmake:284) source.

After a fresh install from source

git clone https://github.com/vllm-project/vllm.git
cd vllm
uv venv --python 3.12 --seed
source .venv/bin/activate
uv pip install -r requirements/cpu.txt
uv pip install -e .

Basic example failed with

python examples/offline_inference/basic/basic.py
> WARNING 07-18 12:13:35 [_custom_ops.py:20] Failed to import from vllm._C with ImportError("dlopen([...]/vllm/vllm/_C.abi3.so, 0x0002): symbol not found in flat namespace '__Z14int8_scaled_mmRN2at6TensorERKS0_S3_S3_S3_RKNSt3__18optionalIS0_EE'")
> [...]
> AttributeError: '_OpNamespace' '_C_cache_ops' object has no attribute 'reshape_and_cache'

In order to fix, this pr enabled ASIMD_FOUND for apple silicon as well. For safety, it checked for support with the following command: sysctl -n hw.optional.neon. As far as I know, all apple silicon, starting from M1 up to M4 generation support this feature, but still decided to gate ASIMD_FOUND on this check in the case the support is dropped for future generations.

After this fix, cpu installation from source started working again.

This pr also enables bf16 support for apple silicon. This feature is gated via the following check hw.optional.arm.FEAT_BF16. Based on this LLVM's commit, bf16 support was introduced for cpu in m2 generation.

Test Plan

Unfortunately I'm not familiar enough with build runs in CI, I would appreciate some guidance for this point.

@ignaciosica ignaciosica force-pushed the fix_fresh_source_install branch 2 times, most recently from 480f3a7 to 09a634c Compare July 17, 2025 21:50
@ignaciosica ignaciosica changed the title revert c7753a98 [CI/Build] fix cpu_extension for apple silicon Jul 18, 2025
@ignaciosica ignaciosica force-pushed the fix_fresh_source_install branch 3 times, most recently from 96ab6dc to 8a95496 Compare July 18, 2025 15:38
@ignaciosica ignaciosica force-pushed the fix_fresh_source_install branch from 537a376 to 34d30da Compare July 20, 2025 01:18
@ignaciosica
Copy link
Owner Author

opened in main repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant