Skip to content

[Fix] deep_gemm: Prevent startup warmup OOMs when smaller buffers fit - #32686

Closed
ormandj wants to merge 1 commit into
sgl-project:mainfrom
ormandj:fix/deepgemm-warmup-low-memory
Closed

ormandj wants to merge 1 commit into
sgl-project:mainfrom
ormandj:fix/deepgemm-warmup-low-memory

Conversation

@ormandj

@ormandj ormandj commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

DeepGEMM compile-all warmup stops reducing its buffer size at M=2048, even when a smaller requested shape would fit. If the smallest requested shape cannot fit, attempting the allocation still risks a startup OOM.

Modifications

Continue halving the buffer size down to the smallest requested M. Skip compile-all warmup if that minimum exceeds the available-memory estimate; first use may still JIT the uncached shape. Preserve main's compile lock and current-device memory query, kernel selection and cache keys.

Accuracy Tests

5 CPU tests passed, covering reduced allocation, skipping an oversized minimum and symmetric-memory context restoration. The regression exercises reduction below the 2048 floor. GPU startup warmup has not been tested.

Speed Tests and Profiling

Only affects compile-all warmup. A skipped shape may compile on first use. No startup-duration benchmark was run.

Checklist

  • Format changed code.
  • Run regression tests described above.

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

Developed with AI assistance.


CI States

Latest PR Test (Base): ❌ Run #37577724631
Latest PR Test (Extra): ❌ Run #37577724516
Latest PR Test (AMD ROCm 10): ❌ Run #37577724488

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@ormandj
ormandj force-pushed the fix/deepgemm-warmup-low-memory branch from 8928444 to 15c0902 Compare July 29, 2026 00:10
@ormandj ormandj changed the title fix: reduce DeepGEMM warmup buffers below 4096 Prevent DeepGEMM startup warmup OOMs when smaller buffers fit Sep 6, 2026
@ormandj
ormandj force-pushed the fix/deepgemm-warmup-low-memory branch from 15c0902 to 36574b0 Compare September 6, 2026 20:42
@ormandj
ormandj force-pushed the fix/deepgemm-warmup-low-memory branch from 36574b0 to 6662017 Compare September 30, 2026 01:20
@ormandj

ormandj commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Updated the code and PR body. DeepGEMM warmup keeps reducing its buffer size down to the smallest requested M. Compile-all warmup is skipped when that minimum exceeds the available-memory estimate, allowing first-use JIT of uncached shapes.

@ormandj
ormandj force-pushed the fix/deepgemm-warmup-low-memory branch from 6662017 to bd62024 Compare October 7, 2026 05:43
@ormandj ormandj changed the title Prevent DeepGEMM startup warmup OOMs when smaller buffers fit [Fix] deep_gemm: Prevent startup warmup OOMs when smaller buffers fit Oct 19, 2026
detain added a commit to detain/sglang that referenced this pull request Oct 20, 2026
…/deferred/avoid map

- 3A [24-35]: NVFP4 MoE boot sgl-project#39807/sgl-project#40173, block-FP8 TP refine sgl-project#42566, k-pool indexer split sgl-project#43619,
  SM120 skinny GEMM sgl-project#42865/sgl-project#42867, DeepGEMM warmup guards sgl-project#32686/sgl-project#43712, autotune sgl-project#43363/sgl-project#40420,
  mHC overlap sgl-project#42985, FP8-einsum precompile sgl-project#42821.
- 3B [36-43]: PCIe CustomAllreduce VMM sgl-project#44448, EP local expert ids sgl-project#44480, shm TP broadcast sgl-project#44202,
  PCIe-IPC all-gather sgl-project#42863 + multicast guard sgl-project#41888, TP-sampling consistency sgl-project#41916/sgl-project#38565,
  draft embed/lm_head VRAM sgl-project#37155.
- sgl-project#39807 toolchain commit verified safe against our CUDA_HOME=12.9 pin (cu13 fallback needs CUDA_HOME unset AND glibc>=2.41; we are 2.39).
- stack_want.txt: execution-status banner. Branch tip 5dd6ec7.
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @ormandj. Closing this because you have 46 PRs open and none updated in 7 days, over our soft cap of 5 for idle PRs.

Reopen the two or three you most want reviewed - a short active set moves faster than a long idle one.

Some directories moved recently, so an older branch may need retargeting:
sgl-kernel/ -> python/sglang/kernels/aot/, python/sglang/jit_kernel/
-> python/sglang/kernels/jit/, docs/ -> docs/docs/ (.mdx),
bench_serving.py -> benchmark/serving.py, test/srt/ -> test/registered/.

@github-actions github-actions Bot closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant