Skip to content

Set wired_limit to fix low GPU utilization#65

Merged
ericcurtin merged 1 commit into
vllm-project:mainfrom
otarkhan:fix/set-wired-limit-for-gpu-performance
Jan 8, 2026
Merged

Set wired_limit to fix low GPU utilization#65
ericcurtin merged 1 commit into
vllm-project:mainfrom
otarkhan:fix/set-wired-limit-for-gpu-performance

Conversation

@otarkhan

@otarkhan otarkhan commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Without wired_limit set, model weights cannot stay pinned in GPU-accessible memory, causing frequent memory paging and GPU stalls. This results in ~30% GPU utilization instead of ~100%.

This fix sets max_recommended_working_set_size as the wired limit before model loading, matching the fix in ml-explore/mlx-lm#652.

Changes

  • Set wired_limit in MetalWorker.init_device() for v1 engine
  • Set wired_limit in MetalModelRunner.load_model() for legacy path
  • Use new mx.set_wired_limit() API with fallback to deprecated mx.metal.set_wired_limit()
  • Add error handling for graceful degradation

Test plan

  • Verified GPU utilization increases from ~30% to ~100% on Mac Studio with MiniMax-M2.1-Q8
  • Confirmed log message shows wired_limit being set on startup

@otarkhan
otarkhan force-pushed the fix/set-wired-limit-for-gpu-performance branch from 0fe0374 to cc72de2 Compare January 8, 2026 12:01
@ericcurtin

Copy link
Copy Markdown
Collaborator

Thanks for the PR. Looks good.

Could we avoid duplicating the code and extract to a shared function?

Without wired_limit, model weights cannot stay pinned in GPU-accessible
memory, causing frequent memory paging and GPU stalls. This results in
~30% GPU utilization instead of ~100%.

The fix sets max_recommended_working_set_size as the wired limit before
model loading, matching the fix in ml-explore/mlx-lm#652.

Changes:
- Set wired_limit in MetalWorker.init_device() for v1 engine
- Set wired_limit in MetalModelRunner.load_model() for legacy path
- Use new mx.set_wired_limit() API with fallback to deprecated API
- Add error handling for graceful degradation

Signed-off-by: otarkhan <osama.taha1994@gmail.com>
@otarkhan
otarkhan force-pushed the fix/set-wired-limit-for-gpu-performance branch from cc72de2 to 7a27935 Compare January 8, 2026 13:57
@otarkhan

otarkhan commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the PR. Looks good.

Could we avoid duplicating the code and extract to a shared function?

Done. Didn't want to create a new utils file so I added it to platform

@ericcurtin
ericcurtin merged commit cb03928 into vllm-project:main Jan 8, 2026
5 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