From 5df4f2c03674a8e5b78d6a2f46e2ce0676ab54be Mon Sep 17 00:00:00 2001 From: "minke.yu" Date: Tue, 13 Oct 2026 18:12:56 +0800 Subject: [PATCH] DEBUG-ONLY: use crc32 for rid fingerprint (builtin hash() is per-process randomized) --- python/sglang/srt/disaggregation/prefill.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/disaggregation/prefill.py b/python/sglang/srt/disaggregation/prefill.py index fae1e9f87d..368369f11b 100644 --- a/python/sglang/srt/disaggregation/prefill.py +++ b/python/sglang/srt/disaggregation/prefill.py @@ -22,6 +22,7 @@ from __future__ import annotations import hashlib import logging import os +import zlib from array import array from collections import deque from http import HTTPStatus @@ -131,7 +132,8 @@ def _dbg_plan(self, batch) -> None: fp = 0 ext_total = 0 for r in reqs: - fp = (fp * 131 + hash(r.rid)) & 0xFFFFFFFFFFFFFFFF + # crc32 而非 hash():后者按进程随机化种子,跨 rank 不可比 + fp = (fp * 131 + zlib.crc32(r.rid.encode())) & 0xFFFFFFFFFFFFFFFF er = getattr(r, "extend_range", None) el = int(er.length) if er is not None else -1 fp = (fp * 131 + el) & 0xFFFFFFFFFFFFFFFF