Conversation
|
Nice, we definitely need this. |
Summary of ChangesHello @BBuf, 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 refactors the project by migrating the FlashAttention v4 (FA4) implementation to a new, more appropriate location within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request moves the FlashAttention v4 implementation from sgl-kernel to a new jit_kernel directory within the sglang package. As requested, the review focuses on the integration points and new interface code, while skipping the vendored code from the flash-attention repository.
I've identified a few critical issues in the new interface and integration code that will cause runtime errors due to incorrect function calls and undefined variables. These need to be addressed to ensure the new FA4 implementation can be correctly invoked. Please see the detailed comments for suggestions on how to fix them.
python/sglang/multimodal_gen/runtime/layers/attention/backends/flash_attn.py
Outdated
Show resolved
Hide resolved
|
/tag-and-rerun-ci |
|
We do not guarantee any backward compatbility of an experimental API (early FA4) in sgl kernel for other non-sglang projects, so I believe we can merge this and delete old code. It should be easy for other projects to migrate (copy code and change a few lines of imports). It does not make sense to sacrifice our code's cleanness for other projects. Unfortunately, the other projects have to pay the maintenance overhead. |
Agree with it, I'll add sgl-kernel fa4 back, thanks for your explanation. |
|
I think that at some point, we can move everything to cute dsl, so It would be nice to remove C++ FA from sglang It saves time compilation == Less pressure CI == reduce costs. FA cute dsl it has FA2 and FA3(but i don't know if it has all the features) Now i close to cutlass team, so i'll divulgate the future changes |
Indeed, this can significantly reduce the size of the sgl-kernel package. |
yes, and we can incorporate more archs. |
|
/rerun-failed-ci |
|
The problem that I see here is that the API is still beta and not all features are available, so in sgl-kernel, we point to exact commit in cmakelist.txt so we should have the same behavior here, because they are changing constantly the API |
If there are changes to the interface later, we can modify it accordingly, and we won't have to go through the cumbersome process of releasing a new version through sgl-kernel. |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
3 similar comments
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
@zhyncs The request change has been solved and ci passed too. Can you give me a approve? Thanks. |
Motivation
Flash Attention V4 is implemented using the cute-dsl and is inherently JIT-compiled, so moving it to jit_kernel is a fairly natural transition.
python/sglang/jit_kernel/flash_attention/cutedirectory is copied from https://github.com/Dao-AILab/flash-attention/tree/main/flash_attn/cute , so this directory do not need review.unit-test passed.
Modifications
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci