Skip to content

fix(b12x): make profiling warmup lifetime-safe - #516

Merged
lukealonso merged 2 commits into
fix/cudagraph-profiling-resource-lifetimefrom
fix/b12x-memory-profiling-warmup-lifetime
Aug 31, 2026
Merged

fix(b12x): make profiling warmup lifetime-safe#516
lukealonso merged 2 commits into
fix/cudagraph-profiling-resource-lifetimefrom
fix/b12x-memory-profiling-warmup-lifetime

Conversation

@voipmonitor

Copy link
Copy Markdown

Purpose

Resolve B12X launch modules before CUDA-graph memory profiling and keep every
caller-owned MoE warmup tensor alive until its asynchronous device work has
completed. An empty B12X kernel cache can otherwise initialize CUDA modules
between graph descriptors or reuse a warmup allocation while a submitted
kernel still references it.

Resulting behavior

  • Run model-provided B12X warmup after the activation-memory profile and before
    CUDA-graph memory descriptors are captured.
  • Retain MoE warmup input, output, routing, and scratch tensors through
    torch.accelerator.synchronize().
  • Keep serving kernel selection, execution plans, and steady-state inference
    unchanged. The added synchronization executes only during model startup.

Review-stack boundary

This pull request is based on #515 because profiling teardown must preserve
backend resources until graph destruction completes. Its diff contains only
B12X pre-profile warmup ordering and MoE warmup allocation ownership. The
GLM5Next full-CKV implementation is intentionally excluded.

Duplicate-work check

Searches for B12X MoE warmup buffers, CUDA-graph memory profiling warmup, and
asynchronous warmup lifetime found no matching open pull request in
local-inference-lab/vllm or vllm-project/vllm.

Validation

  • tests/model_executor/test_b12x_warmup.py: 14 passed.
  • MoE warmup allocation-lifetime regression: 1 passed, 36 deselected.
  • GPU-worker profiling-order tests: 3 passed.
  • Ruff check, Ruff format check, and git diff --check: passed.
  • GLM-5.3-Flash-NVFP4 TP4/DCP4 completed three starts with a populated kernel
    cache and one start with an empty kernel cache on physical GPUs 4, 5, 6, and
    7. Every start completed profiling and production graph capture without
    CUDA_LAUNCH_BLOCKING.
  • A 32k prefill smoke request after the empty-cache start produced 11,962
    prompt tok/s and left the service healthy.

AI assistance disclosure

OpenAI Codex assisted with diagnosis, implementation, tests, runtime
qualification, and pull-request preparation. A human maintainer must review
every changed line and understand and defend the behavior before merge.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 48 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 37b3cf9d-d4c7-44b3-80c0-a695aac6158a

📥 Commits

Reviewing files that changed from the base of the PR and between 3bcb901 and db0f144.

📒 Files selected for processing (4)
  • tests/kernels/moe/test_b12x.py
  • tests/v1/worker/test_gpu_worker.py
  • vllm/model_executor/layers/fused_moe/b12x.py
  • vllm/v1/worker/gpu_worker.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@voipmonitor

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Resolve model-provided B12X launch modules after the activation profile and before CUDA graph memory descriptors are captured. Cold B12X compile-cache starts can otherwise initialize NVFP4 MoE CUDA modules between breakable descriptors and trigger an asynchronous illegal-memory-access failure.

The call is a no-op outside CUDA SM120 and for models without B12X warmup providers. Existing kernel warmup remains responsible for the complete post-KV-cache warmup sequence.

Validated with a four-rank GLM-5.3-Flash-NVFP4 DCP4 cold-cache startup on physical GPUs 4-7, full profiling and production graph capture, one 32k prefill request, and the targeted worker/attention/CUDA-graph test suite.

(cherry picked from commit ce66580e4ed96abe8b789b0dda5e08f8ab6813a5)
B12X MoE warmup submits asynchronous kernels against caller-owned input, output, routing, and scratch tensors. Retain every launch allocation until device completion so CUDA graph profiling cannot reuse an address while warmup work still references it.

Serving kernel selection, execution plans, and steady-state inference are unchanged. The synchronization applies only during model startup.

Validation: the lifetime unit test passes; TP4/DCP4 GLM-5.3-Flash NVFP4 completes three warm-cache starts and one empty-cache start with full piecewise and full CUDA graph capture on physical GPUs 4-7. A 32k prefill smoke request succeeds after the empty-cache start.
(cherry picked from commit 7497bd43ddb5adb4d497f24cecf0b8bc698fff99)
@voipmonitor
voipmonitor force-pushed the fix/cudagraph-profiling-resource-lifetime branch from b8b7c5a to 3bcb901 Compare August 30, 2026 14:18
@voipmonitor
voipmonitor force-pushed the fix/b12x-memory-profiling-warmup-lifetime branch from 089ce1e to db0f144 Compare August 30, 2026 14:18
@voipmonitor

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lukealonso
lukealonso merged commit 552a1fc into fix/cudagraph-profiling-resource-lifetime Aug 31, 2026
1 of 2 checks passed
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.

2 participants