[jit kernel] Support per_token_group_quant_8bit jit kernel#18905
[jit kernel] Support per_token_group_quant_8bit jit kernel#18905yuan-luo wants to merge 4 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @yuan-luo, 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 introduces foundational support for per-token group 8-bit quantization within the JIT kernel framework. It provides a new CUDA kernel and its Python binding, enabling more efficient handling of quantized tensors. The changes aim to enhance performance for specific quantization strategies, although the implementation is currently a Work In Progress with known bugs that are being addressed. 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 introduces a JIT kernel for per-token group 8-bit quantization. The implementation is a work in progress and contains several issues that need to be addressed. I've identified critical compilation errors in the CUDA kernel, a significant performance issue due to redundant global memory access, and critical bugs in both the Python wrapper and the test suite. The Python wrapper incorrectly flattens tensors, leading to loss of essential shape information for the kernel. The test suite is not correctly invoking the new kernel, fails to test all code paths (like column-major layout), and will crash in its current state. My review includes detailed feedback and code suggestions to fix these problems.
python/sglang/jit_kernel/csrc/gemm/per_token_group_quant_8bit.cuh
Outdated
Show resolved
Hide resolved
python/sglang/jit_kernel/csrc/gemm/per_token_group_quant_8bit.cuh
Outdated
Show resolved
Hide resolved
python/sglang/jit_kernel/csrc/gemm/per_token_group_quant_8bit.cuh
Outdated
Show resolved
Hide resolved
python/sglang/jit_kernel/csrc/gemm/per_token_group_quant_8bit.cuh
Outdated
Show resolved
Hide resolved
|
/tag-and-rerun-ci |
|
@BBuf @DarkSharpness This PR is ready to review. Could you please help to review it? Thanks. |
|
/rerun-failed-ci |
c3f5220 to
b4f1995
Compare
|
/rerun-failed-ci |
3 similar comments
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
Can you also provide a comparison with the AOT version from sgl-kernel in the benchmark script? |
|
And we also need a new apply and gsm8k acc test comparison. |
python/sglang/jit_kernel/benchmark/bench_per_token_group_quant_8bit.py
Outdated
Show resolved
Hide resolved
a84c129 to
deeea98
Compare
Updated DeepSeek V3.2 gsm8k. No drops. |
Performance has no drops than sgl-kernel according to the gsm8k test's result. |
deeea98 to
78477c9
Compare
|
/rerun-failed-ci |
python/sglang/jit_kernel/benchmark/bench_per_token_group_quant_8bit.py
Outdated
Show resolved
Hide resolved
|
/rerun-failed-ci |
python/sglang/jit_kernel/tests/test_per_token_group_quant_8bit.py
Outdated
Show resolved
Hide resolved
78477c9 to
a4cd6a8
Compare
|
/rerun-failed-ci |
6 similar comments
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
The failed CI also failed in main. |
Motivation
Support per_token_group_quant_8bit jit kernel.

Main:
PR:


UT:
Benchmark:
Modifications
Accuracy Tests
DeepSeek V3.2
Main:
PR:
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci