Stabilize local vLLM DeepGEMM warmup startup#2292
Conversation
|
To discuss with Julio and Jeremy |
|
I have no problem with this. |
Greptile SummaryThis PR fixes a reproducible JP20 local-harness failure where
|
| Filename | Overview |
|---|---|
| nemo_retriever/src/nemo_retriever/models/inference/vllm.py | Adds apply_vllm_startup_defaults() using os.environ.setdefault (preserves user override), calls it in create_vllm_llm before LLM construction, and exports it via all. Logic is correct and minimal. |
| nemo_retriever/src/nemo_retriever/models/local/nemotron_parse_v1_2.py | Adds apply_vllm_startup_defaults() call before the vllm.LLM import/construction in NemotronParseV12.init. Placement is correct — env var is set before vLLM's process startup code runs. |
| nemo_retriever/src/nemo_retriever/models/local/nemotron_rerank_vl_v2.py | Adds apply_vllm_startup_defaults() call before vllm.LLM import/construction in NemotronRerankVLV2VLLM.init. Change is minimal and correctly placed. |
| nemo_retriever/src/nemo_retriever/models/local/nemotron_vlm_captioner.py | Adds apply_vllm_startup_defaults() call after profile resolution but before vllm.LLM import/construction in NemotronVLMCaptioner.init. Correct placement. |
| nemo_retriever/tests/test_vllm_embed.py | Adds TestVllmStartupDefaults covering setdefault semantics and user-override preservation, plus a test in TestCreateVllmLlm verifying the env var is set after create_vllm_llm runs. |
| nemo_retriever/tests/test_nemotron_parse_v1_2.py | New test file with SPDX header. Uses side_effect to verify VLLM_DEEP_GEMM_WARMUP is set at the exact moment LLM() is called during NemotronParseV12 construction. |
| nemo_retriever/tests/test_nemotron_rerank_vl_v2.py | Adds test_applies_vllm_startup_defaults_before_constructing_llm using side_effect pattern to verify env var ordering at LLM construction time. |
| nemo_retriever/tests/test_caption_model_profiles.py | Adds deep_gemm_warmup capture to FakeLLM.init and a new test that verifies VLLM_DEEP_GEMM_WARMUP=="skip" is visible at FakeLLM construction time during NemotronVLMCaptioner init. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User
participant NRLModel as NRL Model __init__
participant ApplyDefaults as apply_vllm_startup_defaults()
participant Env as os.environ
participant VLLM as vllm.LLM()
Note over User,VLLM: Embedding path (via create_vllm_llm)
User->>NRLModel: LlamaNemotronEmbed1BV2Embedder.__init__
NRLModel->>ApplyDefaults: create_vllm_llm() → apply_vllm_startup_defaults()
ApplyDefaults->>Env: setdefault("VLLM_DEEP_GEMM_WARMUP", "skip")
ApplyDefaults-->>NRLModel: (returns)
NRLModel->>VLLM: "LLM(**kwargs) — warmup=skip visible"
Note over User,VLLM: Direct-constructor paths (new call sites)
User->>NRLModel: NemotronParseV12 / NemotronRerankVLV2VLLM / NemotronVLMCaptioner __init__
NRLModel->>ApplyDefaults: apply_vllm_startup_defaults()
ApplyDefaults->>Env: setdefault("VLLM_DEEP_GEMM_WARMUP", "skip")
ApplyDefaults-->>NRLModel: (returns)
NRLModel->>VLLM: "LLM(**kwargs) — warmup=skip visible"
Note over Env: User override preserved: if VLLM_DEEP_GEMM_WARMUP already set, setdefault is a no-op
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User
participant NRLModel as NRL Model __init__
participant ApplyDefaults as apply_vllm_startup_defaults()
participant Env as os.environ
participant VLLM as vllm.LLM()
Note over User,VLLM: Embedding path (via create_vllm_llm)
User->>NRLModel: LlamaNemotronEmbed1BV2Embedder.__init__
NRLModel->>ApplyDefaults: create_vllm_llm() → apply_vllm_startup_defaults()
ApplyDefaults->>Env: setdefault("VLLM_DEEP_GEMM_WARMUP", "skip")
ApplyDefaults-->>NRLModel: (returns)
NRLModel->>VLLM: "LLM(**kwargs) — warmup=skip visible"
Note over User,VLLM: Direct-constructor paths (new call sites)
User->>NRLModel: NemotronParseV12 / NemotronRerankVLV2VLLM / NemotronVLMCaptioner __init__
NRLModel->>ApplyDefaults: apply_vllm_startup_defaults()
ApplyDefaults->>Env: setdefault("VLLM_DEEP_GEMM_WARMUP", "skip")
ApplyDefaults-->>NRLModel: (returns)
NRLModel->>VLLM: "LLM(**kwargs) — warmup=skip visible"
Note over Env: User override preserved: if VLLM_DEEP_GEMM_WARMUP already set, setdefault is a no-op
Reviews (5): Last reviewed commit: "Merge branch 'main' into codex/vllm-deep..." | Re-trigger Greptile
Signed-off-by: Jacob Ioffe <jioffe@nvidia.com>
65c00de to
c1dbf5b
Compare
Summary
VLLM_DEEP_GEMM_WARMUP=skipviaos.environ.setdefault(...).vllm.LLMconstructor: embedding, VL rerank, captioning, and Nemotron Parse.VLLM_USE_DEEP_GEMM=0and do not hard-codeCUDA_HOME; users can still opt into another vLLM warmup mode explicitly.Why
JP20 local harness runs have been failing during ingest before any rows are written. The failing artifact points to local embedding/vLLM startup, not caption or rerank:
results.json:exit_code: 10,failed_phase: ingestingest_plan.json:caption: null, localnvidia/llama-nemotron-embed-1b-v2,local_ingest_embed_backend: "vllm"query_plan.json:rerank: falseOriginal trace:
Downstream symptom:
When DeepGEMM warmup can help
This change skips DeepGEMM's ahead-of-time kernel warmup; it does not disable runtime DeepGEMM. With warmup skipped, an eligible kernel is JIT-compiled when first encountered during model execution.
Warmup is useful when all of the following are true:
NRL's default local embedding, VL rerank, Nemotron Parse, and caption paths use BF16, so they are not expected to benefit. The realistic NRL candidates are the optional local FP8 caption profiles, especially the FP8 Nemotron 3 Omni MoE model. For those deployments, operators can opt into
VLLM_DEEP_GEMM_WARMUP=relaxfirst, orfullwhen every possible GEMM shape must be compiled before accepting work.Review question
Is skipping optional DeepGEMM warmup the right default for NRL local startup reliability, while letting Hopper/Blackwell performance owners opt into
VLLM_DEEP_GEMM_WARMUP=fullor another upstream-supported mode?Validation
uv run --project nemo_retriever pytest nemo_retriever/tests/test_vllm_embed.py nemo_retriever/tests/test_nemotron_rerank_vl_v2.py nemo_retriever/tests/test_caption_model_profiles.py nemo_retriever/tests/test_nemotron_parse_v1_2.py -q100 passed, 2 warningsmainwith Typer 0.27 help support; combined CLI-contract and DeepGEMM-focused suite:105 passed, 2 warningspython -m compileallon changed Python filesgit diff --check