Skip to content

F12/F33: SGLang base_gpu_id is not 0 in RLix mode — doc/code mismatch (draft, needs direction)#31

Draft
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/m11-mvp-testfrom
TianyeGGBond:tianye/f33-base-gpu-id-doc-vs-code
Draft

F12/F33: SGLang base_gpu_id is not 0 in RLix mode — doc/code mismatch (draft, needs direction)#31
TianyeGGBond wants to merge 1 commit into
rlops:zhenyu/m11-mvp-testfrom
TianyeGGBond:tianye/f33-base-gpu-id-doc-vs-code

Conversation

@TianyeGGBond

Copy link
Copy Markdown

Draft / discussion vehicle. Issues are disabled on this repo, so this is filed as a draft PR. It contains only the safe documentation fix (Option A). Please pick a direction before it is un-drafted.

The mismatch

The F12 design docstring promises that in RLix / shared-PG mode SGLang runs with base_gpu_id=0 (each rollout worker gets its own CUDA_VISIBLE_DEVICES, so post-CVD it only sees cuda:0..tp-1). The rollout code does not implement this — base_gpu_id is the physical GPU id.

Docstring (miles/ray/placement_provider.py, F33 note, before this PR):

SGLang base_gpu_id MUST be 0 in RLix mode. CVD is set per worker … SGLang itself reads base_gpu_id=0.

Actual code (miles/ray/rollout.py):

  • The SGLang actor's env_vars uses NOSET_VISIBLE_DEVICES_ENV_VARS_LIST (all "1") — Ray does not set CUDA_VISIBLE_DEVICES for the rollout actor. Unlike the train path in actor_group.py, there is no per-worker CVD.
  • base_gpu_id = int(reordered_gpu_ids[gpu_index]) is the physical id (e.g. 2 for inference pool [2, 3]).
  • sglang_engine._to_local_gpu_id(base) returns the id unchanged when CVD is unset, so base_gpu_id stays physical, not 0.

Net: for infer_device_mapping=[2, 3] SGLang launches with base_gpu_id=2, contradicting "MUST be 0".

Options

Option A — fix the docs (this draft). One-hunk change to the placement_provider.py F33 note describing actual behavior (base_gpu_id = physical id; rollout actors do not get per-worker CVD). Zero behavior change.

Option B — fix the code to honor base_gpu_id=0. Give each rollout actor a per-worker CUDA_VISIBLE_DEVICES (mirroring the train path) and pass base_gpu_id=0. This is a real GPU-scheduling change and needs validation on multi-GPU hardware (colocate vs non-colocate, tp>1, multi-node); it should not land unverified. Not included here.

Ask

Which direction do you want? If A, this draft can be reviewed as-is. If B, I'll open a separate PR once it can be validated on GPUs.

The placement_provider docstring claimed SGLang base_gpu_id "MUST be 0"
via per-worker CVD, but rollout actors use NOSET_VISIBLE_DEVICES and the
launch passes the physical GPU id. Describe actual behavior. See PR body
for the code-fix alternative (Option B) that needs GPU validation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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