Migrate bmm_fp8 from AOT cuBLASLt to flashinfer JIT#18999
Migrate bmm_fp8 from AOT cuBLASLt to flashinfer JIT#18999Johnsonms wants to merge 6 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @Johnsonms, 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 streamlines 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. Changelog
Activity
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 is a great simplification, removing a custom C++/CUDA implementation of bmm_fp8 and replacing it with the equivalent function from the flashinfer library. This change effectively reduces code duplication and maintenance overhead. The removal of the old C++ source and header files, along with the corresponding build system and registration code, is done correctly. The addition of new, more comprehensive tests and benchmarks is a valuable improvement that ensures the correctness and performance of the new implementation. I have one minor suggestion regarding Python import conventions.
…enchmark and tests - sgl_kernel/gemm.py: add backend= param to bmm_fp8(); default keeps AOT cuBLASLt path, backend="flashinfer" delegates to flashinfer.bmm_fp8() - python/sglang/jit_kernel/tests/test_bmm_fp8.py: correctness tests for flashinfer JIT vs float reference and vs sgl_kernel AOT (cos_sim checks) - python/sglang/jit_kernel/benchmark/bench_bmm_fp8.py: perf comparison sgl_kernel (AOT cuBLASLt) vs flashinfer (JIT); no regression confirmed
Remove the sgl-kernel C++ bmm_fp8 implementation (cuBLASLt wrapper)
and delegate sgl_kernel.bmm_fp8 directly to flashinfer.bmm_fp8.
Benchmarks showed <1% latency difference across all tested shapes.
Changes:
- Delete sgl-kernel/csrc/gemm/bmm_fp8.cu
- Remove bmm_fp8 from CMakeLists.txt, common_extension.cc, sgl_kernel_ops.h
- Simplify sgl_kernel.gemm.bmm_fp8 to call flashinfer.bmm_fp8
- Move test + benchmark to python/sglang/jit_kernel/{tests,benchmark}/
- Update benchmark to flashinfer-only (sgl_kernel provider removed)
Motivation
PR: #17865 (comment)
sgl-kernel shipped its own AOT (ahead-of-time) cuBLASLt wrapper for batched
FP8 matrix multiplication (bmm_fp8). FlashInfer already provides
flashinfer.bmm_fp8 via its JIT system with an identical public signature
and additional backend options (cublas / cutlass / cudnn / auto). Keeping a
separate C++ implementation adds maintenance burden with no measurable
benefit.
This PR removes the redundant AOT kernel and routes sgl_kernel.bmm_fp8
directly to flashinfer.bmm_fp8, reducing ~200 lines of C++/CUDA code.
Modifications
sgl-kernel/csrc/common_extension.cc
sgl-kernel/include/sgl_kernel_ops.h
flashinfer.bmm_fp8 — public API signature is unchanged
correctness tests (FP8 dtypes × output dtypes × shapes)
benchmark using triton.testing.perf_report
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci