Repository navigation
Conversation
With --linear-backend flashinfer_cutedsl, every unquantized BF16 linear goes through the opaque vllm.cuda_flashinfer_bf16_gemm op. Since vllm-project#60434 the op passes M > 32 to FlashInfer, which runs autotuned cuBLASLt there. Each call still pays the dispatcher, vLLM's eligibility checks, FlashInfer's Python path (backend requirement check, runner selection, AutoTuner lookup) and Inductor's output asserts on the host. Steps above the CUDA graph capture size pay this on every linear, which raises TTFT. - Split the compile ranges at 32 for this backend and add a post-grad pass that replaces the op with aten linear in the ranges above it, so Inductor emits its extern mm/addmm like the default backend. - Outside torch.compile (enforce_eager, opaque ops such as moe_forward_shared), send M > 32 to F.linear as well. - Add a 32-token FlashInfer autotune pass. The max_num_batched_tokens pass no longer reaches the op, so the CuTeDSL M <= 32 buckets would otherwise never be tuned. - Gate all of this on KernelConfig.use_flashinfer_cutedsl_bf16_gemm. Signed-off-by: Bowen Wang <bowen@inferact.ai> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
6 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
With
--linear-backend flashinfer_cutedsl, every unquantized BF16 linear goes through the opaquevllm.cuda_flashinfer_bf16_gemmop. FlashInfer runs its CuTeDSL kernel only for M ≤ 32; since #60434, larger M goes to FlashInfer's autotuned cuBLASLt. On steps above the CUDA graph capture size, each of those calls still costs 145–167 µs of host time: the dispatcher, the eligibility checks, FlashInfer's Python path and Inductor's output asserts.F.linearcosts about 20 µs. Prefill steps become host-bound, and TTFT rises by 34–48% (table below).This PR:
F.linearoutside torch.compile, i.e. with enforce_eager and inside opaque ops such asmoe_forward_shared.max_num_batched_tokenspass no longer reaches the op, so the CuTeDSL buckets would otherwise never be tuned.KernelConfig.use_flashinfer_cutedsl_bf16_gemm.At these shapes, FlashInfer's tuned cuBLASLt and aten mm take the same GPU time. Measured with CUPTI inside CUDA graphs, on 14 Qwen3.5 linear shapes at M = 64–16384: the per-forward ratio is 0.96–1.01, and at M = 1031 both pick the same nvjet kernel.
Test Plan
GB200 (SM100), CUDA 13, torch 2.13, FlashInfer 0.7.1 (#60948). The serving numbers compare main
258b97ff6bwith this change on top of it; the branch has since been rebased ontoec317a4618without conflicts, and the unit tests below were re-run there.Each model runs on one node: a cold round, then 3 interleaved warm rounds. All arms are seeded with one FlashInfer autotune file.
Test Result
The new pass test and the updated warmup test fail on main and pass here.
TP1, mean over 3 rounds. "flag" means
--linear-backend flashinfer_cutedsl.35B is Qwen3.5-35B-A3B and 4B is Qwen3.5-4B.
Not a duplicate: I found no open PR that changes the dispatch of
cuda_flashinfer_bf16_gemmor adds per-range linear passes. This complements #60434. If #59021 lands,use_flashinfer_cutedsl_bf16_gemmshould read the effective unquantized backend. #59244 edits the same autotune token-count function.AI assistance (Claude Code) was used for the code, the tests, the benchmarks and this description.
🤖 Generated with Claude Code