Skip to content

Conversation

jikunshang
Copy link
Collaborator

FILL IN THE PR DESCRIPTION HERE

Add FP8 kv cache for Intel CPU.

BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE


PR Checklist (Click to Expand)

Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.

PR Title and Classification

Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:

  • [Bugfix] for bug fixes.
  • [CI/Build] for build or continuous integration improvements.
  • [Doc] for documentation fixes and improvements.
  • [Model] for adding a new model or improving an existing model. Model name should appear in the title.
  • [Frontend] For changes on the vLLM frontend (e.g., OpenAI API server, LLM class, etc.)
  • [Kernel] for changes affecting CUDA kernels or other compute kernels.
  • [Core] for changes in the core vLLM logic (e.g., LLMEngine, AsyncLLMEngine, Scheduler, etc.)
  • [Hardware][Vendor] for hardware-specific changes. Vendor name should appear in the prefix (e.g., [Hardware][AMD]).
  • [Misc] for PRs that do not fit the above categories. Please use this sparingly.

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

  • We adhere to Google Python style guide and Google C++ style guide.
  • Pass all linter checks. Please use format.sh to format your code.
  • The code need to be well-documented to ensure future contributors can easily understand the code.
  • Include sufficient tests to ensure the project to stay correct and robust. This includes both unit tests and integration tests.
  • Please add documentation to docs/source/ if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.

Notes for Large Changes

Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with rfc-required and might not go through the PR.

What to Expect for the Reviews

The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:

  • After the PR is submitted, the PR will be assigned to a reviewer. Every reviewer will pick up the PRs based on their expertise and availability.
  • After the PR is assigned, the reviewer will provide status update every 2-3 days. If the PR is not reviewed within 7 days, please feel free to ping the reviewer or the vLLM team.
  • After the review, the reviewer will put an action-required label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.
  • Please respond to all comments within a reasonable time frame. If a comment isn't clear or you disagree with a suggestion, feel free to ask for clarification or discuss the suggestion.

Thank You

Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!

@bigPYJ1151 bigPYJ1151 mentioned this pull request Jun 13, 2024
4 tasks
@WoosukKwon WoosukKwon added the x86-cpu Related to Intel & AMD CPU label Jun 13, 2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to compile for AVX512BF16 if we simply find it, not if we find it and force it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't these asserts valid anymore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't immediately clear that cpu_fp8 is treated as a type since the PyTorch types use PascalCase - maybe at least adding a _t such as cpu_fp8_t or CpuFP8 or FP8Cpu?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this IS_FP8_KV_CACHE boolean in paged_attention_v1 but not in paged_attention_v2? It seems like it could be deduced by checking the cache_t within the kernel and this would bode better for future cache types being used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling out again that I think the name of this type doesn't seem like a type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all these function signatures that have just e5m2 to signify fp8e5m2, I think it would be more clear to include the fp8

Comment on lines +48 to +68
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any additional function header or inline comments would be appreciated!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between noinf and noINF?

Comment on lines +136 to +144
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you aren't getting any reuse out of these functions, why not inline the body?

Comment on lines -127 to -138
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only implemented for CPU usage of the Torch SPDA backend, right? Would fp8 kv cache work if we used CUDA with the SPDA backend, for instance?

Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also cc @comaniac !

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be better to align with the general interface. We now support fp8, fp8_e4m3 and fp8_e5m2. Note that fp8 defaults to fp8_e4m3. Please cover all cases and throw an error for unsupported cases.

@jikunshang jikunshang marked this pull request as draft June 17, 2024 02:55
@hmellor
Copy link
Member

hmellor commented Feb 18, 2025

@jikunshang do you plan to continue this work?

@jikunshang
Copy link
Collaborator Author

@jikunshang do you plan to continue this work?

@bigPYJ1151 Please help update status, thanks!

@bigPYJ1151
Copy link
Member

@hmellor I think this PR can be closed as it has been integrated to the intel-extension-for-pytorch 2.6. The feature will be enabled after the torch 2.6 update finished.

@jikunshang
Copy link
Collaborator Author

@bigPYJ1151 thanks! Let me close this one.

@jikunshang jikunshang closed this Feb 19, 2025
@mergify mergify bot added the ci/build label Feb 19, 2025
@hmellor
Copy link
Member

hmellor commented Feb 19, 2025

Great! In that case, could you remove the TODO from the docs regarding this feature?

@bigPYJ1151
Copy link
Member

@hmellor sure, will update the doc too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build x86-cpu Related to Intel & AMD CPU

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants