Skip to content

[CPU][Spec Decode] Warn about throughput loss when libiomp5 is not preloaded#44419

Merged
bigPYJ1151 merged 6 commits into
vllm-project:mainfrom
jmamou:cpu-sd-iomp-warning
Jun 8, 2026
Merged

[CPU][Spec Decode] Warn about throughput loss when libiomp5 is not preloaded#44419
bigPYJ1151 merged 6 commits into
vllm-project:mainfrom
jmamou:cpu-sd-iomp-warning

Conversation

@jmamou

@jmamou jmamou commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Add an explicit warning when speculative decoding is enabled on CPU without libiomp5 in LD_PRELOAD. Without Intel's OpenMP runtime, SD throughput drops by ~2× due to the overhead of GNU libgomp in the frequent short parallel regions that speculative decoding uses.

Motivation

While investigating issue #44191, we discovered that the performance gap between the official Docker image and source builds is entirely explained by libiomp5 being preloaded in the Docker entrypoint but not in typical conda/venv setups.

Benchmark (Xeon 8580, Llama-3.1-8B + Llama-3.2-1B, k=7, BS=1):

Config SD TPOT Speedup
Without libiomp5 in LD_PRELOAD 115.6 ms 1.37×
With libiomp5 in LD_PRELOAD 58.1 ms 2.74×

The existing generic warning is easy to overlook. This PR adds a targeted warning specifically for the SD + missing iomp case, quantifying the impact and suggesting the fix.

Changes

  • check_preloaded_libs now returns a bool indicating whether the library was found
  • When speculative decoding is configured and libiomp is missing, emit an additional warning with the expected impact (~2× throughput loss) and the suggested LD_PRELOAD command
  • Attempt to locate libiomp5.so via ctypes.util.find_library and include the path in the hint

Test Plan

  • Verified on Xeon 8580 that the warning fires when launching SD without LD_PRELOAD
  • Verified that the warning does not fire when libiomp5.so is in LD_PRELOAD
  • Verified that the warning does not fire for non-SD workloads (even without iomp)
  • No functional change to inference behavior

@mergify

mergify Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@mergify mergify Bot added documentation Improvements or additions to documentation ci/build deepseek Related to DeepSeek models frontend nvidia rocm Related to AMD ROCm labels Jun 3, 2026
@mergify mergify Bot added the cpu Related to CPU backends label Jun 3, 2026
@github-project-automation github-project-automation Bot moved this to Todo in AMD Jun 3, 2026
@mergify mergify Bot added the v1 label Jun 3, 2026
@mergify

mergify Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @jmamou.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Jun 3, 2026
@jmamou
jmamou force-pushed the cpu-sd-iomp-warning branch from 14d7aaa to c8f8f5f Compare June 3, 2026 12:16
@mergify mergify Bot removed the needs-rebase label Jun 3, 2026
@jmamou
jmamou marked this pull request as ready for review June 3, 2026 12:21
…eloaded

Add a targeted warning when speculative decoding is enabled on CPU
without libiomp5 in LD_PRELOAD. Without Intel's OpenMP runtime, SD
throughput drops by ~2x due to GNU libgomp overhead in the frequent
short parallel regions that speculative decoding uses.

Discovered while investigating issue vllm-project#44191 where the reported
regression was actually caused by missing LD_PRELOAD in source builds
vs the Docker image which sets it automatically.

Signed-off-by: jmamou <[email protected]>

@bigPYJ1151 bigPYJ1151 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your investigation @jmamou :) I have some suggestions, please check them.
It is surprising the OpenMP version will affect SD performance on CPU, usually the impact is very limited.

Comment thread vllm/v1/worker/cpu_worker.py Outdated
Comment thread vllm/v1/worker/cpu_worker.py Outdated
@jmamou

jmamou commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

This pull request has merge conflicts that must be resolved before it can be merged. Please rebase the PR, @jmamou.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@bigPYJ1151

Thanks for the feedback!

I agree it's surprising — for standard inference (large GEMMs dominating runtime), the difference between libiomp5 and libgomp is negligible. But speculative decoding is a different workload pattern: SD performs many very short parallel regions per token — the draft model runs k single-token forward passes, then the target model runs a short verify pass. Each of these is a small computation relative to batch inference. With libgomp, threads spin down between regions (its default blocktime is effectively 0), so every parallel region pays thread wake-up / barrier overhead. With libiomp5 + KMP_BLOCKTIME > 0, threads stay spinning between regions, which eliminates this cost.

In standard (non-SD) inference, a single forward pass is large enough that the fork-join overhead is amortized. In SD, you're doing ~2k+1 short passes per generation step, so the overhead accumulates.

The non-SD baseline is ~159 ms TPOT in both cases (confirming the impact is SD-specific).

@github-project-automation github-project-automation Bot moved this to Ready in NVIDIA Jun 8, 2026
@bigPYJ1151 bigPYJ1151 added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 8, 2026
@bigPYJ1151
bigPYJ1151 enabled auto-merge (squash) June 8, 2026 09:01
@bigPYJ1151
bigPYJ1151 merged commit d5fe994 into vllm-project:main Jun 8, 2026
57 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AMD Jun 8, 2026
@github-project-automation github-project-automation Bot moved this from Ready to Done in NVIDIA Jun 8, 2026
@jmamou
jmamou deleted the cpu-sd-iomp-warning branch June 8, 2026 10:47
ekagra-ranjan pushed a commit to ekagra-ranjan/vllm that referenced this pull request Jun 9, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Signed-off-by: Ekagra Ranjan <[email protected]>
waqahmed-amd-fi pushed a commit to waqahmed-amd-fi/vllm that referenced this pull request Jun 10, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Signed-off-by: Waqar Ahmed <[email protected]>
Saddss pushed a commit to Saddss/vllm that referenced this pull request Jun 14, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
vivek8123 pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Jun 18, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
divineearthly pushed a commit to divineearthly/vllm that referenced this pull request Jun 19, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Signed-off-by: divineearthly <[email protected]>
nkzhenhua pushed a commit to nkzhenhua/vllm that referenced this pull request Jun 24, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
ohsono pushed a commit to ohsono/vllm that referenced this pull request Jul 3, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Dao007forever pushed a commit to Dao007forever/vllm that referenced this pull request Jul 18, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
philippesic pushed a commit to philippesic/vllm-semantic-cache that referenced this pull request Jul 19, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
plasticchris pushed a commit to plasticchris/vllm that referenced this pull request Jul 20, 2026
…eloaded (vllm-project#44419)

Signed-off-by: jmamou <[email protected]>
Signed-off-by: Jonathan Mamou <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Co-authored-by: Li, Jiang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build cpu Related to CPU backends deepseek Related to DeepSeek models documentation Improvements or additions to documentation frontend nvidia ready ONLY add when PR is ready to merge/full CI is needed rocm Related to AMD ROCm speculative-decoding v1

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants