Skip to content
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

[FlashInfer] Upgrade to 0.2.0 #11194

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open

Conversation

abmfy
Copy link

@abmfy abmfy commented Dec 14, 2024

This PR upgrades the FlashInfer attention backend to v0.2.0.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
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 can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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 do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@abmfy
Copy link
Author

abmfy commented Dec 14, 2024

@youkaichao

@youkaichao
Copy link
Member

Looking forward to the update!

@Swipe4057
Copy link

sm_scale: float


def infer_global_hyperparameters(model: nn.Module) -> GlobalHyperparameters:
Copy link
Member

Choose a reason for hiding this comment

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

this function can collect all per_layer_parameter, and only assert the results are the same.

@@ -495,6 +597,8 @@ def __init__(self, input_builder: "ModelInputForGPUBuilder"):
self.sliding_window = input_builder.sliding_window
self.block_size = input_builder.block_size
Copy link
Member

Choose a reason for hiding this comment

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

you can remember the vllm_config here by calling get_current_vllm_config()

# - `window_left`
# - `logits_soft_cap`
# - `sm_scale`
model = self.runner.model
Copy link
Member

Choose a reason for hiding this comment

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

vllm_config.compilation_config.static_forward_context is a dict of layer prefix to attention layer. you can collect sliding window, etc. from there. no need to iterate over model's submodule.

@@ -178,6 +179,9 @@ def __init__(self, runner):
self._decode_wrapper = None
self._prefill_wrapper = None

# Global hyperparameters shared by all attention layers
self.global_hyperparameters: Optional[PerLayerParameters] = None
Copy link
Member

Choose a reason for hiding this comment

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

remember the vllm_config here?

Comment on lines 1501 to 1509
with set_current_vllm_config(self.vllm_config):
# To make vLLM config available during
# worker initialization
attn_metadata = (self.attn_state.
graph_capture_get_metadata_for_batch(
batch_size,
is_encoder_decoder_model=self.
model_config.is_encoder_decoder,
))
Copy link
Member

Choose a reason for hiding this comment

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

then we don't need this change.

@youkaichao
Copy link
Member

also need to update this line to pass the ci:

vllm/Dockerfile

Line 200 in f0ef372

python3 -m pip install https://github.com/flashinfer-ai/flashinfer/releases/download/v0.1.6/flashinfer-0.1.6+cu121torch2.4-cp${PYTHON_VERSION_STR}-cp${PYTHON_VERSION_STR}-linux_x86_64.whl; \

@mergify mergify bot added the ci/build label Jan 23, 2025
Copy link
Member

@youkaichao youkaichao left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution!

@youkaichao youkaichao marked this pull request as ready for review January 23, 2025 13:55
Dockerfile Outdated
Comment on lines 216 to 220
# RUN --mount=type=cache,target=/root/.cache/pip \
# . /etc/environment && \
# if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
# python3 -m pip install https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.0.post1/flashinfer-0.2.0.post1+cu121torch2.4-cp${PYTHON_VERSION_STR}-cp${PYTHON_VERSION_STR}-linux_x86_64.whl; \
# fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

delete prior to landing?

Copy link
Member

Choose a reason for hiding this comment

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

commented in bb44221 . we might need it soon, so I just comment it out right now.

@youkaichao youkaichao enabled auto-merge (squash) January 26, 2025 13:28
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build documentation Improvements or additions to documentation frontend ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants