Skip to content

Conversation

yongwww
Copy link
Collaborator

@yongwww yongwww commented Oct 21, 2025

📌 Description

Fix the regression in vLLM and SGLang with FI 0.4.0 in bmm_fp8

🔍 Related Issues

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

cc: @yzh119

Summary by CodeRabbit

  • Backend Optimization
    • Streamlined tensor dispatch logic to support more flexible memory layout configurations, improving compatibility and processing efficiency for various tensor types while maintaining existing functionality.

Copy link
Contributor

Summary of Changes

Hello @yongwww, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a fix for a regression affecting vLLM and SGLang when using FlashInfer 0.4.0 in bmm_fp8 operations. The core change involves removing redundant CHECK_CONTIGUOUS calls within the CutlassGemmGroupwiseScaledSM120 function, which were causing unexpected behavior. This ensures the correct and efficient execution of batch matrix multiplication with FP8 precision.

Highlights

  • Redundant Contiguity Checks Removed: The CHECK_CONTIGUOUS calls for SFA and SFB have been removed from the CutlassGemmGroupwiseScaledSM120 function in csrc/gemm_groupwise_sm120.cu, as these checks were identified as redundant.
  • Regression Fix: This change specifically addresses a regression encountered in vLLM and SGLang when utilizing FlashInfer 0.4.0 in bmm_fp8 operations, which was likely caused by the presence of these unnecessary contiguity checks.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

The contiguity validation checks for SFA and SFB parameters are removed from the dispatch logic. The pipeline now proceeds without enforcing these constraints, deferring shape interpretation to downstream components or kernel layout specifications.

Changes

Cohort / File(s) Summary
Contiguity Check Removal
csrc/gemm_groupwise_sm120.cu
Removed SFA and SFB contiguity validation checks; dispatch pipeline no longer enforces contiguity constraints, delegating interpretation to downstream logic or kernel layouts. Other dispatch paths and parameter handling unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 No more checks to bind the way,
SFA and SFB now dance and play,
Contiguity fades to downstream care,
Flexibility flows through the air! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed The pull request description includes all required sections from the template: a Description section explaining the fix for the regression in vLLM and SGLang with FI 0.4.0, a Related Issues section (though with a placeholder rather than actual links), and the complete Pull Request Checklist with Pre-commit Checks, Tests, and Reviewer Notes sections. While the Related Issues section could be more detailed with specific issue links, the description is mostly complete with the key required information present and the overall structure matches the template.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title Check ✅ Passed The pull request title "fix: Remove CHECK_CONTIGUOUS for SFA/SFB" directly and accurately summarizes the main change in the changeset. The raw summary confirms that the primary modification involves removing contiguity checks for SFA and SFB parameters in the csrc/gemm_groupwise_sm120.cu file. The title is specific and clear, identifying exactly what was removed (CHECK_CONTIGUOUS) and which parameters it affects (SFA/SFB), providing meaningful information without vagueness or unnecessary details.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.


// Ensure scales are contiguous
// Note: We keep the original shape and let the kernel's layout handle interpretation
CHECK_CONTIGUOUS(SFA);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have any assumptions on the layout of SFA or SFB?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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 correctly removes redundant contiguity checks on scale factor tensors in the SM120 GEMM implementation. This fixes a regression where valid, non-contiguous tensors were being incorrectly rejected. The change is sound as the underlying CUTLASS kernel handles memory layout complexities for these tensors. For long-term stability, it would be beneficial to add a regression test case that specifically uses non-contiguous scale tensors to ensure this functionality remains correct in future changes.

@yongwww yongwww changed the title fix: Remove redundant CHECK_CONTIGUOUS for SFA/SFB fix: Remove CHECK_CONTIGUOUS for SFA/SFB Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants