feat(ops): add vLLM-aligned paged attention v1 - #893
Open
voltjia wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
PagedAttentionV1operator aligned with the public vLLM v0.6.3 Python wrapper.PagedAttentionInfinilminterface.paged_attention_v1so the legacy provider depends on the canonical implementation.Motivation
PagedAttentionInfinilmexposes an InfiniLM-specific cache layout and cannot serve as the canonical open-source-aligned interface. A public vLLM-aligned operator is needed before compatible consumers can migrate away from the deprecated API.Type of Change
feat- new feature / new operator / new platformfix- bug fixperf- performance improvement (no behavioral change)refactor- code restructuring without behavior changetest- adding or fixing tests onlydocs- documentation onlybuild/ci- build system or CI configurationchore- tooling, formatting, or other non-code changes!in the Conventional Commits prefix or aBREAKING CHANGE:footer)Platforms Affected
WITH_CPU)WITH_NVIDIA)WITH_ILUVATAR)WITH_METAX)WITH_CAMBRICON)WITH_MOORE)WITH_ASCEND)WITH_TORCH)Smoke Test Result
Validated on
ssh nvidiainaccelerator-dev/nvidia:latestwith a focused CPU + NVIDIA build containing the canonical and legacy operators:Test Results on Supported Platforms
Additional checks:
Benchmark / Performance Impact
N/A. This PR exposes an existing decode algorithm through a canonical interface and does not claim a performance change.
Notes for Reviewers
API alignment
PagedAttentionV1(query, key_cache, value_cache, block_tables, seq_lens, alibi_slopes, num_kv_heads, scale, block_size, max_seq_len, kv_cache_dtype, k_scale, v_scale, tp_rank, blocksparse_local_blocks, blocksparse_vert_stride, blocksparse_block_size, blocksparse_head_sliding_step, out)paged_attention_v1(out, query, key_cache, value_cache, num_kv_heads, scale, block_tables, seq_lens, block_size, max_seq_len, alibi_slopes, kv_cache_dtype, k_scale, v_scale, tp_rank=0, blocksparse_local_blocks=0, blocksparse_vert_stride=0, blocksparse_block_size=64, blocksparse_head_sliding_step=0)InfiniOps applies its C++ input-attribute-output grouping rule: tensor inputs retain their upstream relative order, scalar and string attributes retain their upstream relative order, and the writable
outtensor is trailing. The operator has one canonical overload; Python defaults remain explicit C++ arguments.Current provider scope
The interface represents every vLLM parameter. The current shared CUDA provider supports the existing unquantized dense path: float16/bfloat16 data, head sizes 64 or 128,
kv_cache_dtype == "auto", unit K/V scales, and block-sparse attributes disabled. Unsupported values are rejected explicitly rather than removed from the public interface.PagedAttentionInfinilmremains available and deprecated. Its 4D cache path is covered by the legacy tests, whilePagedAttentionV1uses vLLM's vectorized 5D key-cache and transposed 4D value-cache layouts. No consumer migration or legacy API removal is included in this PR.