Skip to content

[Misc][MacOS] fix bfloat16 error #18249

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

Merged
merged 1 commit into from
May 16, 2025

Conversation

reidliu41
Copy link
Contributor

@reidliu41 reidliu41 commented May 16, 2025

vllm serve qwen/Qwen1.5-0.5B-Chat

line 276, in rms_norm
ERROR 05-16 11:28:20 [engine.py:161]     torch.ops._C.rms_norm(out, input_contiguous, weight, epsilon)
ERROR 05-16 11:28:20 [engine.py:161]   File "/opt/miniconda3/envs/vllm/lib/python3.12/site-packages/torch/_ops.py", line 1158, in __call__
ERROR 05-16 11:28:20 [engine.py:161]     return self._op(*args, **(kwargs or {}))
ERROR 05-16 11:28:20 [engine.py:161]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR 05-16 11:28:20 [engine.py:161] RuntimeError: "rms_norm_impl" not implemented for 'BFloat16'

So it would be better to bring it back.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@Isotr0py
Copy link
Collaborator

I think it's just because of a mistake in CPUPlatform here:

elif sys.platform.startswith(
"darwin") and self.get_cpu_architecture() == CpuArchEnum.ARM:
# TODO: change this condition to check if the platform support bf16
# instead of checking the OS. For instance M2 shall supports bf16
# already. But we need to modify `cpu_extension.cmake` to activate
# the feature in the build.
return [torch.bfloat16, torch.float32]

Correct bfloat16 to float16 there should work as well.

@DarkLight1337 DarkLight1337 requested review from mgoin and Isotr0py May 16, 2025 07:14
Signed-off-by: reidliu41 <reid201711@gmail.com>
@reidliu41 reidliu41 force-pushed the fix-bfloat16-issue branch from 84c28d5 to d022447 Compare May 16, 2025 11:26
@reidliu41
Copy link
Contributor Author

reidliu41 commented May 16, 2025

Thank you for your confirm. Just tested, it worked

@Isotr0py Isotr0py enabled auto-merge (squash) May 16, 2025 12:14
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label May 16, 2025
@Isotr0py Isotr0py merged commit d3d91b6 into vllm-project:main May 16, 2025
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants