Skip to content

weight cache: key daemon paths by GPU UUID - #36101

Merged
alexnails merged 3 commits into
sgl-project:mainfrom
TarangKhanna:weight-cache-registry-tarang
Aug 31, 2026
Merged

alexnails merged 3 commits into
sgl-project:mainfrom
TarangKhanna:weight-cache-registry-tarang

Conversation

@TarangKhanna

@TarangKhanna TarangKhanna commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Weight cache daemon discovery currently uses distributed rank in the Unix socket and ready file paths. Rank is only unique within one distributed job.

Two independent jobs on the same host can therefore both have rank 0 while running on different physical GPUs, allowing one job to discover the other job's daemon.

Change

Use the physical GPU UUID for daemon socket and ready file identity instead of distributed rank.

The existing launcher topology is unchanged. Daemons are still placed using the existing PP and TP local GPU mapping. When cleanup or readiness needs the daemon path, the launcher derives the UUID from that same local GPU id.

The client follows the same rule. If no explicit weight_cache_socket is configured, IpcModelLoader derives the daemon socket from the UUID of the GPU it is actually loading onto.

Weight compatibility remains separate from discovery. After connecting, the existing CacheConfig check still validates the model and shard configuration, including TP, PP, DP, EP, quantization, dtype, and revision.

Scope

This change is limited to node local daemon discovery identity.

Validation

  1. test/registered/unit/model_loader/test_weight_cache_protocol.py: 31 passed.

  2. Unit coverage verifies that different physical GPU UUIDs produce different socket and ready paths.

  3. Unit coverage verifies that automatic discovery uses the caller's actual GPU id rather than logical rank or an implicit GPU 0.

  4. Existing static DP and EP compatibility coverage remains passing.

  5. TP1 CUDA end to end validation passed on A40.

  6. TP2 CUDA end to end validation passed on two H100 SXM GPUs, including daemon startup, automatic discovery, CUDA IPC weight import, and generation.


CI States

Latest PR Test (Base): ⏳ Run #33374336440
Latest PR Test (Extra): ⏳ Run #33374336245
Latest PR Test (AMD ROCm 7.2): ⏳ Run #33374336462

@TarangKhanna
TarangKhanna marked this pull request as draft August 23, 2026 17:33
@TarangKhanna
TarangKhanna force-pushed the weight-cache-registry-tarang branch 3 times, most recently from a13d5d8 to 4ed8515 Compare August 24, 2026 17:18
@TarangKhanna
TarangKhanna marked this pull request as ready for review August 24, 2026 17:19
@TarangKhanna
TarangKhanna marked this pull request as draft August 24, 2026 17:21
@liusy58

liusy58 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

@TarangKhanna Is this PR ready for review yet? Can we limit the scope of the codebase it modifies?

@TarangKhanna
TarangKhanna force-pushed the weight-cache-registry-tarang branch 3 times, most recently from 82793ec to 64ce87b Compare August 25, 2026 07:44
@TarangKhanna

Copy link
Copy Markdown
Contributor Author

@TarangKhanna Is this PR ready for review yet? Can we limit the scope of the codebase it modifies?

@liusy58 Not quite yet. I’m doing one final pass to reduce the diff. The change is broader than just changing the socket key because moving from rank based identity to GPU UUID plus config also means the old rank based ready file can no longer provide the ownership/readiness coordination we need. The new path uses an identity scoped lock for ownership and the socket itself for readiness. I’m trimming the remaining lifecycle and wiring changes to only what’s required to preserve those, then I’ll mark it ready once the diff is tighter.

@liusy58

liusy58 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

@liusy58 Not quite yet. I’m doing one final pass to reduce the diff. The change is broader than just changing the socket key because moving from rank based identity to GPU UUID plus config also means the old rank based ready file can no longer provide the ownership/readiness coordination we need. The new path uses an identity scoped lock for ownership and the socket itself for readiness. I’m trimming the remaining lifecycle and wiring changes to only what’s required to preserve those, then I’ll mark it ready once the diff is tighter.

Thanks for your contribution. We’d like to keep the scope of the changes as tight as possible.

@TarangKhanna

Copy link
Copy Markdown
Contributor Author

@liusy58 Not quite yet. I’m doing one final pass to reduce the diff. The change is broader than just changing the socket key because moving from rank based identity to GPU UUID plus config also means the old rank based ready file can no longer provide the ownership/readiness coordination we need. The new path uses an identity scoped lock for ownership and the socket itself for readiness. I’m trimming the remaining lifecycle and wiring changes to only what’s required to preserve those, then I’ll mark it ready once the diff is tighter.

Thanks for your contribution. We’d like to keep the scope of the changes as tight as possible.

I agree. I’ll trim this back to the discovery change and keep the existing startup behavior where possible. The remaining changes will focus on identifying daemons by physical GPU UUID plus cache config, with only the minimal loader wiring needed for that.

@TarangKhanna
TarangKhanna force-pushed the weight-cache-registry-tarang branch 4 times, most recently from 4e83ea9 to b58f5fc Compare August 25, 2026 12:39
@TarangKhanna TarangKhanna changed the title weight cache: discover daemons by GPU UUID and config weight cache: key daemon paths by GPU UUID Aug 25, 2026
StevenChenSE pushed a commit to StevenChenSE/sglang that referenced this pull request Sep 6, 2026
Co-authored-by: siyu <liusy58@linux.alibaba.com>
Co-authored-by: Alex Nails <alex.nails@radixark.ai>
TarangKhanna added a commit to TarangKhanna/sglang that referenced this pull request Sep 7, 2026
Daemon paths were keyed only by physical GPU UUID (sgl-project#36101), so only one cache
per GPU was addressable. Append a digest of the resolved cache-relevant
model/parallel inputs and the TP/PP rank, so caches that differ in
quantization, dtype or model version can coexist on a GPU. Existing
{device_uuid} template syntax and explicit --weight-cache-socket behavior
remain unchanged.
TarangKhanna added a commit to TarangKhanna/sglang that referenced this pull request Sep 16, 2026
Daemon paths were keyed only by physical GPU UUID (sgl-project#36101), so only one cache
per GPU was addressable. Append a digest of the resolved cache-relevant
model/parallel inputs and the TP/PP rank, so caches that differ in
quantization, dtype or model version can coexist on a GPU. Existing
{device_uuid} template syntax and explicit --weight-cache-socket behavior
remain unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants