-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[CPU] Support FP8 KV cache #14741
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
[CPU] Support FP8 KV cache #14741
Conversation
Signed-off-by: jiang1.li <[email protected]>
Signed-off-by: jiang1.li <[email protected]>
|
👋 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 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 🚀 |
Isotr0py
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added fp8 tests passed on my side locally, LGTM!
| if cache_config.cache_dtype == "fp8_e4m3": | ||
| cache_config.cache_dtype = "fp8_e5m2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that chunked_prefill/prefix_caching doesn't work with fp8 kv_cache, perhaps add a check with better error message here?
[rank0]: File "/data/develop-projects/github-repos/vllm-cpu/vllm/attention/backends/torch_sdpa.py", line 544, in forward
[rank0]: ipex_modules.PagedAttention.flash_attn_varlen_func(
[rank0]: File "/data/develop-projects/github-repos/vllm-cpu/.venv/lib/python3.12/site-packages/intel_extension_for_pytorch/llm/modules/mha_fusion.py", line 622, in flash_attn_varlen_func
[rank0]: ).flash_attn_varlen_func(
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/data/develop-projects/github-repos/vllm-cpu/.venv/lib/python3.12/site-packages/intel_extension_for_pytorch/transformers/models/cpu/fusions/mha_fusion.py", line 415, in flash_attn_varlen_func
[rank0]: torch.ops.torch_ipex.flash_attn_varlen_func(
[rank0]: File "/data/develop-projects/github-repos/vllm-cpu/.venv/lib/python3.12/site-packages/torch/_ops.py", line 1123, in __call__
[rank0]: return self._op(*args, **(kwargs or {}))
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: RuntimeError: expected scalar type BFloat16 but found Float8_e5m2
Processed prompts: 0%| | 0/4 [00:00<?, ?it/s, est. speed input: 0.00 toks/s, output: 0.00 toks/s]
Signed-off-by: jiang1.li <[email protected]>
Signed-off-by: jiang1.li <[email protected]> Signed-off-by: Louis Ulmer <[email protected]>
Signed-off-by: jiang1.li <[email protected]>
Signed-off-by: jiang1.li <[email protected]> Signed-off-by: Mu Huai <[email protected]>
This PR added FP8-E5M2 KV cache support for the CPU backend, and also updated tests for chunked-prefill with
Halfdtype.