Skip to content

Conversation

@happierpig
Copy link

@happierpig happierpig commented Sep 15, 2025

Purpose

This PR removes the decode wrapper of the FlashInfer backend in V1 to simplify code paths and improve maintenance. As use_tensor_cores is always enabled for batch decode requests for better performance (

use_tensor_cores=True,
), the backend kernels are always dispatched into FA2 prefill kernels in FlashInfer (https://github.com/flashinfer-ai/flashinfer/blob/2bd914460c08c3d26093165b117fb9089f857bed/flashinfer/decode.py#L1018). Thus, using either DecodeWrapper or PrefillWrapper is theoretically equivalent.

In the future, both prefill and decode could be batched and executed within a single kernel call for a unified kernel (as proposed in flashinfer-ai/flashinfer#1137).

cc @heheda12345 for #24856. This PR is compatible with current stable FlashInfer.

Test Plan

Test Result

perf benchmark:
image
The ~2% perf degrade potentially due to the lightly higher overhead of plan function of BatchPrefillWrapper, which should be minimal when using fast_decode_plan (

def fast_plan_decode(
) in cuda graph.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@github-actions
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 ask your reviewers to trigger select CI tests on top of fastcheck CI.

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.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@mergify mergify bot added the v1 label Sep 15, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to simplify the FlashInfer backend by removing the DecodeWrapper and using the PrefillWrapper for both prefill and decode operations. This is a good simplification that improves code maintenance. However, I've identified a critical issue in the fast_plan_decode function where the arguments passed to the plan method are incorrect. This will lead to a runtime error and needs to be fixed.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant