Repository navigation
perf(server): ship FlashInfer's prebuilt JIT modules in the sglang-cu130 bundle - #988
Conversation
…130 bundle A new sglang-cu130 container compiled FlashInfer's JIT modules with nvcc the first time each was used: the sampling module during the sampled warmup, and further modules while the engine starts. flashinfer-jit-cache 0.6.18+cu130 carries those modules prebuilt for sm_80 through sm_120, and FlashInfer loads them instead of compiling. The wheel comes from FlashInfer's GitHub release through a source pin, like the other cu130 wheels whose index omits upload timestamps.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
A new
sglang-cu130container compiles FlashInfer's JIT modules with nvcc the first time it uses each one:On
Qwen/Qwen3.8-27B-FP8, these compiles add about 70 s to a load on an RTX PRO 6000 and about 115 s on an H100 (see Evidence).Change
The
sglang-cu130bundle now depends onflashinfer-jit-cache==0.6.18: FlashInfer's prebuilt JIT modules for CUDA 13.0, matching the bundle'sflashinfer-python0.6.18. When a module is present in the package, FlashInfer loads it instead of compiling.exceptions.jsonpins the exact GitHub release wheel and its SHA256, as it already does forsglang-kernel,sgl-deep-gemmandsgl-deep-ep.cuda13-sglang-cu130-amd64is recompiled with its existing cutoffs (--exclude-newer 2026-10-18T00:00:00Z --root-exclude-newer 2026-11-06T20:00:00Z). The only package added isflashinfer-jit-cache 0.6.18+cu130.flashinfer-jit-cacheis the0.6.18+cu130variant;flashinfer-python;samplingmodule is present.What FlashInfer 0.6.18 documents and does.
flashinfer-jit-cacheas a "Pre-built kernel cache for specific CUDA versions".flashinfer/jit/env.pytakes its AOT directory from the installedflashinfer_jit_cachepackage. It refuses a version that does not matchflashinfer-python, so the bundle comment records that this pin moves with SGLang'sflashinfer-pythonpin.flashinfer/jit/core.pyloads<aot_dir>/<module>/<module>.sowhen that file exists, and builds the module otherwise.sampling.socarries SASS for sm_80, 89, 90, 100, 103 and 120, and no PTX.Cost. The wheel is 969 MiB compressed and 1.58 GB unpacked, and the cu130 image grows by that much. SGLang's own image installs this package only when
INSTALL_FLASHINFER_JIT_CACHE=1. The chart's optional persistentkernelCachestill applies on top of it: it also keeps the Triton, DeepGEMM and CuTe caches, which this package does not cover.Evidence
Setup.
Qwen/Qwen3.8-27B-FP8, default profile;sie-server serve -b sglang-cu130 --preload; this repository at a23a94f.SIE_SGLANG_KERNEL_CACHE_ROOT) per run.PYTHONPATH.HOME, and with it SGLang's own JIT cache. See the correction below.loaded;Model warmup start/endmarkers;Medians of 3:
sampling.socompiledSIE_SGLANG_KERNEL_CACHE_ROOT(Triton, DeepGEMM, CuTe, TorchInductor, CUDA and SGLang, as well as FlashInfer), so they go 10 s further on RTX PRO 6000 and 82 s further on H100. That is what the optional persistent kernel cache adds on top of this change. Which of those caches accounts for the H100 difference was not measured.Correction: SGLang's own JIT cache was shared across runs. SGLang 0.5.20 builds its own JIT kernels under
SGLANG_JIT_CACHE_DIR. That defaults to~/.cache/sglang/jitand does not followSGLANG_CACHE_DIR(python/sglang/kernels/jit/utils/compile/cache.py), soSIE_SGLANG_KERNEL_CACHE_ROOTdoes not cover it. Every run after run 0 reused the SGLang JIT kernels that run 0 built.A follow-up run gave each run a fresh
HOME, with the same model, server and commit, 4 CPUs, and this wheel installed in every run:~/.cache/sglangOn an RTX PRO 6000, a new container with this change therefore loads in about 136 s. SGLang's own JIT kernels account for about 77 s of that, and this change does not cover them. Bringing
SGLANG_JIT_CACHE_DIRunder the kernel cache root is left to a separate change.Checks.
python tools/ci/bundle_lock.py checkpasses.tools/ci/tests/test_bundle_lock.pyandpackages/sie_server/tests/core/test_bundle_lock.pypass (58).packages/sie_server/tests/core/test_bundle_image_resolution.pypasses (19), run withSIE_RUN_IMAGE_RESOLUTION=1and uv 0.9.28.tools/ci/tests/test_cuda13_image_smoke.pypasses (11).mise run lintpasses.Not covered. The lab loaded the wheel from
PYTHONPATH, not from an image built from this lock. Thecuda13-sglang-cu130image workflow builds that image.Summary by CodeRabbit