Skip to content

[Bugfix] Avoid OpenMP thread reallocation in CPU torch compile#37391

Merged
jikunshang merged 1 commit intovllm-project:mainfrom
bigPYJ1151:fix_compile_threads
Mar 18, 2026
Merged

[Bugfix] Avoid OpenMP thread reallocation in CPU torch compile#37391
jikunshang merged 1 commit intovllm-project:mainfrom
bigPYJ1151:fix_compile_threads

Conversation

@bigPYJ1151
Copy link
Copy Markdown
Member

@bigPYJ1151 bigPYJ1151 commented Mar 18, 2026

Purpose

CPU torch compile will generate code with num_threads() by default, which causes OpenMP thread reallocation and breaks thread binding. This PR disabled it.

Test Plan

CI tests

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
@bigPYJ1151 bigPYJ1151 added this to the v0.18.0 cherry picks milestone Mar 18, 2026
@bigPYJ1151 bigPYJ1151 added the ready ONLY add when PR is ready to merge/full CI is needed label Mar 18, 2026
@mergify mergify bot added cpu Related to CPU backends bug Something isn't working labels Mar 18, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the CPU platform's torch.compile configuration to address an issue with OpenMP thread reallocation that can break thread binding. The change sets the cpp.dynamic_threads option to True in the inductor compile configuration. This makes the number of threads a dynamic argument to the compiled kernels, rather than a hardcoded value. The change is confined to the CPU platform configuration and appears to correctly solve the described problem.

@jikunshang jikunshang enabled auto-merge (squash) March 18, 2026 06:12
@jikunshang jikunshang merged commit 2618012 into vllm-project:main Mar 18, 2026
49 checks passed
khluu pushed a commit that referenced this pull request Mar 18, 2026
Signed-off-by: jiang1.li <jiang1.li@intel.com>
(cherry picked from commit 2618012)
wendyliu235 pushed a commit to wendyliu235/vllm-public that referenced this pull request Mar 18, 2026
fxdawnn pushed a commit to fxdawnn/vllm that referenced this pull request Mar 19, 2026
maoxx241 pushed a commit to maoxx241/vllm that referenced this pull request Mar 24, 2026
…project#37391)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
(cherry picked from commit 2618012)
SouthWest7 pushed a commit to SouthWest7/vllm that referenced this pull request Mar 27, 2026
khairulkabir1661 pushed a commit to khairulkabir1661/vllm that referenced this pull request Mar 27, 2026
Monishver11 pushed a commit to Monishver11/vllm that referenced this pull request Mar 27, 2026
…project#37391)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
Signed-off-by: Monishver Chandrasekaran <monishverchandrasekaran@gmail.com>
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
vrdn-23 pushed a commit to vrdn-23/vllm that referenced this pull request Mar 30, 2026
…project#37391)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
Signed-off-by: Vinay Damodaran <vrdn@hey.com>
EricccYang pushed a commit to EricccYang/vllm that referenced this pull request Apr 1, 2026
…project#37391)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
Signed-off-by: EricccYang <yangyang4991@gmail.com>
liuchenbing2026 pushed a commit to liuchenbing2026/vllm that referenced this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cpu Related to CPU backends ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants