Skip to content

[sglang-miles] Cherry-pick #24766: Fix NUMA NVML handle resolution under shuffled CUDA_VISIBLE_DEVICES - #24901

Merged
ByronHsu merged 1 commit into
sglang-milesfrom
byron/cp-24766-to-sglang-miles
May 10, 2026
Merged

[sglang-miles] Cherry-pick #24766: Fix NUMA NVML handle resolution under shuffled CUDA_VISIBLE_DEVICES#24901
ByronHsu merged 1 commit into
sglang-milesfrom
byron/cp-24766-to-sglang-miles

Conversation

@ByronHsu

Copy link
Copy Markdown
Collaborator

Summary

Cherry-pick of #24766 (merge commit 7edb4c3) onto sglang-miles.

  • Resolves CUDA logical id via torch.cuda._get_nvml_device_index before calling nvmlDeviceGetHandleByIndex, so NUMA binding follows reordered CUDA_VISIBLE_DEVICES
  • Falls back to original index with a warning on torch builds lacking the helper
  • Enriches numactl debug string with logical/physical GPU ids and CUDA_VISIBLE_DEVICES

Conflict resolution: Minor conflict in configure_subprocess control flow in numa_utils.py (sglang-miles had a slightly different structure); resolved by taking the upstream version.

Test plan

  • Existing NUMA tests should pass
  • Manual verification on multi-GPU nodes with shuffled CVD

Made with Cursor

…E_DEVICES (#24766)

Co-authored-by: Byron Hsu <byron@periodiclabs.ai>
Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 7edb4c3)

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

Copy link
Copy Markdown
Contributor

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 improves NUMA node affinity detection by correctly mapping logical CUDA device indices to physical NVML device indices, which is essential when CUDA_VISIBLE_DEVICES reorders or subsets GPUs. It introduces a helper function _get_nvml_device_index that leverages PyTorch's internal mapping and enhances debug logging in configure_subprocess to include logical and physical GPU IDs. I have no feedback to provide as there were no review comments to evaluate.

@ByronHsu
ByronHsu merged commit 2e22b49 into sglang-miles May 10, 2026
2 checks passed
@ByronHsu
ByronHsu deleted the byron/cp-24766-to-sglang-miles branch May 10, 2026 19:05
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.

1 participant