Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 131
Issue/867: adjust paged_attention_prefill interface naming#883
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8 src/infinicore/ops/paged_attention/paged_attention_infiniop.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 18 additions & 7 deletions
25 src/infinicore/ops/paged_attention_prefill/paged_attention_prefill.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 21 additions & 6 deletions
27 src/infinicore/ops/paged_attention_prefill/paged_attention_prefill_infiniop.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #pragma once | ||
| #include "infinicore/ops/paged_attention_prefill.hpp" | ||
| #include <pybind11/pybind11.h> | ||
| namespace py = pybind11; | ||
| namespace infinicore::ops { | ||
| Tensor py_paged_attention_prefill(Tensor q, | ||
| Tensor k_cache, | ||
| Tensor v_cache, | ||
| Tensor block_tables, | ||
| Tensor history_lens, | ||
| Tensor cu_seqlens_q, | ||
| py::object alibi_slopes, | ||
| float scale) { | ||
| std::optional<Tensor> alibi_slopes_tensor = std::nullopt; | ||
| if (!alibi_slopes.is_none()) { | ||
| alibi_slopes_tensor = alibi_slopes.cast<Tensor>(); | ||
| } | ||
| return op::paged_attention_prefill( | ||
| q, k_cache, v_cache, block_tables, history_lens, cu_seqlens_q, alibi_slopes_tensor, scale); | ||
| } | ||
| void py_paged_attention_prefill_(Tensor out, | ||
| Tensor q, | ||
| Tensor k_cache, | ||
| Tensor v_cache, | ||
| Tensor block_tables, | ||
| Tensor history_lens, | ||
| Tensor cu_seqlens_q, | ||
| py::object alibi_slopes, | ||
| float scale) { | ||
| std::optional<Tensor> alibi_slopes_tensor = std::nullopt; | ||
| if (!alibi_slopes.is_none()) { | ||
| alibi_slopes_tensor = alibi_slopes.cast<Tensor>(); | ||
| } | ||
| op::paged_attention_prefill_(out, q, k_cache, v_cache, block_tables, history_lens, cu_seqlens_q, alibi_slopes_tensor, scale); | ||
| } | ||
| inline void bind_paged_attention_prefill(py::module &m) { | ||
| m.def("paged_attention_prefill", | ||
| &ops::py_paged_attention_prefill, | ||
| py::arg("q"), | ||
| py::arg("k_cache"), | ||
| py::arg("v_cache"), | ||
| py::arg("block_tables"), | ||
| py::arg("history_lens"), | ||
| py::arg("cu_seqlens_q"), | ||
| py::arg("alibi_slopes") = py::none(), | ||
| py::arg("scale") = 1.0, | ||
| R"doc(Paged attention prefill for packed variable-length queries.)doc"); | ||
| m.def("paged_attention_prefill_", | ||
| &ops::py_paged_attention_prefill_, | ||
| py::arg("out"), | ||
| py::arg("q"), | ||
| py::arg("k_cache"), | ||
| py::arg("v_cache"), | ||
| py::arg("block_tables"), | ||
| py::arg("history_lens"), | ||
| py::arg("cu_seqlens_q"), | ||
| py::arg("alibi_slopes") = py::none(), | ||
| py::arg("scale") = 1.0, | ||
| R"doc(In-place paged attention prefill for packed variable-length queries.)doc"); | ||
| } | ||
| } // namespace infinicore::ops | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
单行80字符控制?
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.
现在没这个强制要求了,因为有些强行换行会影响阅读。现在写代码的人可以决定是否换行,这个需要换行吗?
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.
已修改