fix: preload dense NVFP4 decode kernels before graph capture - #31
Open
ogwhic wants to merge 1 commit into
Open
Conversation
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.
Summary
Problem
On an RTX 4070 SUPER 12 GB (Ada, SM89), Qwen3.6-35B-A3B-NVFP4 could remain in
Capturing CUDA graphs / warming upfor many minutes. GPU telemetry showed 100% SM utilization but only 0-1% memory-controller utilization and about 54 W.A native
py-spysample located the worker in:This is the ordinary eager
model.forward()before thetorch.cuda.graph(...)context, not graph capture itself. At that point automatic runtime-cache sizing had reduced free VRAM to roughly 0.7-0.8 GiB. Triton's first-launch module load was therefore occurring at the least favorable point in startup.The behavior reproduced with both the portable routed-expert backend and vLLM Marlin. Installing vLLM changes the routed MoE implementation, but dense NVFP4 shared experts and the NVFP4 LM head still use FreeToken's Triton kernels.
Fix
Traverse the
BaseOPtree after weights load, deduplicate residentNvfp4DenseLinearandNvfp4LMHeadoperations by weight/scale geometry and strides, then launch representativeM=1and maximum captured small-batch kernels. Each launch is synchronized so the CUDA module is actually loaded before runtime caches are allocated.The preload is skipped when CUDA graphs are disabled.
Validation
Test environment:
With a completely fresh
TRITON_CACHE_DIRand graph sizes[1, 2, 4]:git diff --checkand Python AST parsing also pass. The project environment does not currently include pytest, so the existing pytest suite was not run.